mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
client: VolumeListResult: define local type
The `VolumeListResult.Items` field was a `volume.ListResponse`, which in itself also had two slices (for volumes, and warnings). The Volumes field contained a slice of pointers to Volumes. This patch: - Re-defines `ImageRemoveResult` as a distinct type, containing the content of the `volume.ListResponse.Volumes` and `.Warnings`. - The `VolumeListResult` doesn't use a pointer for the volumes to make it slightly easier to deal with (possibly the API type could be changed as well, which could allow us to simplify the client code. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -130,7 +130,7 @@ func deleteAllVolumes(ctx context.Context, t testing.TB, c client.VolumeAPIClien
|
||||
res, err := c.VolumeList(ctx, client.VolumeListOptions{})
|
||||
assert.Check(t, err, "failed to list volumes")
|
||||
|
||||
for _, v := range res.Items.Volumes {
|
||||
for _, v := range res.Items {
|
||||
if _, ok := protectedVolumes[v.Name]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ func getExistingVolumes(ctx context.Context, t testing.TB, testEnv *Execution) [
|
||||
assert.NilError(t, err, "failed to list volumes")
|
||||
|
||||
var volumes []string
|
||||
for _, vol := range res.Items.Volumes {
|
||||
for _, vol := range res.Items {
|
||||
volumes = append(volumes, vol.Name)
|
||||
}
|
||||
return volumes
|
||||
|
||||
Reference in New Issue
Block a user