The daemon may already have other volumes, so filter out those
when running the test.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 566eea13e638521e0f05fe7735f7d3a9130da0a9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -40,12 +40,20 @@ func TestVolumesCreateAndList(t *testing.T) {
|
| 40 | 40 |
} |
| 41 | 41 |
assert.Check(t, is.DeepEqual(vol, expected, cmpopts.EquateEmpty())) |
| 42 | 42 |
|
| 43 |
- volumes, err := client.VolumeList(ctx, filters.Args{})
|
|
| 43 |
+ volList, err := client.VolumeList(ctx, filters.Args{})
|
|
| 44 | 44 |
assert.NilError(t, err) |
| 45 |
+ assert.Assert(t, len(volList.Volumes) > 0) |
|
| 45 | 46 |
|
| 46 |
- assert.Check(t, is.Equal(len(volumes.Volumes), 1)) |
|
| 47 |
- assert.Check(t, volumes.Volumes[0] != nil) |
|
| 48 |
- assert.Check(t, is.DeepEqual(*volumes.Volumes[0], expected, cmpopts.EquateEmpty())) |
|
| 47 |
+ volumes := volList.Volumes[:0] |
|
| 48 |
+ for _, v := range volList.Volumes {
|
|
| 49 |
+ if v.Name == vol.Name {
|
|
| 50 |
+ volumes = append(volumes, v) |
|
| 51 |
+ } |
|
| 52 |
+ } |
|
| 53 |
+ |
|
| 54 |
+ assert.Check(t, is.Equal(len(volumes), 1)) |
|
| 55 |
+ assert.Check(t, volumes[0] != nil) |
|
| 56 |
+ assert.Check(t, is.DeepEqual(*volumes[0], expected, cmpopts.EquateEmpty())) |
|
| 49 | 57 |
} |
| 50 | 58 |
|
| 51 | 59 |
func TestVolumesRemove(t *testing.T) {
|