~rogpeppe/juju-core/azure

« back to all changes in this revision

Viewing changes to state/state_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:
1071
1071
        assertMachine("0/kvm/4", true)
1072
1072
        assertMachine("0/no-dash/0", false)
1073
1073
        assertMachine("0/lxc/1/embedded/2", true)
 
1074
 
 
1075
        assertMachineOrNewContainer := func(s string, expect bool) {
 
1076
                c.Assert(state.IsMachineOrNewContainer(s), Equals, expect)
 
1077
        }
 
1078
        assertMachineOrNewContainer("0", true)
 
1079
        assertMachineOrNewContainer("00", false)
 
1080
        assertMachineOrNewContainer("1", true)
 
1081
        assertMachineOrNewContainer("0/lxc/0", true)
 
1082
        assertMachineOrNewContainer("lxc:0", true)
 
1083
        assertMachineOrNewContainer("lxc:lxc:0", false)
 
1084
        assertMachineOrNewContainer("kvm:0/lxc/1", true)
 
1085
        assertMachineOrNewContainer("lxc:", false)
 
1086
        assertMachineOrNewContainer(":lxc", false)
 
1087
        assertMachineOrNewContainer("0/lxc/", false)
 
1088
        assertMachineOrNewContainer("0/lxc", false)
 
1089
        assertMachineOrNewContainer("kvm:0/lxc", false)
 
1090
        assertMachine("0/lxc/00", false)
 
1091
        assertMachine("0/lxc/01", false)
 
1092
        assertMachineOrNewContainer("0/lxc/01", false)
 
1093
        assertMachineOrNewContainer("0/lxc/10", true)
 
1094
        assertMachineOrNewContainer("0/kvm/4", true)
 
1095
        assertMachine("0/lxc/1/embedded/2", true)
1074
1096
}
1075
1097
 
1076
1098
type attrs map[string]interface{}