Merge lp:~axwalk/juju-core/azure-test-ensure-called into lp:~go-bot/juju-core/trunk
Proposed by
Andrew Wilkins
Status: | Merged |
---|---|
Approved by: | Andrew Wilkins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2565 |
Proposed branch: | lp:~axwalk/juju-core/azure-test-ensure-called |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
218 lines (+99/-51) 1 file modified
provider/azure/environ_test.go (+99/-51) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/azure-test-ensure-called |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+214147@code.launchpad.net |
Commit message
provider/azure: ensure tests work correctly
Some tests I wrote call StartInstance to
check the parameters passed to createInstance.
The tests don't actually verify that it called
that method successfully, and all validation
is done within the method. Updated the tests
to ensure from outside that the method is called.
Description of the change
provider/azure: ensure tests work correctly
Some tests I wrote call StartInstance to
check the parameters passed to createInstance.
The tests don't actually verify that it called
that method successfully, and all validation
is done within the method. Updated the tests
to ensure from outside that the method is called.
To post a comment you must log in.
Reviewers: mp+214147_ code.launchpad. net,
Message:
Please take a look.
Description:
provider/azure: ensure tests work correctly
Some tests I wrote call StartInstance to
check the parameters passed to createInstance.
The tests don't actually verify that it called
that method successfully, and all validation
is done within the method. Updated the tests
to ensure from outside that the method is called.
https:/ /code.launchpad .net/~axwalk/ juju-core/ azure-test- ensure- called/ +merge/ 214147
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/84290044/
Affected files (+26, -6 lines): azure/environ_ test.go
A [revision details]
M provider/
Index: [revision details] 20140404003547- v7dzlndz9bq9h4q d
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: provider/ azure/environ_ test.go azure/environ_ test.go' azure/environ_ test.go 2014-04-03 18:04:56 +0000 azure/environ_ test.go 2014-04-04 01:54:24 +0000 StartInstancePa rams AssertUploadFak eToolsVersions( c, env.storage, V120p.. .) MachineConfig = environs. NewMachineConfi g("1", "yanonce", nil, AssertUploadFak eToolsVersions( V120p.. ., MachineConfig = environs. NewMachineConfi g(
=== modified file 'provider/
--- provider/
+++ provider/
@@ -1429,44 +1429,62 @@
Tag: "machine-1",
}
var params environs.
- params.Tools = envtesting.
envtesting.
- params.
nil, stateInfo, apiInfo)
+ params.Tools = envtesting.
+ c, env.storage, envtesting.
+ )
+ params.
+ "1", "yanonce", nil, nil, stateInfo, apiInfo,
+ )
// Start out with availability sets disabled. ecfg.attrs[ "availability- sets-enabled" ] = false
env.
var expectServiceName string (&createInstanc e, func(env *azureEnviron, azure ManagementAPI, role *gwacl.Role, serviceName string, stateServer serviceName, gc.Equals, expectServiceName) stateServer, gc.Equals, expectStateServer) StartInstance( params)
var expectStateServer bool
+ var called int
s.PatchValue
*gwacl.
bool) (instance.Instance, error) {
c.Assert(
c.Assert(
+ called++
return nil, nil
})
env.
+ c.Assert(called, gc.Equals, 1)
- // DistributionGroup won't have an effect if sets-enabled= false. sets-enabled= false. eName = "" DistributionGro up = func() ([]instance.Id, error) { Id{instance. Id(env. getEnvPrefix( ) Id(env. getEnvPrefix( ) + "whatever-role0"), StartInstance( params)
availability-
+ // DistributionGroup won't have an effect if
+ // availability-
expectServic
params.
- return []instance.
+ "whatever-role0")}, nil
+ return []instance.Id{
+ instance.
+ }, nil
}
env.
+ c.Assert(called, gc.Equals, 2)
env. ecfg.attrs[ "availability- sets-enabled" ] = true eName = "juju-testenv- whatever" StartInstance( params)
expectServic
env.
+ c.Assert(called, gc.Equals, 3)
expectServic eName = "" DistributionGro up = nil StartInstance( params)
params.
env.
+ c.Assert(called, gc.Equals, 4)
// Empty distribution group is equivalent to no DistributionGroup DistributionGro up = func() ([]ins...
function.
params.