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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/featuretests/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:
33
33
        c.Assert(err, jc.ErrorIsNil)
34
34
 
35
35
        registry.RegisterEnvironStorageProviders("dummy", ec2.EBS_ProviderType)
36
 
        registry.RegisterEnvironStorageProviders("dummymodel", ec2.EBS_ProviderType)
 
36
        registry.RegisterEnvironStorageProviders("admin", ec2.EBS_ProviderType)
37
37
}
38
38
 
39
39
func makeStorageCons(pool string, size, count uint64) state.StorageConstraints {
64
64
}
65
65
 
66
66
func runShow(c *gc.C, expectedError string, args ...string) {
67
 
        cmdArgs := append([]string{"storage", "show"}, args...)
 
67
        cmdArgs := append([]string{"show-storage"}, args...)
68
68
        context, err := runJujuCommand(c, cmdArgs...)
69
69
        if expectedError == "" {
70
70
                c.Assert(err, jc.ErrorIsNil)
97
97
      storage-block/0:
98
98
        machine: "0"
99
99
`[1:]
100
 
        context, err := runJujuCommand(c, "storage", "show", "data/0")
 
100
        context, err := runJujuCommand(c, "show-storage", "data/0")
101
101
        c.Assert(err, jc.ErrorIsNil)
102
102
        c.Assert(testing.Stdout(context), gc.Matches, expected)
103
103
}
114
114
}
115
115
 
116
116
func runList(c *gc.C, expectedOutput string, args ...string) {
117
 
        cmdArgs := append([]string{"storage", "list"}, args...)
 
117
        cmdArgs := append([]string{"list-storage"}, args...)
118
118
        context, err := runJujuCommand(c, cmdArgs...)
119
119
        c.Assert(err, jc.ErrorIsNil)
120
120
        c.Assert(testing.Stdout(context), gc.Equals, expectedOutput)
173
173
      storage-block/0:
174
174
        machine: "0"
175
175
`[1:]
176
 
        context, err := runJujuCommand(c, "storage", "show", "data/0")
 
176
        context, err := runJujuCommand(c, "show-storage", "data/0")
177
177
        c.Assert(err, jc.ErrorIsNil)
178
178
        c.Assert(testing.Stdout(context), gc.Matches, expected)
179
179
}
195
195
      storage-block/0:
196
196
        machine: "0"
197
197
`[1:]
198
 
        context, err := runJujuCommand(c, "storage", "show", "data/0")
 
198
        context, err := runJujuCommand(c, "show-storage", "data/0")
199
199
        c.Assert(err, jc.ErrorIsNil)
200
200
        c.Assert(testing.Stdout(context), gc.Matches, expected)
201
201
}
213
213
}
214
214
 
215
215
func runPoolList(c *gc.C, args ...string) (string, string, error) {
216
 
        cmdArgs := append([]string{"storage", "pool", "list"}, args...)
 
216
        cmdArgs := append([]string{"list-storage-pools"}, args...)
217
217
        ctx, err := runJujuCommand(c, cmdArgs...)
218
218
        stdout, stderr := "", ""
219
219
        if ctx != nil {
224
224
}
225
225
 
226
226
func (s *cmdStorageSuite) TestListPools(c *gc.C) {
227
 
        stdout, _, err := runPoolList(c)
 
227
        stdout, _, err := runPoolList(c, "--format", "yaml")
228
228
        c.Assert(err, jc.ErrorIsNil)
229
229
        expected := `
230
230
block:
244
244
}
245
245
 
246
246
func (s *cmdStorageSuite) TestListPoolsTabular(c *gc.C) {
247
 
        stdout, _, err := runPoolList(c, "--format", "tabular")
 
247
        stdout, _, err := runPoolList(c)
248
248
        c.Assert(err, jc.ErrorIsNil)
249
249
        expected := `
250
250
NAME    PROVIDER  ATTRS
259
259
}
260
260
 
261
261
func (s *cmdStorageSuite) TestListPoolsName(c *gc.C) {
262
 
        stdout, _, err := runPoolList(c, "--name", "block")
 
262
        stdout, _, err := runPoolList(c, "--format", "yaml", "--name", "block")
263
263
        c.Assert(err, jc.ErrorIsNil)
264
264
        expected := `
265
265
block:
284
284
}
285
285
 
286
286
func (s *cmdStorageSuite) TestListPoolsProvider(c *gc.C) {
287
 
        stdout, _, err := runPoolList(c, "--provider", "loop")
 
287
        stdout, _, err := runPoolList(c, "--format", "yaml", "--provider", "loop")
288
288
        c.Assert(err, jc.ErrorIsNil)
289
289
        expected := `
290
290
block:
305
305
 
306
306
func (s *cmdStorageSuite) TestListPoolsProviderNoMatch(c *gc.C) {
307
307
        s.registerTmpProviderType(c)
308
 
        stdout, _, err := runPoolList(c, "--provider", string(provider.TmpfsProviderType))
 
308
        stdout, _, err := runPoolList(c, "--format", "yaml", "--provider", string(provider.TmpfsProviderType))
309
309
        c.Assert(err, jc.ErrorIsNil)
310
310
        expected := `
311
311
tmpfs:
321
321
}
322
322
 
323
323
func (s *cmdStorageSuite) TestListPoolsNameAndProvider(c *gc.C) {
324
 
        stdout, _, err := runPoolList(c, "--name", "block", "--provider", "loop")
 
324
        stdout, _, err := runPoolList(c, "--format", "yaml", "--name", "block", "--provider", "loop")
325
325
        c.Assert(err, jc.ErrorIsNil)
326
326
        expected := `
327
327
block:
355
355
}
356
356
 
357
357
func runPoolCreate(c *gc.C, args ...string) (string, string, error) {
358
 
        cmdArgs := append([]string{"storage", "pool", "create"}, args...)
 
358
        cmdArgs := append([]string{"create-storage-pool"}, args...)
359
359
        ctx, err := runJujuCommand(c, cmdArgs...)
360
360
        stdout, stderr := "", ""
361
361
        if ctx != nil {
430
430
}
431
431
 
432
432
func runVolumeList(c *gc.C, args ...string) (string, string, error) {
433
 
        cmdArgs := append([]string{"storage", "volume", "list"}, args...)
 
433
        cmdArgs := append([]string{"list-storage", "--volume"}, args...)
434
434
        ctx, err := runJujuCommand(c, cmdArgs...)
435
435
        return testing.Stdout(ctx), testing.Stderr(ctx), err
436
436
}
454
454
}
455
455
 
456
456
func runAddToUnit(c *gc.C, args ...string) *cmd.Context {
457
 
        cmdArgs := append([]string{"storage", "add"}, args...)
 
457
        cmdArgs := append([]string{"add-storage"}, args...)
458
458
        context, err := runJujuCommand(c, cmdArgs...)
459
459
        c.Assert(err, jc.ErrorIsNil)
460
460
        return context
530
530
        c.Assert(err, jc.ErrorIsNil)
531
531
        c.Assert(volumesAfter, gc.HasLen, 2)
532
532
 
533
 
        context, err = runJujuCommand(c, "storage", "list")
 
533
        context, err = runJujuCommand(c, "list-storage")
534
534
        c.Assert(err, jc.ErrorIsNil)
535
535
        c.Assert(testing.Stdout(context), gc.Equals, `
536
536
[Storage]