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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/apiserver/common/storagecommon/storage_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:
12
12
        gc "gopkg.in/check.v1"
13
13
 
14
14
        "github.com/juju/juju/apiserver/common/storagecommon"
 
15
        apiservertesting "github.com/juju/juju/apiserver/testing"
15
16
        "github.com/juju/juju/state"
16
17
        statetesting "github.com/juju/juju/state/testing"
17
18
        "github.com/juju/juju/storage"
155
156
        st                       *fakeStorage
156
157
        storageInstance          *fakeStorageInstance
157
158
        volume                   *fakeVolume
158
 
        volumeAttachmentWatcher  *fakeNotifyWatcher
159
 
        blockDevicesWatcher      *fakeNotifyWatcher
160
 
        storageAttachmentWatcher *fakeNotifyWatcher
 
159
        volumeAttachmentWatcher  *apiservertesting.FakeNotifyWatcher
 
160
        blockDevicesWatcher      *apiservertesting.FakeNotifyWatcher
 
161
        storageAttachmentWatcher *apiservertesting.FakeNotifyWatcher
161
162
}
162
163
 
163
164
var _ = gc.Suite(&watchStorageAttachmentSuite{})
172
173
                kind:  state.StorageKindBlock,
173
174
        }
174
175
        s.volume = &fakeVolume{tag: names.NewVolumeTag("0")}
175
 
        s.volumeAttachmentWatcher = &fakeNotifyWatcher{ch: make(chan struct{}, 1)}
176
 
        s.blockDevicesWatcher = &fakeNotifyWatcher{ch: make(chan struct{}, 1)}
177
 
        s.storageAttachmentWatcher = &fakeNotifyWatcher{ch: make(chan struct{}, 1)}
178
 
        s.volumeAttachmentWatcher.ch <- struct{}{}
179
 
        s.blockDevicesWatcher.ch <- struct{}{}
180
 
        s.storageAttachmentWatcher.ch <- struct{}{}
 
176
        s.volumeAttachmentWatcher = apiservertesting.NewFakeNotifyWatcher()
 
177
        s.volumeAttachmentWatcher.C <- struct{}{}
 
178
        s.blockDevicesWatcher = apiservertesting.NewFakeNotifyWatcher()
 
179
        s.blockDevicesWatcher.C <- struct{}{}
 
180
        s.storageAttachmentWatcher = apiservertesting.NewFakeNotifyWatcher()
 
181
        s.storageAttachmentWatcher.C <- struct{}{}
181
182
        s.st = &fakeStorage{
182
183
                storageInstance: func(tag names.StorageTag) (state.StorageInstance, error) {
183
184
                        return s.storageInstance, nil
199
200
 
200
201
func (s *watchStorageAttachmentSuite) TestWatchStorageAttachmentVolumeAttachmentChanges(c *gc.C) {
201
202
        s.testWatchBlockStorageAttachment(c, func() {
202
 
                s.volumeAttachmentWatcher.ch <- struct{}{}
 
203
                s.volumeAttachmentWatcher.C <- struct{}{}
203
204
        })
204
205
}
205
206
 
206
207
func (s *watchStorageAttachmentSuite) TestWatchStorageAttachmentStorageAttachmentChanges(c *gc.C) {
207
208
        s.testWatchBlockStorageAttachment(c, func() {
208
 
                s.storageAttachmentWatcher.ch <- struct{}{}
 
209
                s.storageAttachmentWatcher.C <- struct{}{}
209
210
        })
210
211
}
211
212
 
212
213
func (s *watchStorageAttachmentSuite) TestWatchStorageAttachmentBlockDevicesChange(c *gc.C) {
213
214
        s.testWatchBlockStorageAttachment(c, func() {
214
 
                s.blockDevicesWatcher.ch <- struct{}{}
 
215
                s.blockDevicesWatcher.C <- struct{}{}
215
216
        })
216
217
}
217
218