43
43
args: []string{"craziness", "burble1", "-n", "0"},
44
44
err: `--num-units must be a positive integer`,
46
args: []string{"craziness", "burble1", "--force-machine", "bigglesplop"},
47
err: `invalid --force-machine parameter "bigglesplop"`,
46
args: []string{"craziness", "burble1", "--to", "bigglesplop"},
47
err: `invalid --to parameter "bigglesplop"`,
49
args: []string{"craziness", "burble1", "-n", "2", "--force-machine", "123"},
50
err: `cannot use --num-units > 1 with --force-machine`,
49
args: []string{"craziness", "burble1", "-n", "2", "--to", "123"},
50
err: `cannot use --num-units > 1 with --to`,
52
52
args: []string{"craziness", "burble1", "--constraints", "gibber=plop"},
53
53
err: `invalid value "gibber=plop" for flag --constraints: unknown constraint "gibber"`,
167
167
func (s *DeploySuite) TestNumUnitsSubordinate(c *C) {
168
168
coretesting.Charms.BundlePath(s.SeriesPath, "logging")
169
169
err := runDeploy(c, "--num-units", "3", "local:logging")
170
c.Assert(err, ErrorMatches, "cannot use --num-units or --force-machine with subordinate service")
170
c.Assert(err, ErrorMatches, "cannot use --num-units or --to with subordinate service")
171
171
_, err = s.State.Service("dummy")
172
172
c.Assert(err, ErrorMatches, `service "dummy" not found`)
187
187
coretesting.Charms.BundlePath(s.SeriesPath, "dummy")
188
188
machine, err := s.State.AddMachine("precise", state.JobHostUnits)
189
189
c.Assert(err, IsNil)
190
err = runDeploy(c, "--force-machine", machine.Id(), "local:dummy", "portlandia")
190
err = runDeploy(c, "--to", machine.Id(), "local:dummy", "portlandia")
191
191
c.Assert(err, IsNil)
192
192
s.assertForceMachine(c, machine.Id())
202
202
container, err := s.State.AddMachineWithConstraints(params)
203
203
c.Assert(err, IsNil)
204
err = runDeploy(c, "--force-machine", container.Id(), "local:dummy", "portlandia")
204
err = runDeploy(c, "--to", container.Id(), "local:dummy", "portlandia")
205
205
c.Assert(err, IsNil)
206
206
s.assertForceMachine(c, container.Id())
207
207
machines, err := s.State.AllMachines()
213
213
coretesting.Charms.BundlePath(s.SeriesPath, "dummy")
214
214
machine, err := s.State.AddMachine("precise", state.JobHostUnits)
215
215
c.Assert(err, IsNil)
216
err = runDeploy(c, "--force-machine", "lxc:"+machine.Id(), "local:dummy", "portlandia")
216
err = runDeploy(c, "--to", "lxc:"+machine.Id(), "local:dummy", "portlandia")
217
217
c.Assert(err, IsNil)
218
218
s.assertForceMachine(c, machine.Id()+"/lxc/0")
219
219
machines, err := s.State.AllMachines()
224
224
func (s *DeploySuite) TestForceMachineNotFound(c *C) {
225
225
coretesting.Charms.BundlePath(s.SeriesPath, "dummy")
226
err := runDeploy(c, "--force-machine", "42", "local:dummy", "portlandia")
226
err := runDeploy(c, "--to", "42", "local:dummy", "portlandia")
227
227
c.Assert(err, ErrorMatches, `cannot assign unit "portlandia/0" to machine: machine 42 not found`)
228
228
_, err = s.State.Service("dummy")
229
229
c.Assert(err, ErrorMatches, `service "dummy" not found`)
233
233
machine, err := s.State.AddMachine("precise", state.JobHostUnits)
234
234
c.Assert(err, IsNil)
235
235
coretesting.Charms.BundlePath(s.SeriesPath, "logging")
236
err = runDeploy(c, "--force-machine", machine.Id(), "local:logging")
237
c.Assert(err, ErrorMatches, "cannot use --num-units or --force-machine with subordinate service")
236
err = runDeploy(c, "--to", machine.Id(), "local:logging")
237
c.Assert(err, ErrorMatches, "cannot use --num-units or --to with subordinate service")
238
238
_, err = s.State.Service("dummy")
239
239
c.Assert(err, ErrorMatches, `service "dummy" not found`)