Skip to content

Commit

Permalink
Fix TestVolumesCreateAndList when running against a shared daemon
Browse files Browse the repository at this point in the history
The daemon may already have other volumes, so filter out those
when running the test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Apr 25, 2019
1 parent 2b5880c commit 566eea1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions integration/volume/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 566eea1

Please sign in to comment.