Skip to content

Commit

Permalink
testing: Fix volcano addon failing other addons
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Jul 17, 2024
1 parent 0083044 commit 5526688
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions test/integration/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,52 +118,52 @@ func TestAddons(t *testing.T) {
t.Fatalf("Failed setup for addon tests")
}

// Parallelized tests
t.Run("parallel", func(t *testing.T) {
// Run tests in serial to avoid collision
t.Run("serial", func(t *testing.T) {
tests := []struct {
name string
validator validateFunc
}{
{"Registry", validateRegistryAddon},
{"Ingress", validateIngressAddon},
{"InspektorGadget", validateInspektorGadgetAddon},
{"MetricsServer", validateMetricsServerAddon},
{"HelmTiller", validateHelmTillerAddon},
{"Olm", validateOlmAddon},
{"CSI", validateCSIDriverAndSnapshots},
{"Headlamp", validateHeadlampAddon},
{"CloudSpanner", validateCloudSpannerAddon},
{"LocalPath", validateLocalPathAddon},
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
{"Yakd", validateYakdAddon},
{"Volcano", validateVolcanoAddon},
{"GCPAuth", validateGCPAuthAddon},
}
for _, tc := range tests {
tc := tc
if ctx.Err() == context.DeadlineExceeded {
t.Fatalf("Unable to run more tests (deadline exceeded)")
}
t.Run(tc.name, func(t *testing.T) {
MaybeParallel(t)
tc.validator(ctx, t, profile)
})
}
})

// Run other tests after to avoid collision
t.Run("serial", func(t *testing.T) {
// Parallelized tests
t.Run("parallel", func(t *testing.T) {
tests := []struct {
name string
validator validateFunc
}{
{"GCPAuth", validateGCPAuthAddon},
{"Registry", validateRegistryAddon},
{"Ingress", validateIngressAddon},
{"InspektorGadget", validateInspektorGadgetAddon},
{"MetricsServer", validateMetricsServerAddon},
{"HelmTiller", validateHelmTillerAddon},
{"Olm", validateOlmAddon},
{"CSI", validateCSIDriverAndSnapshots},
{"Headlamp", validateHeadlampAddon},
{"CloudSpanner", validateCloudSpannerAddon},
{"LocalPath", validateLocalPathAddon},
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
{"Yakd", validateYakdAddon},
}
for _, tc := range tests {
tc := tc
if ctx.Err() == context.DeadlineExceeded {
t.Fatalf("Unable to run more tests (deadline exceeded)")
}
t.Run(tc.name, func(t *testing.T) {
MaybeParallel(t)
tc.validator(ctx, t, profile)
})
}
Expand Down Expand Up @@ -545,6 +545,10 @@ func validateOlmAddon(ctx context.Context, t *testing.T, profile string) {
if err := retry.Expo(checkOperatorInstalled, time.Second*3, Minutes(10)); err != nil {
t.Errorf("failed checking operator installed: %v", err.Error())
}

if rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "disable", "olm", "--alsologtostderr", "-v=1")); err != nil {
t.Errorf("failed to disable olm addon: args %q: %v", rr.Command(), err)
}
}

// validateCSIDriverAndSnapshots tests the csi hostpath driver by creating a persistent volume, snapshotting it and restoring it.
Expand Down Expand Up @@ -831,6 +835,10 @@ func validateHeadlampAddon(ctx context.Context, t *testing.T, profile string) {
if _, err := PodWait(ctx, t, profile, "headlamp", "app.kubernetes.io/name=headlamp", Minutes(8)); err != nil {
t.Fatalf("failed waiting for headlamp pod: %v", err)
}

if rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "disable", "headlamp", "--alsologtostderr", "-v=1")); err != nil {
t.Errorf("failed to disable headlamp addon: args %q: %v", rr.Command(), err)
}
}

// validateInspektorGadgetAddon tests the inspektor-gadget addon by ensuring the pod has come up and addon disables
Expand Down Expand Up @@ -1064,4 +1072,8 @@ func validateYakdAddon(ctx context.Context, t *testing.T, profile string) {
if _, err := PodWait(ctx, t, profile, "yakd-dashboard", "app.kubernetes.io/name=yakd-dashboard", Minutes(2)); err != nil {
t.Fatalf("failed waiting for YAKD - Kubernetes Dashboard pod: %v", err)
}

if rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "disable", "yakd", "--alsologtostderr", "-v=1")); err != nil {
t.Errorf("failed to disable yakd addon: args %q: %v", rr.Command(), err)
}
}

0 comments on commit 5526688

Please sign in to comment.