forked from moby/buildkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: enabling integration tests on windows
Depends on moby#4994 Partial fix for moby#4485 Starting off with this one as a POC on the approach, before we proceed to complete the rest under `/frontend/dockerfile`. Tests covered so far: - [x] `/frontend/dockerfile: testEnvEmptyFormatting` - [x] `/frontend/dockerfile: testDockerignoreOverride` - [x] `/frontend/dockerfile: caseEmptyDestDir` Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
- Loading branch information
1 parent
eed17a4
commit ee99673
Showing
6 changed files
with
152 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package dockerfile | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/moby/buildkit/util/testutil/integration" | ||
) | ||
|
||
func runDockerfileReproTests(t *testing.T) { | ||
integration.Run(t, reproTests, append(opts, | ||
// Only use the amd64 digest, regardless to the host platform | ||
integration.WithMirroredImages(map[string]string{ | ||
"amd64/bullseye-20230109-slim:latest": "docker.io/amd64/debian:bullseye-20230109-slim@sha256:1acb06a0c31fb467eb8327ad361f1091ab265e0bf26d452dea45dcb0c0ea5e75", | ||
}), | ||
)...) | ||
} | ||
|
||
func runDockerfileSecurityTests(t *testing.T) { | ||
integration.Run(t, securityTests, append(append(opts, securityOpts...), | ||
integration.WithMatrix("security.insecure", map[string]interface{}{ | ||
"granted": securityInsecureGranted, | ||
"denied": securityInsecureDenied, | ||
}))...) | ||
} | ||
|
||
func runDockerfileNetworkTests(t *testing.T) { | ||
integration.Run(t, networkTests, append(opts, | ||
integration.WithMatrix("network.host", map[string]interface{}{ | ||
"granted": networkHostGranted, | ||
"denied": networkHostDenied, | ||
}))...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package dockerfile | ||
|
||
import "testing" | ||
|
||
func runDockerfileReproTests(t *testing.T) { | ||
t.Skip("ReproTests: skipped on Windows.") | ||
} | ||
|
||
func runDockerfileSecurityTests(t *testing.T) { | ||
t.Skip("SecurityTests: skipped on Windows") | ||
} | ||
|
||
func runDockerfileNetworkTests(t *testing.T) { | ||
t.Skip("SecurityTestsWithMatrix: skipped on Windows") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package integration | ||
|
||
import "runtime" | ||
|
||
var BusyboxImage = "busybox:latest" | ||
|
||
func officialImages(names ...string) map[string]string { | ||
ns := runtime.GOARCH | ||
if ns == "arm64" { | ||
ns = "arm64v8" | ||
} else if ns != "amd64" { | ||
ns = "library" | ||
} | ||
m := map[string]string{} | ||
for _, name := range names { | ||
ref := "docker.io/" + ns + "/" + name | ||
if pns, ok := pins[name]; ok { | ||
if dgst, ok := pns[ns]; ok { | ||
ref += "@" + dgst | ||
} | ||
} | ||
m["library/"+name] = ref | ||
} | ||
return m | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package integration | ||
|
||
var BusyboxImage = "registry.k8s.io/e2e-test-images/busybox:1.29-2" | ||
|
||
func officialImages(names ...string) map[string]string { | ||
// basic mapping for now since there are | ||
// very few official Windows-based images | ||
// TODO: still don't understand why I can't use busybox:latest | ||
// in the tests and I have to provide the full URI. | ||
m := map[string]string{ | ||
// "busybox:latest": "registry.k8s.io/e2e-test-images/busybox:1.29-2", | ||
// "busybox:wintools": "docker.io/wintools/busybox:latest", | ||
// "nanoserver": "mcr.microsoft.com/windows/nanoserver:ltsc2022", | ||
} | ||
return m | ||
} |