Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate Validate ServiceMeshControlPlaneAlreadyCreated Test Case #1762

Conversation

asanzgom
Copy link
Contributor

@asanzgom asanzgom commented Aug 30, 2024

RHOAIENG-2517 Test Case to validate that only one Service Mesh Control Plane per namespace/project can be created

@asanzgom asanzgom self-assigned this Aug 30, 2024
@@ -199,7 +199,7 @@
Install RHODS In Self Managed Cluster Using CLI
[Documentation] Install rhods on self managed cluster using cli
[Arguments] ${cluster_type} ${image_url}
${return_code} Run and Watch Command cd ${EXECDIR}/${OLM_DIR} && ./setup.sh -t operator -u ${UPDATE_CHANNEL} -i ${image_url} -n ${OPERATOR_NAME} -p ${OPERATOR_NAMESPACE} timeout=20 min
${return_code} Run and Watch Command cd ${EXECDIR}/${OLM_DIR} && ./setup.sh -t operator -u ${UPDATE_CHANNEL} -i ${image_url} timeout=20 min

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent within the file. Expected ' =' but got '' instead
${IS_PRESENT} 0
${IS_NOT_PRESENT} 1
${OLM_DIR} olm
${INSTALL_TYPE} CLi

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${INSTALL_TYPE}' is assigned but not used
${IS_NOT_PRESENT} 1
${OLM_DIR} olm
${INSTALL_TYPE} CLi
${TEST_ENV} PSI

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${TEST_ENV}' is assigned but not used
${TEST_ENV} PSI
${IS_PRESENT} 0
${IS_NOT_PRESENT} 1
${MSSG_REGEX} denied the request: only one service mesh may be installed per project/namespace

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (124/120)
${matches}= Get Regexp Matches ${OCP_CONSOLE_URL} rh-ods
${domain}= Get From List ${matches} 0
IF "${domain}" == "rh-ods"
Set Global Variable ${CLUSTER_TYPE} selfmanaged

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Global Variable can be replaced with VAR
IF "${domain}" == "rh-ods"
Set Global Variable ${CLUSTER_TYPE} selfmanaged
ELSE
Set Global Variable ${CLUSTER_TYPE} managed

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Global Variable can be replaced with VAR

Delete Smcp
[Documentation] Delete the ServiceMeshControlPlane already created
Run and Watch Command

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning test

Keyword name 'Run and Watch Command' does not follow case convention
[Documentation] Loop until the Operator deployment is ready
${rc}= Set Variable 1
TRY
WHILE ${rc} != 0 limit=10m

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'WHILE' condition can be simplified

Cleanup Olm Install Dir
[Documentation] Clean up olm install repo
${return_code}= Run and Watch Command rm -vRf ${EXECDIR}/${OLM_DIR} timeout=10 min

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning test

Keyword name 'Run and Watch Command' does not follow case convention
@asanzgom asanzgom added needs testing Needs to be tested in Jenkins new test New test(s) added (PR will be listed in release-notes) labels Aug 30, 2024
Copy link
Contributor

github-actions bot commented Aug 30, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
545 0 0 545 100

@asanzgom
Copy link
Contributor Author

asanzgom commented Aug 30, 2024

Running rhods-ci-pr-test/3305/

@asanzgom asanzgom enabled auto-merge August 30, 2024 11:36
ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot Outdated Show resolved Hide resolved
Fetch Image Url And Update Channel
[Documentation] Fetch url for image and Update Channel
${rc} ${out}= Run And Return Rc And Output
... oc get catalogsource rhoai-catalog-dev --namespace openshift-marketplace -o jsonpath='{.spec.image}'
Copy link
Contributor

Choose a reason for hiding this comment

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

if we test a catalog source that is not created by automations and the user includes manually another name, this line will fail.

Lets see if we can get a generic way to retrieve the used catalogsource, maybe by tags or by image

Copy link
Contributor

Choose a reason for hiding this comment

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

try with some label selector

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added workaround to get CatalogSource from subscription

${rc} ${out}= Run And Return Rc And Output
... oc get subscription rhoai-operator-dev --namespace redhat-ods-operator -o jsonpath='{.spec.channel}'
Should Be Equal As Integers ${rc} 0
Set Global Variable ${UPDATE_CHANNEL} ${out}
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here, the subscription can have a different name if we dont use automations and we deploy the catalog source by hand

@asanzgom
Copy link
Contributor Author

rhods-ci-pr-test/3306 passed successfully

Delete Smcp
# Cleanup Olminstall dir
Cleanup Olm Install Dir

Copy link
Contributor

Choose a reason for hiding this comment

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

We need a teardown method for the test just in case some step fails, so we are back to initial state, with ODH/RHOAI installed and working

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is the suite teardown
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Cesar, we need a teardown which restore the correct RHOAI status in the cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I can move it to the Suite Teardown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added Test Case Teardown

ods_ci/tests/Resources/RHOSi.resource Fixed Show fixed Hide fixed
ods_ci/tests/Resources/RHOSi.resource Fixed Show fixed Hide fixed
ods_ci/tests/Resources/RHOSi.resource Fixed Show fixed Hide fixed
ods_ci/tests/Resources/RHOSi.resource Fixed Show fixed Hide fixed
ods_ci/tests/Resources/RHOSi.resource Fixed Show fixed Hide fixed
ods_ci/tests/Resources/RHOSi.resource Fixed Show fixed Hide fixed

Suite Teardown
[Documentation] Suite Teardown
RHOSi Teardown

Teardown Service Mesh Control Plane Already Created

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Teardown Service Mesh Control Plane Already Created' keyword
${rc} ${out}= Run And Return Rc And Output
... oc get catalogsource rhoai-catalog-dev --namespace openshift-marketplace -o jsonpath='{.spec.image}'
Should Be Equal As Integers ${rc} 0
Set Global Variable ${IMAGE_URL} ${out}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Global Variable can be replaced with VAR
Comment on lines 282 to 287
Create DataScienceCluster CustomResource Using Custom Configuration
Apply Custom Manifest in DataScienceCluster CustomResource Using Custom Configuration
${yml} = Get File ${file_path}dsc_apply.yml
Log To Console Applying DSC yaml
Log To Console ${yml}
${return_code} ${output} = Run And Return Rc And Output oc apply -f ${file_path}dsc_apply.yml
Copy link
Contributor

@bdattoma bdattoma Sep 23, 2024

Choose a reason for hiding this comment

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

is this applying multiple times the DSC? at line 282 (maybe in 283) and 287?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, the keyword says "Apply" but it doesn-t mean to actually Apply in the cluster via OC. Unless it's only me seeing the ambiguity, would you mind clear it a bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That part follows the same logic as before (just some common parts) it is not newly added logic. On these lines it is just getting the file to log it into console

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah but still, the ambiguity reading the code remains

@@ -335,6 +367,14 @@ Apply Custom Manifest in DataScienceCluster CustomResource Using Test Variables
END
END

Apply Custom Manifest in DataScienceCluster CustomResource Using Custom Configuration
[Documentation] Apply custom manifests to a DSC file
Log To Console Applying Custom Manifests
Copy link
Contributor

Choose a reason for hiding this comment

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

it is not applying actually

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to applying devFlags

Copy link
Contributor

Choose a reason for hiding this comment

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

that wouldn't change much, it would still not being "applying" anything on the cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that if a keyword is just editing a local YAML file, without actually applying it with OC client. it'd better to make it clear in the kw name like "Generate DataScianceCluster YAML" which gather any edit you need. Or if you need/prefer single keywords, Generate CustomManifest in DSC YAML or similar.

Then I'd expect to find a keyword which actually Applies the DSC resource in the cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed keyword to Generate CustomManifest in DSC YAML

Copy link
Contributor

Choose a reason for hiding this comment

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

ty, however the same applies to the other keywords in the PR which says "Apply" but doesn-t apply

CFSNM
CFSNM previously approved these changes Sep 24, 2024
CFSNM
CFSNM previously approved these changes Sep 24, 2024
Log To Console Applying devFlags
${file_path} = Set Variable tasks/Resources/Files/
FOR ${cmp} IN @{COMPONENT_LIST}
Run sed -i'' -e "s|<${cmp}_devflags>||g" ${file_path}dsc_apply.yml
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is setting the key as empty as it is by default

CFSNM
CFSNM previously approved these changes Sep 24, 2024
@asanzgom asanzgom disabled auto-merge September 24, 2024 15:06
Copy link

@asanzgom asanzgom merged commit 9219cc1 into red-hat-data-services:master Sep 25, 2024
8 checks passed
@asanzgom asanzgom deleted the feature/Validate_ServiceMeshControlPlaneAlreadyCreated branch September 25, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing Needs to be tested in Jenkins new test New test(s) added (PR will be listed in release-notes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants