Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
| ... | ... |
@@ -181,7 +181,6 @@ test_env() {
|
| 181 | 181 |
DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \ |
| 182 | 182 |
DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \ |
| 183 | 183 |
DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \ |
| 184 |
- DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \ |
|
| 185 | 184 |
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \ |
| 186 | 185 |
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \ |
| 187 | 186 |
DOCKER_HOST="$DOCKER_HOST" \ |
| ... | ... |
@@ -53,7 +53,6 @@ test_env() {
|
| 53 | 53 |
DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \ |
| 54 | 54 |
DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \ |
| 55 | 55 |
DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \ |
| 56 |
- DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \ |
|
| 57 | 56 |
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \ |
| 58 | 57 |
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \ |
| 59 | 58 |
DOCKER_HOST="$DOCKER_HOST" \ |
| ... | ... |
@@ -19,10 +19,6 @@ import ( |
| 19 | 19 |
"github.com/docker/docker/testutil/registry" |
| 20 | 20 |
) |
| 21 | 21 |
|
| 22 |
-func ArchitectureIsNot(arch string) bool {
|
|
| 23 |
- return os.Getenv("DOCKER_ENGINE_GOARCH") != arch
|
|
| 24 |
-} |
|
| 25 |
- |
|
| 26 | 22 |
func DaemonIsWindows() bool {
|
| 27 | 23 |
return testEnv.DaemonInfo.OSType == "windows" |
| 28 | 24 |
} |
| ... | ... |
@@ -50,15 +46,15 @@ func OnlyDefaultNetworks() bool {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
func IsAmd64() bool {
|
| 53 |
- return os.Getenv("DOCKER_ENGINE_GOARCH") == "amd64"
|
|
| 53 |
+ return testEnv.DaemonVersion.Arch == "amd64" |
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
func NotArm64() bool {
|
| 57 |
- return ArchitectureIsNot("arm64")
|
|
| 57 |
+ return testEnv.DaemonVersion.Arch != "arm64" |
|
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 | 60 |
func NotPpc64le() bool {
|
| 61 |
- return ArchitectureIsNot("ppc64le")
|
|
| 61 |
+ return testEnv.DaemonVersion.Arch != "ppc64le" |
|
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 | 64 |
func UnixCli() bool {
|
| ... | ... |
@@ -31,7 +31,7 @@ func TestRemoveImageGarbageCollector(t *testing.T) {
|
| 31 | 31 |
// This test uses very platform specific way to prevent |
| 32 | 32 |
// daemon for remove image layer. |
| 33 | 33 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 34 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 34 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 35 | 35 |
skip.If(t, testEnv.IsRootless, "rootless mode doesn't support overlay2 on most distros") |
| 36 | 36 |
|
| 37 | 37 |
// Create daemon with overlay2 graphdriver because vfs uses disk differently |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
"context" |
| 7 | 7 |
"fmt" |
| 8 | 8 |
"io" |
| 9 |
- "os" |
|
| 10 | 9 |
"strings" |
| 11 | 10 |
"testing" |
| 12 | 11 |
|
| ... | ... |
@@ -40,7 +39,7 @@ func setupTestV2(t *testing.T) func() {
|
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) {
|
| 43 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 43 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 44 | 44 |
defer setupTestV2(t)() |
| 45 | 45 |
|
| 46 | 46 |
c := d.NewClientT(t) |
| ... | ... |
@@ -62,7 +61,7 @@ func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) {
|
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 | 64 |
func TestAuthZPluginV2Disable(t *testing.T) {
|
| 65 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 65 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 66 | 66 |
defer setupTestV2(t)() |
| 67 | 67 |
|
| 68 | 68 |
c := d.NewClientT(t) |
| ... | ... |
@@ -88,7 +87,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
|
| 91 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 91 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 92 | 92 |
defer setupTestV2(t)() |
| 93 | 93 |
|
| 94 | 94 |
c := d.NewClientT(t) |
| ... | ... |
@@ -123,7 +122,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
|
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
func TestAuthZPluginV2BadManifestFailsDaemonStart(t *testing.T) {
|
| 126 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 126 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 127 | 127 |
defer setupTestV2(t)() |
| 128 | 128 |
|
| 129 | 129 |
c := d.NewClientT(t) |
| ... | ... |
@@ -409,7 +409,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
|
| 409 | 409 |
skip.If(t, runtime.GOOS == "windows") |
| 410 | 410 |
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
| 411 | 411 |
skip.If(t, !requirement.HasHubConnectivity(t)) |
| 412 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 412 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 413 | 413 |
skip.If(t, !requirement.Overlay2Supported(testEnv.DaemonInfo.KernelVersion)) |
| 414 | 414 |
|
| 415 | 415 |
d := daemon.New(t, daemon.WithExperimental()) |
| ... | ... |
@@ -3,7 +3,6 @@ package service |
| 3 | 3 |
import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"io" |
| 6 |
- "os" |
|
| 7 | 6 |
"path" |
| 8 | 7 |
"strings" |
| 9 | 8 |
"testing" |
| ... | ... |
@@ -24,7 +23,7 @@ import ( |
| 24 | 24 |
func TestServicePlugin(t *testing.T) {
|
| 25 | 25 |
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
| 26 | 26 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows") |
| 27 |
- skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
|
| 27 |
+ skip.If(t, testEnv.NotAmd64) |
|
| 28 | 28 |
defer setupTest(t)() |
| 29 | 29 |
|
| 30 | 30 |
reg := registry.NewV2(t) |
| ... | ... |
@@ -22,6 +22,7 @@ import ( |
| 22 | 22 |
type Execution struct {
|
| 23 | 23 |
client client.APIClient |
| 24 | 24 |
DaemonInfo system.Info |
| 25 |
+ DaemonVersion types.Version |
|
| 25 | 26 |
PlatformDefaults PlatformDefaults |
| 26 | 27 |
protectedElements protectedElements |
| 27 | 28 |
} |
| ... | ... |
@@ -49,10 +50,15 @@ func FromClient(c *client.Client) (*Execution, error) {
|
| 49 | 49 |
if err != nil {
|
| 50 | 50 |
return nil, errors.Wrapf(err, "failed to get info from daemon") |
| 51 | 51 |
} |
| 52 |
+ v, err := c.ServerVersion(context.Background()) |
|
| 53 |
+ if err != nil {
|
|
| 54 |
+ return nil, errors.Wrapf(err, "failed to get version info from daemon") |
|
| 55 |
+ } |
|
| 52 | 56 |
|
| 53 | 57 |
return &Execution{
|
| 54 | 58 |
client: c, |
| 55 | 59 |
DaemonInfo: info, |
| 60 |
+ DaemonVersion: v, |
|
| 56 | 61 |
PlatformDefaults: getPlatformDefaults(info), |
| 57 | 62 |
protectedElements: newProtectedElements(), |
| 58 | 63 |
}, nil |
| ... | ... |
@@ -220,3 +226,8 @@ func EnsureFrozenImagesLinux(testEnv *Execution) error {
|
| 220 | 220 |
func (e *Execution) GitHubActions() bool {
|
| 221 | 221 |
return os.Getenv("GITHUB_ACTIONS") != ""
|
| 222 | 222 |
} |
| 223 |
+ |
|
| 224 |
+// NotAmd64 returns true if the daemon's architecture is not amd64 |
|
| 225 |
+func (e *Execution) NotAmd64() bool {
|
|
| 226 |
+ return e.DaemonVersion.Arch != "amd64" |
|
| 227 |
+} |