diff --git a/acceptance/detector_test.go b/acceptance/detector_test.go index c17fa2aa8..375652b05 100644 --- a/acceptance/detector_test.go +++ b/acceptance/detector_test.go @@ -449,7 +449,7 @@ fail: fail_detect_buildpack@some_version` detectImage, h.WithFlags("--user", userID, "--env", "CNB_ORDER_PATH=/cnb/orders/middle_order.toml", - "--env", "CNB_SYSTEM_PATH=/cnb/system.toml", + "--env", "CNB_SYSTEM_PATH=/cnb/test-data/system.toml", "--env", "CNB_PLATFORM_API="+platformAPI, ), h.WithArgs("-log-level=debug"), @@ -475,13 +475,16 @@ fail: fail_detect_buildpack@some_version` h.AssertEq(t, group.Group[2].Version, "simple_buildpack_version") // check output contains all buildpacks - h.AssertStringContains(t, output, "always_detect_buildpack always_detect_buildpack_version") - h.AssertStringContains(t, output, "buildpack_for_ext buildpack_for_ext_version") - h.AssertStringContains(t, output, "simple_buildpack simple_buildpack_version") + h.AssertStringContains(t, output, "always_detect_buildpack") + h.AssertStringContains(t, output, "always_detect_buildpack_version") + h.AssertStringContains(t, output, "buildpack_for_ext") + h.AssertStringContains(t, output, "buildpack_for_ext_version") + h.AssertStringContains(t, output, "simple_buildpack") + h.AssertStringContains(t, output, "simple_buildpack_version") // check debug logs show system buildpack merging - h.AssertStringContains(t, output, "Prepending 1 system buildpack(s) to order") - h.AssertStringContains(t, output, "Appending 1 system buildpack(s) to order") + h.AssertStringContains(t, output, "Prepending 1 system buildpack(s) to group") + h.AssertStringContains(t, output, "Appending 1 system buildpack(s) to group") }) }) }) diff --git a/acceptance/testdata/detector/container/cnb/buildpacks/always_detect_buildpack/always_detect_buildpack_version/bin/detect b/acceptance/testdata/detector/container/cnb/buildpacks/always_detect_buildpack/always_detect_buildpack_version/bin/detect new file mode 100755 index 000000000..f15cae860 --- /dev/null +++ b/acceptance/testdata/detector/container/cnb/buildpacks/always_detect_buildpack/always_detect_buildpack_version/bin/detect @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +## always detect + +platform_path=$1 +plan_path=$2 + +echo "ENV" +env + +echo "platform_path: $platform_path" +echo "app_dir: $(pwd)" + +cat >> "${plan_path}" <= 0.15 (returns empty by default) + if api.Platform.Latest().AtLeast("0.15") { + configHandler.EXPECT().ReadSystem(gomock.Any(), gomock.Any()).Return(files.System{}, nil).AnyTimes() + } }) it.After(func() { @@ -99,6 +104,8 @@ func testDetector(t *testing.T, when spec.G, it spec.S) { when("Platform API >= 0.15", func() { it("reads and merges system buildpacks", func() { + configHandler = testmock.NewMockConfigHandler(mockController) + detectorFactory015 := phase.NewHermeticFactory( api.MustParse("0.15"), apiVerifier, @@ -121,6 +128,7 @@ func testDetector(t *testing.T, when spec.G, it spec.S) { }, }, } + configHandler.EXPECT().ReadAnalyzed("some-analyzed-path", gomock.Any()).Return(files.Analyzed{}, nil) configHandler.EXPECT().ReadOrder("some-order-path").Return(order, nil, nil) configHandler.EXPECT().ReadSystem("some-system-path", gomock.Any()).Return(system, nil) diff --git a/priv/docker.go b/priv/docker.go index 7e1dbee00..63bdcc102 100644 --- a/priv/docker.go +++ b/priv/docker.go @@ -33,7 +33,7 @@ func DockerClient() (*client.Client, error) { } opts = append(opts, opt) } - return client.NewClientWithOpts(opts...) + return client.New(opts...) } type unclosableConn struct { diff --git a/testhelpers/docker.go b/testhelpers/docker.go index 656b052ea..a98b6090c 100644 --- a/testhelpers/docker.go +++ b/testhelpers/docker.go @@ -29,7 +29,7 @@ var ( func DockerCli(t *testing.T) dockercli.APIClient { dockerCliOnce.Do(func() { var dockerCliErr error - dockerCliVal, dockerCliErr = dockercli.NewClientWithOpts(dockercli.FromEnv, dockercli.WithVersion("1.38")) + dockerCliVal, dockerCliErr = dockercli.New(dockercli.FromEnv) AssertNil(t, dockerCliErr) }) return dockerCliVal diff --git a/tools/image/main.go b/tools/image/main.go index 61f8f4bab..40a9ad73d 100644 --- a/tools/image/main.go +++ b/tools/image/main.go @@ -66,7 +66,7 @@ func main() { var img imgutil.Image if useDaemon { - dockerClient, err := dockercli.NewClientWithOpts(dockercli.FromEnv, dockercli.WithVersion("1.38")) + dockerClient, err := dockercli.New(dockercli.FromEnv) if err != nil { log.Fatal("Failed to initialize docker client:", err) }