Skip to content

Commit

Permalink
Ensure amd test cases only run with docker driver on amd64
Browse files Browse the repository at this point in the history
  • Loading branch information
fbyrne committed Oct 10, 2024
1 parent 47beb87 commit 6e27c5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/integration/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ func TestAddons(t *testing.T) {
// so we override that here to let minikube auto-detect appropriate cgroup driver
os.Setenv(constants.MinikubeForceSystemdEnv, "")

args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget", "--addons=nvidia-device-plugin", "--addons=yakd", "--addons=volcano", "--addons=amd-gpu-device-plugin"}, StartArgs()...)
args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget", "--addons=nvidia-device-plugin", "--addons=yakd", "--addons=volcano"}, StartArgs()...)
if !NoneDriver() {
args = append(args, "--addons=ingress", "--addons=ingress-dns", "--addons=storage-provisioner-rancher")
}
if DockerDriver() && amd64Platform() {
args = append(args, "--addons=amd-gpu-device-plugin")
}
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if err != nil {
t.Fatalf("%s failed: %v", rr.Command(), err)
Expand All @@ -115,12 +118,13 @@ func TestAddons(t *testing.T) {
t.Fatalf("Failed setup for addon tests")
}

type TestCase = struct {
name string
validator validateFunc
}
// Run tests in serial to avoid collision
t.Run("serial", func(t *testing.T) {
tests := []struct {
name string
validator validateFunc
}{
tests := []TestCase{
{"Volcano", validateVolcanoAddon},
{"GCPAuth", validateGCPAuthAddon},
}
Expand All @@ -137,10 +141,7 @@ func TestAddons(t *testing.T) {

// Parallelized tests
t.Run("parallel", func(t *testing.T) {
tests := []struct {
name string
validator validateFunc
}{
tests := []TestCase{
{"Registry", validateRegistryAddon},
{"Ingress", validateIngressAddon},
{"InspektorGadget", validateInspektorGadgetAddon},
Expand All @@ -152,8 +153,11 @@ func TestAddons(t *testing.T) {
{"LocalPath", validateLocalPathAddon},
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
{"Yakd", validateYakdAddon},
{"AmdGpuDevicePlugin", validateAmdGpuDevicePlugin},
}
if DockerDriver() && amd64Platform() {
tests = append(tests, TestCase{"AmdGpuDevicePlugin", validateAmdGpuDevicePlugin})
}

for _, tc := range tests {
tc := tc
if ctx.Err() == context.DeadlineExceeded {
Expand Down
5 changes: 5 additions & 0 deletions test/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ func arm64Platform() bool {
return runtime.GOARCH == "arm64"
}

// amd64Platform returns true if running on amd64/* platform
func amd64Platform() bool {
return runtime.GOARCH == "amd64"
}

// NeedsPortForward returns access to endpoints with this driver needs port forwarding
// (Docker on non-Linux platforms and rootless KIC requires ports to be forwarded to 127.0.0.1)
func NeedsPortForward() bool {
Expand Down

0 comments on commit 6e27c5e

Please sign in to comment.