Skip to content

Commit

Permalink
state: introduce AddUnitParams
Browse files Browse the repository at this point in the history
We parameterise the Application.AddUnit method,
and update all of the existing calls. The
AddUnitParams struct is currently empty;
it will be updated with the IDs of storage
instances to attach to the unit in a follow-up.
  • Loading branch information
axw committed Jun 2, 2017
1 parent 517cd33 commit 104d543
Show file tree
Hide file tree
Showing 73 changed files with 343 additions and 336 deletions.
2 changes: 1 addition & 1 deletion api/agent/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *unitSuite) SetUpTest(c *gc.C) {
var err error
s.JujuConnSuite.SetUpTest(c)
svc := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
s.unit, err = svc.AddUnit()
s.unit, err = svc.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
password, err := utils.RandomPassword()
c.Assert(err, jc.ErrorIsNil)
Expand Down
4 changes: 2 additions & 2 deletions api/deployer/deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *deployerSuite) SetUpTest(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)

// Create principal and subordinate units and assign them.
s.principal, err = s.service0.AddUnit()
s.principal, err = s.service0.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = s.principal.AssignToMachine(s.machine)
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -139,7 +139,7 @@ func (s *deployerSuite) TestUnit(c *gc.C) {
// First create a new machine and deploy another unit there.
machine, err := s.State.AddMachine("quantal", state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
principal1, err := s.service0.AddUnit()
principal1, err := s.service0.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = principal1.AssignToMachine(machine)
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion api/firewaller/firewaller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *firewallerSuite) SetUpTest(c *gc.C) {
s.application = s.AddTestingService(c, "wordpress", s.charm)
// Add the rest of the units and assign them.
for i := 0; i <= 2; i++ {
s.units[i], err = s.application.AddUnit()
s.units[i], err = s.application.AddUnit(state.AddUnitParams{})
c.Check(err, jc.ErrorIsNil)
err = s.units[i].AssignToMachine(s.machines[i])
c.Check(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion api/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (s *provisionerSuite) TestDistributionGroup(c *gc.C) {

var unitNames []string
for i := 0; i < 3; i++ {
unit, err := wordpress.AddUnit()
unit, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
unitNames = append(unitNames, unit.Name())
err = unit.AssignToMachine(machine1)
Expand Down
3 changes: 2 additions & 1 deletion api/uniter/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
apitesting "github.com/juju/juju/api/testing"
"github.com/juju/juju/apiserver/params"
"github.com/juju/juju/network"
"github.com/juju/juju/state"
)

type stateSuite struct {
Expand Down Expand Up @@ -46,7 +47,7 @@ func (s *stateSuite) TestAllMachinePorts(c *gc.C) {
c.Assert(unitPorts, gc.HasLen, 0)

// Add another wordpress unit on the same machine.
wordpressUnit1, err := s.wordpressApplication.AddUnit()
wordpressUnit1, err := s.wordpressApplication.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = wordpressUnit1.AssignToMachine(s.wordpressMachine)
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/uniter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (s *uniterSuite) addMachineBoundAppCharmAndUnit(c *gc.C, appName string, bi
})
c.Assert(err, jc.ErrorIsNil)

unit, err := app.AddUnit()
unit, err := app.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)

err = unit.AssignToMachine(machine)
Expand Down
2 changes: 1 addition & 1 deletion api/upgrader/unitupgrader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *unitUpgraderSuite) addMachineServiceCharmAndUnit(c *gc.C, serviceName s
c.Assert(err, jc.ErrorIsNil)
charm := s.AddTestingCharm(c, serviceName)
service := s.AddTestingService(c, serviceName, charm)
unit, err := service.AddUnit()
unit, err := service.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = unit.AssignToMachine(machine)
c.Assert(err, jc.ErrorIsNil)
Expand Down
4 changes: 2 additions & 2 deletions api/watcher/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (s *watcherSuite) TestWatchUnitsKeepsEvents(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
rel, err := s.State.AddRelation(eps...)
c.Assert(err, jc.ErrorIsNil)
principal, err := mysql.AddUnit()
principal, err := mysql.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = principal.AssignToMachine(s.rawMachine)
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -166,7 +166,7 @@ func (s *watcherSuite) TestStringsWatcherStopsWithPendingSend(c *gc.C) {

// Create a service, deploy a unit of it on the machine.
mysql := s.AddTestingService(c, "mysql", s.AddTestingCharm(c, "mysql"))
principal, err := mysql.AddUnit()
principal, err := mysql.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = principal.AssignToMachine(s.rawMachine)
c.Assert(err, jc.ErrorIsNil)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/action/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *runSuite) addMachine(c *gc.C) *state.Machine {
}

func (s *runSuite) addUnit(c *gc.C, service *state.Application) *state.Unit {
unit, err := service.AddUnit()
unit, err := service.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = unit.AssignToNewMachine()
c.Assert(err, jc.ErrorIsNil)
Expand All @@ -63,7 +63,7 @@ func (s *runSuite) TestGetAllUnitNames(c *gc.C) {

notAssigned, err := s.State.AddApplication(state.AddApplicationArgs{Name: "not-assigned", Charm: charm})
c.Assert(err, jc.ErrorIsNil)
_, err = notAssigned.AddUnit()
_, err = notAssigned.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)

_, err = s.State.AddApplication(state.AddApplicationArgs{Name: "no-units", Charm: charm})
Expand Down
12 changes: 6 additions & 6 deletions apiserver/application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,7 @@ func (s *applicationSuite) TestDestroyPrincipalUnits(c *gc.C) {
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
units := make([]*state.Unit, 5)
for i := range units {
unit, err := wordpress.AddUnit()
unit, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
unit.AssignToNewMachine()
c.Assert(err, jc.ErrorIsNil)
Expand All @@ -2143,7 +2143,7 @@ func (s *applicationSuite) TestDestroyPrincipalUnits(c *gc.C) {

func (s *applicationSuite) TestDestroySubordinateUnits(c *gc.C) {
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
wordpress0, err := wordpress.AddUnit()
wordpress0, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
s.AddTestingService(c, "logging", s.AddTestingCharm(c, "logging"))
eps, err := s.State.InferEndpoints("logging", "wordpress")
Expand Down Expand Up @@ -2209,7 +2209,7 @@ func (s *applicationSuite) setupDestroyPrincipalUnits(c *gc.C) []*state.Unit {
units := make([]*state.Unit, 5)
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
for i := range units {
unit, err := wordpress.AddUnit()
unit, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = unit.AssignToNewMachine()
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -2285,7 +2285,7 @@ func (s *applicationSuite) assertDestroySubordinateUnits(c *gc.C, wordpress0, lo

func (s *applicationSuite) TestBlockRemoveDestroySubordinateUnits(c *gc.C) {
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
wordpress0, err := wordpress.AddUnit()
wordpress0, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
s.AddTestingService(c, "logging", s.AddTestingCharm(c, "logging"))
eps, err := s.State.InferEndpoints("logging", "wordpress")
Expand Down Expand Up @@ -2320,7 +2320,7 @@ func (s *applicationSuite) TestBlockRemoveDestroySubordinateUnits(c *gc.C) {

func (s *applicationSuite) TestBlockChangesDestroySubordinateUnits(c *gc.C) {
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
wordpress0, err := wordpress.AddUnit()
wordpress0, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
s.AddTestingService(c, "logging", s.AddTestingCharm(c, "logging"))
eps, err := s.State.InferEndpoints("logging", "wordpress")
Expand Down Expand Up @@ -2355,7 +2355,7 @@ func (s *applicationSuite) TestBlockChangesDestroySubordinateUnits(c *gc.C) {

func (s *applicationSuite) TestBlockDestroyDestroySubordinateUnits(c *gc.C) {
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
wordpress0, err := wordpress.AddUnit()
wordpress0, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
s.AddTestingService(c, "logging", s.AddTestingCharm(c, "logging"))
eps, err := s.State.InferEndpoints("logging", "wordpress")
Expand Down
2 changes: 1 addition & 1 deletion apiserver/application/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type BlockChecker interface {
// details on the methods, see the methods on state.Application with
// the same names.
type Application interface {
AddUnit() (*state.Unit, error)
AddUnit(state.AddUnitParams) (*state.Unit, error)
AllUnits() ([]Unit, error)
Charm() (Charm, bool, error)
CharmURL() (*charm.URL, bool)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/application/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type UnitAssigner interface {
}

type UnitAdder interface {
AddUnit() (*state.Unit, error)
AddUnit(state.AddUnitParams) (*state.Unit, error)
}

// DeployApplication takes a charm and various parameters and deploys it.
Expand Down Expand Up @@ -178,7 +178,7 @@ func addUnits(
policy := state.AssignCleanEmpty
// TODO what do we do if we fail half-way through this process?
for i := 0; i < n; i++ {
unit, err := unitAdder.AddUnit()
unit, err := unitAdder.AddUnit(state.AddUnitParams{})
if err != nil {
return nil, errors.Annotatef(err, "cannot add unit %d/%d to application %q", i+1, n, appName)
}
Expand Down
2 changes: 1 addition & 1 deletion apiserver/authentication/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (s *agentAuthenticatorSuite) SetUpTest(c *gc.C) {
// add a unit for testing unit agent authentication
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
c.Assert(err, jc.ErrorIsNil)
unit, err := wordpress.AddUnit()
unit, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
s.unit = unit
password, err = utils.RandomPassword()
Expand Down
2 changes: 1 addition & 1 deletion apiserver/authentication/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *userAuthenticatorSuite) TestMachineLoginFails(c *gc.C) {
func (s *userAuthenticatorSuite) TestUnitLoginFails(c *gc.C) {
// add a unit for testing unit agent authentication
wordpress := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
unit, err := wordpress.AddUnit()
unit, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
password, err := utils.RandomPassword()
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charmrevisionupdater/testing/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s *CharmSuite) AddService(c *gc.C, charmName, serviceName string) {
func (s *CharmSuite) AddUnit(c *gc.C, serviceName, machineId string) {
svc, err := s.jcSuite.State.Application(serviceName)
c.Assert(err, jc.ErrorIsNil)
u, err := svc.AddUnit()
u, err := svc.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
m, err := s.jcSuite.State.Machine(machineId)
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/client/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func (s *baseSuite) setUpScenario(c *gc.C) (entities []names.Tag) {
c.Assert(err, jc.ErrorIsNil)

for i := 0; i < 2; i++ {
wu, err := wordpress.AddUnit()
wu, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
c.Assert(wu.Tag(), gc.Equals, names.NewUnitTag(fmt.Sprintf("wordpress/%d", i)))
setDefaultPassword(c, wu)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func (s *clientSuite) setupDestroyMachinesTest(c *gc.C) (*state.Machine, *state.

sch := s.AddTestingCharm(c, "wordpress")
wordpress := s.AddTestingService(c, "wordpress", sch)
u, err := wordpress.AddUnit()
u, err := wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = u.AssignToMachine(m1)
c.Assert(err, jc.ErrorIsNil)
Expand Down
10 changes: 5 additions & 5 deletions apiserver/client/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (s *statusUnitTestSuite) TestMeterStatus(c *gc.C) {
c.Assert(units, gc.HasLen, 0)

for i, unit := range testUnits {
u, err := service.AddUnit()
u, err := service.AddUnit(state.AddUnitParams{})
testUnits[i].unitName = u.Name()
c.Assert(err, jc.ErrorIsNil)
if unit.setStatus != nil {
Expand Down Expand Up @@ -193,7 +193,7 @@ func (s *statusUnitTestSuite) TestNoMeterStatusWhenNotRequired(c *gc.C) {
c.Assert(units, gc.HasLen, 0)

for i, unit := range testUnits {
u, err := service.AddUnit()
u, err := service.AddUnit(state.AddUnitParams{})
testUnits[i].unitName = u.Name()
c.Assert(err, jc.ErrorIsNil)
if unit.setStatus != nil {
Expand Down Expand Up @@ -221,7 +221,7 @@ func (s *statusUnitTestSuite) TestMeterStatusWithCredentials(c *gc.C) {
c.Assert(units, gc.HasLen, 0)

for i, unit := range testUnits {
u, err := service.AddUnit()
u, err := service.AddUnit(state.AddUnitParams{})
testUnits[i].unitName = u.Name()
c.Assert(err, jc.ErrorIsNil)
if unit.setStatus != nil {
Expand Down Expand Up @@ -251,7 +251,7 @@ func (s *statusUnitTestSuite) TestMeterStatusWithCredentials(c *gc.C) {
}

func addUnitWithVersion(c *gc.C, application *state.Application, version string) *state.Unit {
unit, err := application.AddUnit()
unit, err := application.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
// Ensure that the timestamp on this version record is different
// from the previous one.
Expand Down Expand Up @@ -316,7 +316,7 @@ func (s *statusUnitTestSuite) TestWorkloadVersionNoUnits(c *gc.C) {

func (s *statusUnitTestSuite) TestWorkloadVersionOkWithUnset(c *gc.C) {
application := s.Factory.MakeApplication(c, nil)
unit, err := application.AddUnit()
unit, err := application.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
appStatus := s.checkAppVersion(c, application, "")
checkUnitVersion(c, appStatus, unit, "")
Expand Down
4 changes: 2 additions & 2 deletions apiserver/deployer/deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ func (s *deployerSuite) SetUpTest(c *gc.C) {
rel, err := s.State.AddRelation(eps...)
c.Assert(err, jc.ErrorIsNil)

s.principal0, err = s.service0.AddUnit()
s.principal0, err = s.service0.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = s.principal0.AssignToMachine(s.machine1)
c.Assert(err, jc.ErrorIsNil)

s.principal1, err = s.service0.AddUnit()
s.principal1, err = s.service0.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = s.principal1.AssignToMachine(s.machine0)
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/firewaller/firewaller_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *firewallerBaseSuite) setUpTest(c *gc.C) {
s.service = s.AddTestingService(c, "wordpress", s.charm)
// Add the rest of the units and assign them.
for i := 0; i <= 2; i++ {
unit, err := s.service.AddUnit()
unit, err := s.service.AddUnit(state.AddUnitParams{})
c.Check(err, jc.ErrorIsNil)
err = unit.AssignToMachine(s.machines[i])
c.Check(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ func (s *withoutControllerSuite) TestDistributionGroup(c *gc.C) {
addUnits := func(name string, machines ...*state.Machine) (units []*state.Unit) {
svc := s.AddTestingService(c, name, s.AddTestingCharm(c, name))
for _, m := range machines {
unit, err := svc.AddUnit()
unit, err := svc.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = unit.AssignToMachine(m)
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/provisioner/provisioninginfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (s *withoutControllerSuite) TestProvisioningInfoWithEndpointBindings(c *gc.
}
wordpressCharm := s.AddTestingCharm(c, "wordpress")
wordpressService := s.AddTestingServiceWithBindings(c, "wordpress", wordpressCharm, bindings)
wordpressUnit, err := wordpressService.AddUnit()
wordpressUnit, err := wordpressService.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = wordpressUnit.AssignToMachine(wordpressMachine)
c.Assert(err, jc.ErrorIsNil)
Expand Down
6 changes: 3 additions & 3 deletions apiserver/uniter/uniter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (s *uniterSuite) TestLife(c *gc.C) {

// Add another unit, so the service will stay dying when we
// destroy it later.
extraUnit, err := s.wordpress.AddUnit()
extraUnit, err := s.wordpress.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
c.Assert(extraUnit, gc.NotNil)

Expand Down Expand Up @@ -2275,7 +2275,7 @@ func (s *uniterSuite) TestStorageAttachments(c *gc.C) {
"data": {Pool: "", Size: 1024, Count: 1},
}
service := s.AddTestingServiceWithStorage(c, "storage-block", ch, sCons)
unit, err := service.AddUnit()
unit, err := service.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = s.State.AssignUnit(unit, state.AssignCleanEmpty)
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -2407,7 +2407,7 @@ func (s *uniterSuite) TestAllMachinePorts(c *gc.C) {
c.Assert(unitPorts, gc.HasLen, 0)

// Add another mysql unit on machine 0.
mysqlUnit1, err := s.mysql.AddUnit()
mysqlUnit1, err := s.mysql.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
err = mysqlUnit1.AssignToMachine(s.machine0)
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/upgrader/unitupgrader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (s *unitUpgraderSuite) SetUpTest(c *gc.C) {
_, err = s.State.AddMachine("quantal", state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
svc := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
s.rawUnit, err = svc.AddUnit()
s.rawUnit, err = svc.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
// Assign the unit to the machine.
s.rawMachine, err = s.rawUnit.AssignToCleanMachine()
Expand Down
5 changes: 3 additions & 2 deletions cmd/juju/setmeterstatus/setmeterstatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/juju/juju/cmd/juju/setmeterstatus"
"github.com/juju/juju/cmd/modelcmd"
jujutesting "github.com/juju/juju/juju/testing"
"github.com/juju/juju/state"
coretesting "github.com/juju/juju/testing"
"github.com/juju/juju/testing/factory"
)
Expand Down Expand Up @@ -96,9 +97,9 @@ func (s *DebugMetricsCommandSuite) TestUnits(c *gc.C) {
func (s *DebugMetricsCommandSuite) TestService(c *gc.C) {
charm := s.Factory.MakeCharm(c, &factory.CharmParams{Name: "mysql", URL: "local:quantal/mysql-1"})
service := s.Factory.MakeApplication(c, &factory.ApplicationParams{Charm: charm})
unit0, err := service.AddUnit()
unit0, err := service.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
unit1, err := service.AddUnit()
unit1, err := service.AddUnit(state.AddUnitParams{})
c.Assert(err, jc.ErrorIsNil)
_, err = cmdtesting.RunCommand(c, setmeterstatus.New(), "mysql", "RED", "--info", "foobar")
c.Assert(err, jc.ErrorIsNil)
Expand Down
Loading

0 comments on commit 104d543

Please sign in to comment.