summaryrefslogtreecommitdiff
path: root/integration/system
diff options
context:
space:
mode:
authorSebastiaan van Stijn <thaJeztah@users.noreply.github.com>2022-08-18 20:14:47 +0200
committerGitHub <noreply@github.com>2022-08-18 20:14:47 +0200
commita4ac991d02868cc68ee0cf3b912baa3d51af96ee (patch)
tree7682a1affab8b2dc8683c50d0915787d53d953fb /integration/system
parent5675d3a8fefb1ee646858bcc80a6bbb376486de3 (diff)
parent7b153b9e28b53779215de209736310f9266b3f2f (diff)
downloaddocker-a4ac991d02868cc68ee0cf3b912baa3d51af96ee.tar.gz
Merge pull request #43657 from thaJeztah/default_builder_version
api: set default "Builder-Version" to "2" (BuildKit) on Linux
Diffstat (limited to 'integration/system')
-rw-r--r--integration/system/ping_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/integration/system/ping_test.go b/integration/system/ping_test.go
index 6de5f535f1..239049e094 100644
--- a/integration/system/ping_test.go
+++ b/integration/system/ping_test.go
@@ -3,9 +3,13 @@ package system // import "github.com/docker/docker/integration/system"
import (
"context"
"net/http"
+ "os"
+ "path/filepath"
+ "runtime"
"strings"
"testing"
+ "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/testutil/daemon"
@@ -93,6 +97,44 @@ func TestPingSwarmHeader(t *testing.T) {
})
}
+func TestPingBuilderHeader(t *testing.T) {
+ skip.If(t, testEnv.IsRemoteDaemon)
+ skip.If(t, testEnv.DaemonInfo.OSType == "windows", "cannot spin up additional daemons on windows")
+
+ defer setupTest(t)()
+ d := daemon.New(t)
+ client := d.NewClientT(t)
+ defer client.Close()
+ ctx := context.TODO()
+
+ t.Run("default config", func(t *testing.T) {
+ d.Start(t)
+ defer d.Stop(t)
+
+ var expected = types.BuilderBuildKit
+ if runtime.GOOS == "windows" {
+ expected = types.BuilderV1
+ }
+
+ p, err := client.Ping(ctx)
+ assert.NilError(t, err)
+ assert.Equal(t, p.BuilderVersion, expected)
+ })
+
+ t.Run("buildkit disabled", func(t *testing.T) {
+ cfg := filepath.Join(d.RootDir(), "daemon.json")
+ err := os.WriteFile(cfg, []byte(`{"features": { "buildkit": false }}`), 0644)
+ assert.NilError(t, err)
+ d.Start(t, "--config-file", cfg)
+ defer d.Stop(t)
+
+ var expected = types.BuilderV1
+ p, err := client.Ping(ctx)
+ assert.NilError(t, err)
+ assert.Equal(t, p.BuilderVersion, expected)
+ })
+}
+
func hdr(res *http.Response, name string) string {
val, ok := res.Header[http.CanonicalHeaderKey(name)]
if !ok || len(val) == 0 {