Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions test/extended/router/gatewayapicontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat

// skip non clould platforms since gateway needs LB service
skipGatewayIfNonCloudPlatform(oc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should skip everything right? If don't skip everything, we run the non-skipped tests here and in gatewayapiwitholm.go for tech preview jobs.

Suggested change
skipGatewayIfNonCloudPlatform(oc)
skipGatewayIfNonCloudPlatform(oc)
skipIfNoOLMFeatureGateEnabled(oc)


// GatewayAPIController relies on OSSM OLM operator.
// Skipping on clusters which don't have capabilities required
// to install an OLM operator.
Expand Down Expand Up @@ -194,6 +193,7 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
})

g.It("Ensure OSSM and OLM related resources are created after creating GatewayClass", func() {
skipIfNoOLMFeatureGateEnabled(oc)
defer markTestDone(oc, ossmAndOLMResourcesCreated)

//check the catalogSource
Expand Down Expand Up @@ -237,7 +237,6 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
return true, nil
})
o.Expect(waitCSVErr).NotTo(o.HaveOccurred(), "Cluster Service Version %s never reached succeeded status", csvName)

// get OSSM Operator deployment
waitErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 20*time.Minute, false, func(context context.Context) (bool, error) {
deployOSSM, err := oc.AdminKubeClient().AppsV1().Deployments(expectedSubscriptionNamespace).Get(context, "servicemesh-operator3", metav1.GetOptions{})
Expand Down Expand Up @@ -267,6 +266,7 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
})

g.It("Ensure custom gatewayclass can be accepted", func() {
skipIfNoOLMFeatureGateEnabled(oc)
defer markTestDone(oc, customGatewayclassAccepted)

customGatewayClassName := "custom-gatewayclass"
Expand Down Expand Up @@ -353,6 +353,7 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
})

g.It("Ensure GIE is enabled after creating an inferencePool CRD", func() {
skipIfNoOLMFeatureGateEnabled(oc)
defer markTestDone(oc, gieEnabled)

errCheck := checkGatewayClass(oc, gatewayClassName)
Expand Down Expand Up @@ -399,6 +400,7 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
})

g.It("Ensure istiod deployment and the istio could be deleted and then get recreated [Serial]", func() {
skipIfNoOLMFeatureGateEnabled(oc)
// delete the istiod deployment and then checked if it is restored
g.By(fmt.Sprintf("Try to delete the istiod deployment in %s namespace", ingressNamespace))
pollWaitDeploymentReady(oc, ingressNamespace, istiodDeployment)
Expand Down Expand Up @@ -483,6 +485,14 @@ func skipGatewayIfNonCloudPlatform(oc *exutil.CLI) {
}
}

func skipIfNoOLMFeatureGateEnabled(oc *exutil.CLI) {
featuregate, err := oc.AsAdmin().Run("get").Args("featuregate", "cluster", "-o=jsonpath='{.status.featureGates[*].enabled[*].name}'").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(featuregate, "GatewayAPIWithoutOLM") {
g.Skip("Skip test since it requires OLM resources")
}
}
Comment on lines +488 to +494
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit better to use structured API client rather than raw OC command:

Suggested change
func skipIfNoOLMFeatureGateEnabled(oc *exutil.CLI) {
featuregate, err := oc.AsAdmin().Run("get").Args("featuregate", "cluster", "-o=jsonpath='{.status.featureGates[*].enabled[*].name}'").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(featuregate, "GatewayAPIWithoutOLM") {
g.Skip("Skip test since it requires OLM resources")
}
}
func skipIfNoOLMFeatureGateEnabled(oc *exutil.CLI) {
fgs, err := oc.AdminConfigClient().ConfigV1().FeatureGates().Get(context.TODO(), "cluster", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred(), "Error getting cluster FeatureGates.")
// Skip if the GatewayAPIWithoutOLM feature gate is enabled
for _, fg := range fgs.Status.FeatureGates {
for _, enabledFG := range fg.Enabled {
if enabledFG.Name == "GatewayAPIWithoutOLM" {
g.Skip("Skip test since it requires OLM resources")
}
}
}
}


func waitForIstioHealthy(oc *exutil.CLI) {
timeout := 20 * time.Minute
err := wait.PollUntilContextTimeout(context.Background(), 10*time.Second, timeout, false, func(context context.Context) (bool, error) {
Expand Down
Loading