~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/machiner/machiner_test.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        "github.com/juju/juju/juju/testing"
23
23
        "github.com/juju/juju/network"
24
24
        "github.com/juju/juju/state"
 
25
        "github.com/juju/juju/status"
25
26
        coretesting "github.com/juju/juju/testing"
26
27
        "github.com/juju/juju/worker"
27
28
        "github.com/juju/juju/worker/machiner"
126
127
        )
127
128
        s.accessor.machine.CheckCall(
128
129
                c, 5, "SetStatus",
129
 
                params.StatusStopped,
 
130
                status.StatusStopped,
130
131
                "",
131
132
                map[string]interface{}(nil),
132
133
        )
227
228
        }, {
228
229
                FuncName: "SetStatus",
229
230
                Args: []interface{}{
230
 
                        params.StatusStarted,
 
231
                        status.StatusStarted,
231
232
                        "",
232
233
                        map[string]interface{}(nil),
233
234
                },
240
241
        }, {
241
242
                FuncName: "SetStatus",
242
243
                Args: []interface{}{
243
 
                        params.StatusStopped,
 
244
                        status.StatusStopped,
244
245
                        "",
245
246
                        map[string]interface{}(nil),
246
247
                },
290
291
 
291
292
}
292
293
 
293
 
func (s *MachinerStateSuite) waitMachineStatus(c *gc.C, m *state.Machine, expectStatus state.Status) {
 
294
func (s *MachinerStateSuite) waitMachineStatus(c *gc.C, m *state.Machine, expectStatus status.Status) {
294
295
        timeout := time.After(worstCase)
295
296
        for {
296
297
                select {
361
362
func (s *MachinerStateSuite) TestStartSetsStatus(c *gc.C) {
362
363
        statusInfo, err := s.machine.Status()
363
364
        c.Assert(err, jc.ErrorIsNil)
364
 
        c.Assert(statusInfo.Status, gc.Equals, state.StatusPending)
 
365
        c.Assert(statusInfo.Status, gc.Equals, status.StatusPending)
365
366
        c.Assert(statusInfo.Message, gc.Equals, "")
366
367
 
367
368
        mr := s.makeMachiner(c, false, nil)
368
369
        defer worker.Stop(mr)
369
370
 
370
 
        s.waitMachineStatus(c, s.machine, state.StatusStarted)
 
371
        s.waitMachineStatus(c, s.machine, status.StatusStarted)
371
372
}
372
373
 
373
374
func (s *MachinerStateSuite) TestSetsStatusWhenDying(c *gc.C) {
374
375
        mr := s.makeMachiner(c, false, nil)
375
376
        defer worker.Stop(mr)
376
377
        c.Assert(s.machine.Destroy(), jc.ErrorIsNil)
377
 
        s.waitMachineStatus(c, s.machine, state.StatusStopped)
 
378
        s.waitMachineStatus(c, s.machine, status.StatusStopped)
378
379
}
379
380
 
380
381
func (s *MachinerStateSuite) TestSetDead(c *gc.C) {