Skip to content

Commit 694a8fa

Browse files
Add comprehensive E2E tests for Gateway with OpenShift OAuth authentication
Signed-off-by: Gowtham Shanmugasundaram <[email protected]>
1 parent dd7e7bd commit 694a8fa

File tree

4 files changed

+574
-73
lines changed

4 files changed

+574
-73
lines changed

tests/e2e/components_test.go

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"strings"
55
"testing"
66

7-
gTypes "github.com/onsi/gomega/types"
87
operatorv1 "github.com/openshift/api/operator/v1"
98
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
109
k8slabels "k8s.io/apimachinery/pkg/labels"
@@ -251,50 +250,8 @@ func (tc *ComponentTestCtx) UpdateComponentStateInDataScienceCluster(state opera
251250

252251
// UpdateComponentStateInDataScienceClusterWithKind updates the management state of a specified component kind in the DataScienceCluster.
253252
func (tc *ComponentTestCtx) UpdateComponentStateInDataScienceClusterWithKind(state operatorv1.ManagementState, kind string) {
254-
componentName := strings.ToLower(kind)
255-
256-
// Map DataSciencePipelines to aipipelines for v2 API
257-
componentFieldName := componentName
258-
conditionKind := kind
259-
if kind == dataSciencePipelinesKind {
260-
componentFieldName = aiPipelinesFieldName
261-
conditionKind = "AIPipelines"
262-
}
263-
264-
readyCondition := metav1.ConditionFalse
265-
if state == operatorv1.Managed {
266-
readyCondition = metav1.ConditionTrue
267-
}
268-
269-
// Define common conditions to match.
270-
conditions := []gTypes.GomegaMatcher{
271-
// Validate that the component's management state is updated correctly
272-
jq.Match(`.spec.components.%s.managementState == "%s"`, componentFieldName, state),
273-
274-
// Validate the "Ready" condition for the component
275-
jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, conditionKind, readyCondition),
276-
}
277-
278-
// TODO: Commented out because this check does not work with parallel component tests.
279-
// Verify it is still needed, otherwise remove it. A new test only for those conditions is added in resilience tests.
280-
//
281-
// If the state is "Managed", add additional checks for provisioning and components readiness.
282-
// if state == operatorv1.Managed {
283-
// conditions = append(conditions,
284-
// // Validate the "ProvisioningSucceeded" condition
285-
// jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, status.ConditionTypeProvisioningSucceeded, readyCondition),
286-
287-
// // Validate the "ComponentsReady" condition
288-
// jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, status.ConditionTypeComponentsReady, readyCondition),
289-
// )
290-
// }
291-
292-
// Update the management state of the component in the DataScienceCluster.
293-
tc.EventuallyResourcePatched(
294-
WithMinimalObject(gvk.DataScienceCluster, tc.DataScienceClusterNamespacedName),
295-
WithMutateFunc(testf.Transform(`.spec.components.%s.managementState = "%s"`, componentFieldName, state)),
296-
WithCondition(And(conditions...)),
297-
)
253+
// Delegate to the base TestContext method
254+
tc.TestContext.UpdateComponentStateInDataScienceClusterWithKind(state, kind)
298255
}
299256

300257
// ValidateCRDRemoval ensures that the CRD is properly removed when the component is disabled.

tests/e2e/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ var (
150150
scenarios: []map[string]TestFn{{
151151
serviceApi.MonitoringServiceName: monitoringTestSuite,
152152
serviceApi.AuthServiceName: authControllerTestSuite,
153-
// serviceApi.GatewayServiceName: gatewayTestSuite,
153+
serviceApi.GatewayServiceName: gatewayTestSuite,
154154
}},
155155
}
156156
)

0 commit comments

Comments
 (0)