mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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>
This commit is contained in:
parent
2b5880c2eb
commit
566eea13e6
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…
Add table
Reference in a new issue