Fix TestVolumesCreateAndList when running against a shared daemon
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 566eea13e6
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e1b045c25e
commit
620d9d3c75
1 changed files with 12 additions and 4 deletions
|
@ -40,12 +40,20 @@ func TestVolumesCreateAndList(t *testing.T) {
|
|||
}
|
||||
assert.Check(t, is.DeepEqual(vol, expected, cmpopts.EquateEmpty()))
|
||||
|
||||
volumes, err := client.VolumeList(ctx, filters.Args{})
|
||||
volList, err := client.VolumeList(ctx, filters.Args{})
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, len(volList.Volumes) > 0)
|
||||
|
||||
assert.Check(t, is.Equal(len(volumes.Volumes), 1))
|
||||
assert.Check(t, volumes.Volumes[0] != nil)
|
||||
assert.Check(t, is.DeepEqual(*volumes.Volumes[0], expected, cmpopts.EquateEmpty()))
|
||||
volumes := volList.Volumes[:0]
|
||||
for _, v := range volList.Volumes {
|
||||
if v.Name == vol.Name {
|
||||
volumes = append(volumes, v)
|
||||
}
|
||||
}
|
||||
|
||||
assert.Check(t, is.Equal(len(volumes), 1))
|
||||
assert.Check(t, volumes[0] != nil)
|
||||
assert.Check(t, is.DeepEqual(*volumes[0], expected, cmpopts.EquateEmpty()))
|
||||
}
|
||||
|
||||
func TestVolumesRemove(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue