Skip to content

Commit

Permalink
Fix broken docker.VolumeList signature
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
  • Loading branch information
jkutner committed May 19, 2023
1 parent dc978b9 commit ef4cf9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
18 changes: 10 additions & 8 deletions internal/build/phase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"sync"
"testing"

"github.com/docker/docker/api/types/volume"

"github.com/buildpacks/imgutil/local"
"github.com/buildpacks/lifecycle/auth"
dcontainer "github.com/docker/docker/api/types/container"
Expand Down Expand Up @@ -366,10 +368,10 @@ func testPhase(t *testing.T, when spec.G, it spec.S) {
phase := phaseFactory.New(configProvider)
assertRunSucceeds(t, phase, &outBuf, &errBuf)
h.AssertContains(t, outBuf.String(), "binds test")
body, err := docker.VolumeList(context.TODO(), filters.NewArgs(filters.KeyValuePair{
body, err := docker.VolumeList(context.TODO(), volume.ListOptions{Filters: filters.NewArgs(filters.KeyValuePair{
Key: "name",
Value: "some-volume",
}))
})})
h.AssertNil(t, err)
h.AssertEq(t, len(body.Volumes), 1)
})
Expand Down Expand Up @@ -459,21 +461,21 @@ func testPhase(t *testing.T, when spec.G, it spec.S) {
})

it("should delete the layers volume", func() {
body, err := docker.VolumeList(context.TODO(),
filters.NewArgs(filters.KeyValuePair{
body, err := docker.VolumeList(context.TODO(), volume.ListOptions{
Filters: filters.NewArgs(filters.KeyValuePair{
Key: "name",
Value: lifecycleExec.LayersVolume(),
}))
})})
h.AssertNil(t, err)
h.AssertEq(t, len(body.Volumes), 0)
})

it("should delete the app volume", func() {
body, err := docker.VolumeList(context.TODO(),
filters.NewArgs(filters.KeyValuePair{
body, err := docker.VolumeList(context.TODO(), volume.ListOptions{
Filters: filters.NewArgs(filters.KeyValuePair{
Key: "name",
Value: lifecycleExec.AppVolume(),
}))
})})
h.AssertNil(t, err)
h.AssertEq(t, len(body.Volumes), 0)
})
Expand Down
10 changes: 6 additions & 4 deletions pkg/cache/volume_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,12 @@ func testCache(t *testing.T, when spec.G, it spec.S) {
err := subject.Clear(ctx)
h.AssertNil(t, err)

volumes, err := dockerClient.VolumeList(context.TODO(), filters.NewArgs(filters.KeyValuePair{
Key: "name",
Value: volumeName,
}))
volumes, err := dockerClient.VolumeList(context.TODO(), volume.ListOptions{
Filters: filters.NewArgs(filters.KeyValuePair{
Key: "name",
Value: volumeName,
}),
})
h.AssertNil(t, err)
h.AssertEq(t, len(volumes.Volumes), 0)
})
Expand Down

0 comments on commit ef4cf9e

Please sign in to comment.