|
4 | 4 | "strings" |
5 | 5 | "testing" |
6 | 6 |
|
7 | | - gTypes "github.com/onsi/gomega/types" |
8 | 7 | operatorv1 "github.com/openshift/api/operator/v1" |
9 | 8 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
10 | 9 | k8slabels "k8s.io/apimachinery/pkg/labels" |
@@ -251,50 +250,8 @@ func (tc *ComponentTestCtx) UpdateComponentStateInDataScienceCluster(state opera |
251 | 250 |
|
252 | 251 | // UpdateComponentStateInDataScienceClusterWithKind updates the management state of a specified component kind in the DataScienceCluster. |
253 | 252 | 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) |
298 | 255 | } |
299 | 256 |
|
300 | 257 | // ValidateCRDRemoval ensures that the CRD is properly removed when the component is disabled. |
|
0 commit comments