~rogpeppe/juju-core/azure

« back to all changes in this revision

Viewing changes to cmd/juju/addmachine_test.go

[r=wallyworld] Add container support to force-machine

The deploy --force-machine option now supports containers,
either deploying to existing containers or creating new
ones on nominated machines.

Example syntax:

 juju deploy mysql --force-machine 23
 juju deploy mysql --force-machine 24/lxc/3
 juju deploy mysql --force-machine lxc:25

The last example creates a new lxc container on
machine 25.

The add-machine syntax has been tweaked to remove the
leading "/" from the container arg.

https://codereview.appspot.com/10777044/

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
func (s *AddMachineSuite) TestAddContainerToNewMachine(c *C) {
75
75
        for i, ctype := range instance.SupportedContainerTypes {
76
 
                err := runAddMachine(c, fmt.Sprintf("/%s", ctype))
 
76
                err := runAddMachine(c, fmt.Sprintf("%s", ctype))
77
77
                c.Assert(err, IsNil)
78
78
                s._assertAddContainer(c, strconv.Itoa(2*i), fmt.Sprintf("0/%s/0", ctype), ctype)
79
79
        }
85
85
        err = runAddMachine(c)
86
86
        c.Assert(err, IsNil)
87
87
        for i, container := range instance.SupportedContainerTypes {
88
 
                err := runAddMachine(c, fmt.Sprintf("1/%s", container))
 
88
                err := runAddMachine(c, fmt.Sprintf("%s:1", container))
89
89
                c.Assert(err, IsNil)
90
90
                s._assertAddContainer(c, "1", fmt.Sprintf("1/%s/%d", container, i), container)
91
91
        }
94
94
func (s *AddMachineSuite) TestAddMachineErrors(c *C) {
95
95
        err := runAddMachine(c, ":foo")
96
96
        c.Assert(err, ErrorMatches, `malformed container argument ":foo"`)
97
 
        err = runAddMachine(c, "/lxc", "--constraints", "container=lxc")
 
97
        err = runAddMachine(c, "foo:")
 
98
        c.Assert(err, ErrorMatches, `malformed container argument "foo:"`)
 
99
        err = runAddMachine(c, "lxc", "--constraints", "container=lxc")
98
100
        c.Assert(err, ErrorMatches, `container constraint "lxc" not allowed when adding a machine`)
99
101
}