~ubuntu-branches/ubuntu/saucy/juju-core/saucy

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/cmd/juju/deploy_test.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-07-23 08:51:44 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130723085144-0oty5omapea7t8xt
Tags: 1.11.4-0ubuntu1
* New upstream release:
  - d/copyright: Drop section for go-curl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
                args: []string{"craziness", "burble1", "-n", "0"},
44
44
                err:  `--num-units must be a positive integer`,
45
45
        }, {
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"`,
48
48
        }, {
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`,
51
51
        }, {
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`)
173
173
}
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())
193
193
}
201
201
        }
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()
223
223
 
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`)
240
240
}