Skip to content

Commit

Permalink
RHOAIENG-13014 - Rewrite Verify RHODS Operator Logs test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianMacik committed Sep 20, 2024
1 parent 7a1f2d0 commit 649f2b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ Suite Teardown RHOSi Teardown


*** Variables ***
${regex_pattern} level=([Ee]rror).*|([Ff]ailed) to list .*
${regex_pattern} level":"([Ee]rror).*|([Ff]ailed) to list .*


*** Test Cases ***
Verify RHODS Operator Logs
Verify RHODS Operator Logs After Restart
[Tags] Sanity
... ODS-1007
... Operator
Restart RHODS Operator Pod
#Get the POD name
${data} Run Keyword Oc Get kind=Pod namespace=${OPERATOR_NAMESPACE} label_selector=${OPERATOR_LABEL_SELECTOR}
#Capture the logs based on containers
${val} Run oc logs --tail=1000000 ${data[0]['metadata']['name']} -n ${OPERATOR_NAMESPACE} -c ${OPERATOR_POD_CONTAINER_NAME}
${val} Run oc logs --tail=-1 ${data[0]['metadata']['name']} -n ${OPERATOR_NAMESPACE} -c ${OPERATOR_POD_CONTAINER_NAME}
#To check if command has been successfully executed and the logs have been captured
IF len($val)==${0} FAIL Either OC command has not been executed successfully or Logs are not present
#Filter the error msg from the log captured
Expand All @@ -40,3 +41,10 @@ Verify RHODS Operator Logs
#Verify if captured logs has any error entry if yes fail the TC
IF ${length} != ${0} FAIL There are some error entry present in opeartor logs '${entry_msg}'
... ELSE Log Operator log looks clean


*** Keywords ***
Restart RHODS Operator Pod
[Documentation] Restart the operator Pod by deleting it and waiting for a new one to be Ready
Oc Delete kind=Pod namespace=${OPERATOR_NAMESPACE} label_selector=${OPERATOR_LABEL_SELECTOR}
Wait For Pods Status namespace=${OPERATOR_NAMESPACE} label_selector=${OPERATOR_LABEL_SELECTOR} timeout=120
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Verify DSPO Logs Show Error Encountered When Parsing DSPA
TRY
WHILE not ${stopped} limit=${timeout}
Sleep 1s
${logs} = Run oc logs --tail=1000000 ${pod_name} -n ${APPLICATIONS_NAMESPACE}
${logs} = Run oc logs --tail=-1 ${pod_name} -n ${APPLICATIONS_NAMESPACE}
${stopped} = Set Variable If "Encountered error when parsing CR" in """${logs}""" True False
END
EXCEPT WHILE loop was aborted type=start
Expand Down

0 comments on commit 649f2b2

Please sign in to comment.