Skip to content

Commit 601332b

Browse files
committed
Skip webhook test on unsupported platforms
1 parent 96371da commit 601332b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/infra/infra.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
. "github.com/onsi/ginkgo/v2"
99
. "github.com/onsi/gomega"
1010

11+
configv1 "github.com/openshift/api/config/v1"
1112
machinev1 "github.com/openshift/api/machine/v1beta1"
1213
corev1 "k8s.io/api/core/v1"
1314
policyv1 "k8s.io/api/policy/v1"
@@ -383,6 +384,19 @@ var _ = Describe("Managed cluster should", framework.LabelMachines, func() {
383384
// Machines required for test: 0
384385
// Reason: The machineSet creation is rejected by the webhook.
385386
It("reject invalid machinesets", func() {
387+
client, err := framework.LoadClient()
388+
Expect(err).ToNot(HaveOccurred(), "Controller-runtime client should be able to be created")
389+
// Only run on platforms that have webhooks
390+
clusterInfra, err := framework.GetInfrastructure(ctx, client)
391+
Expect(err).NotTo(HaveOccurred(), "Should be able to get Infrastructure")
392+
platform := clusterInfra.Status.PlatformStatus.Type
393+
switch platform {
394+
case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.GCPPlatformType, configv1.VSpherePlatformType, configv1.PowerVSPlatformType, configv1.NutanixPlatformType:
395+
// Do Nothing
396+
default:
397+
Skip(fmt.Sprintf("Platform %s does not have webhooks, skipping.", platform))
398+
}
399+
386400
By("Creating invalid machineset")
387401
invalidMachineSet := invalidMachinesetWithEmptyProviderConfig()
388402
expectedAdmissionWebhookErr := "admission webhook \"default.machineset.machine.openshift.io\" denied the request: providerSpec.value: Required value: a value must be provided"

0 commit comments

Comments
 (0)