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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/state/machine_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
import (
7
7
        "sort"
8
 
        "time"
9
8
 
10
9
        "github.com/juju/errors"
11
10
        "github.com/juju/loggo"
901
900
        err := s.machine.SetProvisioned("umbrella/0", "fake_nonce", nil)
902
901
        c.Assert(err, jc.ErrorIsNil)
903
902
 
904
 
        now := time.Now()
 
903
        now := coretesting.ZeroTime()
905
904
        sInfo := status.StatusInfo{
906
 
                Status:  status.StatusRunning,
 
905
                Status:  status.Running,
907
906
                Message: "alive",
908
907
                Since:   &now,
909
908
        }
915
914
        c.Assert(err, jc.ErrorIsNil)
916
915
        machineStatus, err := s.machine.InstanceStatus()
917
916
        c.Assert(err, jc.ErrorIsNil)
918
 
        c.Assert(machineStatus.Status, gc.DeepEquals, status.StatusRunning)
 
917
        c.Assert(machineStatus.Status, gc.DeepEquals, status.Running)
919
918
        c.Assert(machineStatus.Message, gc.DeepEquals, "alive")
920
919
}
921
920
 
1154
1153
        wc.AssertNoChange()
1155
1154
 
1156
1155
        // Change the unit; no change.
1157
 
        now := time.Now()
 
1156
        now := coretesting.ZeroTime()
1158
1157
        sInfo := status.StatusInfo{
1159
 
                Status:  status.StatusIdle,
 
1158
                Status:  status.Idle,
1160
1159
                Message: "",
1161
1160
                Since:   &now,
1162
1161
        }
1190
1189
 
1191
1190
        // Change the subordinate; no change.
1192
1191
        sInfo = status.StatusInfo{
1193
 
                Status:  status.StatusIdle,
 
1192
                Status:  status.Idle,
1194
1193
                Message: "",
1195
1194
                Since:   &now,
1196
1195
        }
1269
1268
        wc.AssertNoChange()
1270
1269
 
1271
1270
        // Change the unit; no change.
1272
 
        now := time.Now()
 
1271
        now := coretesting.ZeroTime()
1273
1272
        sInfo := status.StatusInfo{
1274
 
                Status:  status.StatusIdle,
 
1273
                Status:  status.Idle,
1275
1274
                Message: "",
1276
1275
                Since:   &now,
1277
1276
        }
1306
1305
 
1307
1306
        // Change the subordinate; no change.
1308
1307
        sInfo = status.StatusInfo{
1309
 
                Status:  status.StatusIdle,
 
1308
                Status:  status.Idle,
1310
1309
                Message: "",
1311
1310
                Since:   &now,
1312
1311
        }
2177
2176
        c.Assert(err, jc.ErrorIsNil)
2178
2177
        statusInfo, err := supportedContainer.Status()
2179
2178
        c.Assert(err, jc.ErrorIsNil)
2180
 
        c.Assert(statusInfo.Status, gc.Equals, status.StatusPending)
 
2179
        c.Assert(statusInfo.Status, gc.Equals, status.Pending)
2181
2180
 
2182
2181
        // An unsupported (lxd) container will have an error status.
2183
2182
        err = container.Refresh()
2184
2183
        c.Assert(err, jc.ErrorIsNil)
2185
2184
        statusInfo, err = container.Status()
2186
2185
        c.Assert(err, jc.ErrorIsNil)
2187
 
        c.Assert(statusInfo.Status, gc.Equals, status.StatusError)
 
2186
        c.Assert(statusInfo.Status, gc.Equals, status.Error)
2188
2187
        c.Assert(statusInfo.Message, gc.Equals, "unsupported container")
2189
2188
        c.Assert(statusInfo.Data, gc.DeepEquals, map[string]interface{}{"type": "lxd"})
2190
2189
}
2212
2211
                c.Assert(err, jc.ErrorIsNil)
2213
2212
                statusInfo, err := container.Status()
2214
2213
                c.Assert(err, jc.ErrorIsNil)
2215
 
                c.Assert(statusInfo.Status, gc.Equals, status.StatusError)
 
2214
                c.Assert(statusInfo.Status, gc.Equals, status.Error)
2216
2215
                c.Assert(statusInfo.Message, gc.Equals, "unsupported container")
2217
2216
                containerType := state.ContainerTypeFromId(container.Id())
2218
2217
                c.Assert(statusInfo.Data, gc.DeepEquals, map[string]interface{}{"type": string(containerType)})