adoroszlai commented on code in PR #5312:
URL: https://github.com/apache/ozone/pull/5312#discussion_r1332348523


##########
hadoop-ozone/dist/src/main/smoketest/omha/om-roles.robot:
##########
@@ -19,12 +19,37 @@ Resource            ../commonlib.robot
 Test Timeout        5 minutes
 Test Setup          Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Kinit 
test user     testuser     testuser.keytab
 
+*** Keywords ***
+Parse non json output
+     [Arguments]                     ${output}
+     Should Match Regexp             ${output}                  [om (: 
LEADER|)]
+
+Parse json output

Review Comment:
   Similarly: `Assert Leader Present in JSON` or `JSON Output Should Contain 
Leader`.



##########
hadoop-ozone/dist/src/main/smoketest/omha/om-roles.robot:
##########
@@ -19,12 +19,37 @@ Resource            ../commonlib.robot
 Test Timeout        5 minutes
 Test Setup          Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Kinit 
test user     testuser     testuser.keytab
 
+*** Keywords ***
+Parse non json output

Review Comment:
   Nit: I think `Assert Leader Present` or `Output Should Contain Leader` would 
better describe this keyword.



##########
hadoop-ozone/dist/src/main/smoketest/omha/om-roles.robot:
##########
@@ -19,12 +19,37 @@ Resource            ../commonlib.robot
 Test Timeout        5 minutes
 Test Setup          Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Kinit 
test user     testuser     testuser.keytab
 
+*** Keywords ***
+Parse non json output
+     [Arguments]                     ${output}
+     Should Match Regexp             ${output}                  [om (: 
LEADER|)]
+
+Parse json output
+     [Arguments]                     ${output}
+     ${leader} =                     Execute                    echo 
'${output}' | jq '.[] | select(.[] | .serverRole == "LEADER")'
+                                     Should Not Be Equal        ${leader}      
 ${EMPTY}
+
 *** Test Cases ***
-List om roles
-    ${output} =         Execute          ozone admin om roles 
--service-id=omservice
-                        Should Match Regexp   ${output}  [om (: LEADER|)]
+List om roles with OM service ID passed
+    ${output_with_id_passed} =      Execute                     ozone admin om 
roles --service-id=omservice
+                                    Parse non json output       
${output_with_id_passed}
+    ${output_with_id_passed} =      Execute                     ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om roles --service-id=omservice
+                                    Parse non json output       
${output_with_id_passed}
+
+List om roles without OM service ID passed
+    ${output_without_id_passed} =   Execute                     ozone admin om 
roles
+                                    Parse non json output       
${output_without_id_passed}
+    ${output_without_id_passed} =   Execute And Ignore Error    ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om roles
+                                    Should Contain              
${output_without_id_passed}      Please specify the service ID to be finalized.

Review Comment:
   `to be finalized` in the output seems strange, since nothing is being 
finalized here.  I think we should omit this part in:
   
   
https://github.com/apache/ozone/blob/f7d5c4912d97a4dfad10462e64a0104ffae4cada/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/OMAdmin.java#L134-L137



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to