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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/state/status_filesystem_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:
4
4
package state_test
5
5
 
6
6
import (
7
 
        "time"
8
 
 
9
7
        jc "github.com/juju/testing/checkers"
10
8
        gc "gopkg.in/check.v1"
11
9
 
12
10
        "github.com/juju/juju/state"
13
11
        "github.com/juju/juju/status"
 
12
        "github.com/juju/juju/testing"
14
13
)
15
14
 
16
15
type FilesystemStatusSuite struct {
53
52
func (s *FilesystemStatusSuite) checkInitialStatus(c *gc.C) {
54
53
        statusInfo, err := s.filesystem.Status()
55
54
        c.Check(err, jc.ErrorIsNil)
56
 
        c.Check(statusInfo.Status, gc.Equals, status.StatusPending)
 
55
        c.Check(statusInfo.Status, gc.Equals, status.Pending)
57
56
        c.Check(statusInfo.Message, gc.Equals, "")
58
57
        c.Check(statusInfo.Data, gc.HasLen, 0)
59
58
        c.Check(statusInfo.Since, gc.NotNil)
60
59
}
61
60
 
62
61
func (s *FilesystemStatusSuite) TestSetErrorStatusWithoutInfo(c *gc.C) {
63
 
        now := time.Now()
 
62
        now := testing.ZeroTime()
64
63
        sInfo := status.StatusInfo{
65
 
                Status:  status.StatusError,
 
64
                Status:  status.Error,
66
65
                Message: "",
67
66
                Since:   &now,
68
67
        }
73
72
}
74
73
 
75
74
func (s *FilesystemStatusSuite) TestSetUnknownStatus(c *gc.C) {
76
 
        now := time.Now()
 
75
        now := testing.ZeroTime()
77
76
        sInfo := status.StatusInfo{
78
77
                Status:  status.Status("vliegkat"),
79
78
                Message: "orville",
86
85
}
87
86
 
88
87
func (s *FilesystemStatusSuite) TestSetOverwritesData(c *gc.C) {
89
 
        now := time.Now()
 
88
        now := testing.ZeroTime()
90
89
        sInfo := status.StatusInfo{
91
 
                Status:  status.StatusAttaching,
 
90
                Status:  status.Attaching,
92
91
                Message: "blah",
93
92
                Data: map[string]interface{}{
94
93
                        "pew.pew": "zap",
106
105
}
107
106
 
108
107
func (s *FilesystemStatusSuite) checkGetSetStatus(c *gc.C) {
109
 
        now := time.Now()
 
108
        now := testing.ZeroTime()
110
109
        sInfo := status.StatusInfo{
111
 
                Status:  status.StatusAttaching,
 
110
                Status:  status.Attaching,
112
111
                Message: "blah",
113
112
                Data: map[string]interface{}{
114
113
                        "$foo.bar.baz": map[string]interface{}{
125
124
 
126
125
        statusInfo, err := filesystem.Status()
127
126
        c.Check(err, jc.ErrorIsNil)
128
 
        c.Check(statusInfo.Status, gc.Equals, status.StatusAttaching)
 
127
        c.Check(statusInfo.Status, gc.Equals, status.Attaching)
129
128
        c.Check(statusInfo.Message, gc.Equals, "blah")
130
129
        c.Check(statusInfo.Data, jc.DeepEquals, map[string]interface{}{
131
130
                "$foo.bar.baz": map[string]interface{}{
163
162
func (s *FilesystemStatusSuite) TestGetSetStatusGone(c *gc.C) {
164
163
        s.obliterateFilesystem(c, s.filesystem.FilesystemTag())
165
164
 
166
 
        now := time.Now()
 
165
        now := testing.ZeroTime()
167
166
        sInfo := status.StatusInfo{
168
 
                Status:  status.StatusAttaching,
 
167
                Status:  status.Attaching,
169
168
                Message: "not really",
170
169
                Since:   &now,
171
170
        }
178
177
}
179
178
 
180
179
func (s *FilesystemStatusSuite) TestSetStatusPendingUnprovisioned(c *gc.C) {
181
 
        now := time.Now()
 
180
        now := testing.ZeroTime()
182
181
        sInfo := status.StatusInfo{
183
 
                Status:  status.StatusPending,
 
182
                Status:  status.Pending,
184
183
                Message: "still",
185
184
                Since:   &now,
186
185
        }
193
192
                FilesystemId: "fs-id",
194
193
        })
195
194
        c.Assert(err, jc.ErrorIsNil)
196
 
        now := time.Now()
 
195
        now := testing.ZeroTime()
197
196
        sInfo := status.StatusInfo{
198
 
                Status:  status.StatusPending,
 
197
                Status:  status.Pending,
199
198
                Message: "",
200
199
                Since:   &now,
201
200
        }