Skip to content

Commit

Permalink
Apply changes related to restoring custom CA bundle
Browse files Browse the repository at this point in the history
Changes were manually picked up from these commits
  a132bb3 RHOAIENG-6358 Custom CA Bundle Save Restore Improvements
  4094101 RHOAIENG-6358 Custom CA Bundle Save Restore Improvements
  c144a2a RHOAIENG-6358 Removed unneeded customCABundle default value restore
  10fee65 RHOAIENG-6358 Fix lint warning
  f9ed258 RHOAIENG-6358 Documentation
  033dc9e RHOAIENG-6358 Restore customCABundle

Signed-off-by: Andrej Podhradsky <apodhrad@redhat.com>
  • Loading branch information
apodhrad committed May 14, 2024
1 parent 0cdd34e commit b2e845a
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ${TRUSTED_CA_BUNDLE_CONFIGMAP} odh-trusted-ca-bundle
${CUSTOM_CA_BUNDLE} test-example-custom-ca-bundle
${IS_PRESENT} 0
${IS_NOT_PRESENT} 1
${SAVED_CUSTOM_CA_BUNDLE} ${EMPTY}


*** Test Cases ***
Expand All @@ -38,7 +39,7 @@ Validate Trusted CA Bundles State Managed
Wait Until Keyword Succeeds 2 min 0 sec
... Is CA Bundle Value Present ${TRUSTED_CA_BUNDLE_CONFIGMAP} ${CUSTOM_CA_BUNDLE} ${TEST_NS} ${IS_PRESENT}

[Teardown] Restore DSCI Trusted CA Bundle Settings
[Teardown] Restore DSCI Trusted CA Bundle Settings ${SAVED_CUSTOM_CA_BUNDLE}

Validate Trusted CA Bundles State Unmanaged
[Documentation] The purpose of this test case is to validate Trusted CA Bundles when in state Unmanaged
Expand All @@ -53,7 +54,7 @@ Validate Trusted CA Bundles State Unmanaged
Wait Until Keyword Succeeds 1 min 0 sec
... Is CA Bundle Value Present ${TRUSTED_CA_BUNDLE_CONFIGMAP} random-ca-bundle-value ${TEST_NS} ${IS_PRESENT}

[Teardown] Restore DSCI Trusted CA Bundle Settings
[Teardown] Restore DSCI Trusted CA Bundle Settings ${SAVED_CUSTOM_CA_BUNDLE}

Validate Trusted CA Bundles State Removed
[Documentation] The purpose of this test case is to validate Trusted CA Bundles when in state Removed
Expand All @@ -66,7 +67,7 @@ Validate Trusted CA Bundles State Removed
Wait Until Keyword Succeeds 3 min 0 sec
... Is Resource Present ConfigMap ${TRUSTED_CA_BUNDLE_CONFIGMAP} ${TEST_NS} ${IS_NOT_PRESENT}

[Teardown] Restore DSCI Trusted CA Bundle Settings
[Teardown] Restore DSCI Trusted CA Bundle Settings ${SAVED_CUSTOM_CA_BUNDLE}


*** Keywords ***
Expand All @@ -76,6 +77,8 @@ Suite Setup
Wait Until Operator Ready ${RHOAI_OPERATOR_DEPLOYMENT_NAME} ${OPERATOR_NS}
Wait For DSCI Ready State ${DSCI_NAME} ${OPERATOR_NS}
Create Namespace In Openshift ${TEST_NS}
${SAVED_CUSTOM_CA_BUNDLE}= Get Custom CA Bundle Value In DSCI ${DSCI_NAME} ${OPERATOR_NAMESPACE}
Set Suite Variable ${SAVED_CUSTOM_CA_BUNDLE}

Suite Teardown
[Documentation] Suite Teardown
Expand All @@ -84,8 +87,10 @@ Suite Teardown

Restore DSCI Trusted CA Bundle Settings
[Documentation] Restore DSCI Trusted CA Bundle settings to original tate
Set Custom CA Bundle Value In DSCI ${DSCI_NAME} '' ${OPERATOR_NS}
[Arguments] ${custom_ca_value}

Set Trusted CA Bundle Management State ${DSCI_NAME} Managed ${OPERATOR_NS}
Set Custom CA Bundle Value In DSCI ${DSCI_NAME} ${custom_ca_value} ${OPERATOR_NS}

Wait Until Operator Ready
[Documentation] Checks if operator is available/ready
Expand Down Expand Up @@ -161,3 +166,12 @@ Set Trusted CA Bundle Management State
${rc} ${output}= Run And Return Rc And Output
... oc patch DSCInitialization/${DSCI} -n ${namespace} -p '{"spec":{"trustedCABundle":{"managementState":"${management_state}"}}}' --type merge
Should Be Equal "${rc}" "0" msg=${output}

Get Custom CA Bundle Value In DSCI
[Documentation] Get DSCI Custdom CA Bundle Value
[Arguments] ${dsci} ${namespace}
${rc} ${value}= Run And Return Rc And Output
... oc get DSCInitialization/${dsci} -n ${namespace} -o 'jsonpath={.spec.trustedCABundle.customCABundle}'
Should Be Equal "${rc}" "0" msg=${value}

RETURN ${value}

0 comments on commit b2e845a

Please sign in to comment.