Skip to content

Commit d009a74

Browse files
committed
Skip webhook test on unsupported platforms
1 parent 7047cdf commit d009a74

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"
@@ -386,6 +387,19 @@ var _ = Describe("Managed cluster should", framework.LabelMachines, func() {
386387
// Machines required for test: 0
387388
// Reason: The machineSet creation is rejected by the webhook.
388389
It("reject invalid machinesets", func() {
390+
client, err := framework.LoadClient()
391+
Expect(err).ToNot(HaveOccurred(), "Controller-runtime client should be able to be created")
392+
// Only run on platforms that have webhooks
393+
clusterInfra, err := framework.GetInfrastructure(ctx, client)
394+
Expect(err).NotTo(HaveOccurred(), "Should be able to get Infrastructure")
395+
platform := clusterInfra.Status.PlatformStatus.Type
396+
switch platform {
397+
case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.GCPPlatformType, configv1.VSpherePlatformType, configv1.PowerVSPlatformType, configv1.NutanixPlatformType:
398+
// Do Nothing
399+
default:
400+
Skip(fmt.Sprintf("Platform %s does not have webhooks, skipping.", platform))
401+
}
402+
389403
By("Creating invalid machineset")
390404
invalidMachineSet := invalidMachinesetWithEmptyProviderConfig()
391405
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)