LZD-PratyushBhatt commented on code in PR #5439:
URL: https://github.com/apache/ozone/pull/5439#discussion_r1362030774


##########
hadoop-ozone/dist/src/main/smoketest/omha/om-leader-transfer.robot:
##########
@@ -14,60 +14,137 @@
 # limitations under the License.
 
 *** Settings ***
-Documentation       Smoketest ozone cluster startup
+Documentation       Smoketest for OM leader transfer
 Library             OperatingSystem
 Library             BuiltIn
 Resource            ../commonlib.robot
 Test Timeout        5 minutes
 
-** Keywords ***
+
+*** Keywords ***
+Get OM Nodes
+    ${result} =        Execute                 ozone admin om roles 
--service-id=omservice --json | jq -r '[.[] | .[] | select(.serverRole == 
"LEADER") | .hostname], [.[] | .[] | select(.serverRole == "FOLLOWER") | 
.hostname] | .[]'
+    ${leader}=         Get Line                ${result}    0
+    ${follower1}=      Get Line                ${result}    1
+    ${follower2}=      Get Line                ${result}    2
+    [Return]           ${leader}    ${follower1}    ${follower2}
+
 Get OM Leader Node
-    ${result} =             Execute                 ozone admin om roles 
--service-id=omservice
-                            LOG                     ${result}
-                            Should Contain          ${result}               
LEADER              1
-                            Should Contain          ${result}               
FOLLOWER            2
-    ${omLine} =             Get Lines Containing String                     
${result}           LEADER
-    ${split1}               ${split2}               Split String            
${omLine}           :
-    ${leaderOM} =           Strip String            ${split1}
-                            LOG                     Leader OM: ${leaderOM}
-    [return]                ${leaderOM}
+    ${result} =        Get OM Nodes
+    [Return]           ${result}[0]
 
 Get One OM Follower Node
-    ${result} =             Execute                 ozone admin om roles 
--service-id=omservice
-                            LOG                     ${result}
-                            Should Contain          ${result}               
LEADER              1
-                            Should Contain          ${result}               
FOLLOWER            2
-    ${omLines} =            Get Lines Containing String                     
${result}           FOLLOWER
-    ${omLine} =             Get Line                ${omLines}              0
-    ${split1}               ${split2}               Split String            
${omLine}           :
-    ${followerOM} =         Strip String            ${split1}
-                            LOG                     Follower OM: ${followerOM}
-    [return]                ${followerOM}
-
-
-** Test Cases ***
-Transfer Leadership for OM
+    ${result} =        Get OM Nodes
+    [Return]           ${result}[1]
+
+Get OM Leader and One Follower Node
+    ${result} =        Get OM Nodes
+    [Return]           ${result}[0]      ${result}[1]
+
+Assert OM leader Role Transitions
+    [arguments]             ${leaderOM}     ${followerOM}     ${isEqualCheck}
+    ${newLeaderOM} =        Get OM Leader Node
+                            Should not be Equal     ${leaderOM}             
${newLeaderOM}
+    Run Keyword If          '${isEqualCheck}' == 'true'         Should be 
Equal    ${followerOM}    ${newLeaderOM}

Review Comment:
   Sure, will explore that. 
   THanks for the review!



-- 
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