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


##########
hadoop-ozone/dist/src/main/smoketest/omha/om-leader-transfer.robot:
##########
@@ -44,30 +44,135 @@ Get One OM Follower Node
                             LOG                     Follower OM: ${followerOM}
     [return]                ${followerOM}
 
+Get OM Leader and One Follower Node
+       ${follower_node} =    Get One OM Follower Node
+       ${leader_node} =      Get OM Leader Node
+       [Return]              ${leader_node}    ${follower_node}

Review Comment:
   This invokes `ozone admin om roles` twice.  We can improve it by making the 
following changes:
   
   1. Create a new keyword (`Get OM Nodes` or similar) to return all OM nodes 
in (leader, follower1, follower2) order.  This new keyword can reuse the logic 
currently duplicated between `Get OM Leader Node` and `Get One OM Follower 
Node`.
   2. Change `Get OM Leader Node` and `Get One OM Follower Node` to call the 
new keyword and return the right node, removing duplicated logic.
   3. Implement the new `Get OM Leader and One Follower Node` by calling the 
new keyword.



##########
hadoop-ozone/dist/src/main/smoketest/omha/om-leader-transfer.robot:
##########
@@ -44,30 +44,135 @@ Get One OM Follower Node
                             LOG                     Follower OM: ${followerOM}
     [return]                ${followerOM}
 
+Get OM Leader and One Follower Node
+       ${follower_node} =    Get One OM Follower Node
+       ${leader_node} =      Get OM Leader Node
+       [Return]              ${leader_node}    ${follower_node}
 
-** Test Cases ***
-Transfer Leadership for OM
+*** Test Cases ***
+Transfer Leadership for OM with Valid ServiceID Specified
     # Find Leader OM and one Follower OM
-    ${leaderOM} =           Get OM Leader Node
-                            LOG                     Leader OM: ${leaderOM}
-    ${followerOM} =         Get One OM Follower Node
-                            LOG                     Follower OM: ${followerOM}
+    ${leaderOM}  ${followerOM} =  Get OM Leader and One Follower Node
+
     # Transfer leadership to the Follower OM
     ${result} =             Execute                 ozone admin om transfer 
--service-id=omservice -n ${followerOM}
                             LOG                     ${result}
                             Should Contain          ${result}               
Transfer leadership successfully
 
     ${newLeaderOM} =        Get OM Leader Node
                             Should be Equal         ${followerOM}           
${newLeaderOM}
+                            Should not be Equal     ${leaderOM}             
${newLeaderOM}
 
-Transfer Leadership for OM randomly
+Transfer Leadership for OM with Multiple ServiceIDs, Valid ServiceID Specified
+    # Find Leader OM and one Follower OM
+    ${leaderOM}  ${followerOM} =  Get OM Leader and One Follower Node
+
+    # Transfer leadership to the Follower OM
+    ${result} =             Execute                 ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om transfer 
--service-id=omservice -n ${followerOM}
+                            LOG                     ${result}
+                            Should Contain          ${result}               
Transfer leadership successfully
+
+    ${newLeaderOM} =        Get OM Leader Node
+                            Should be Equal         ${followerOM}           
${newLeaderOM}
+                            Should not be Equal      ${leaderOM}            
${newLeaderOM}

Review Comment:
   These are duplicated among "success" test cases.  Please extract to a new 
parameterized keyword `Assert leadership transferred to` (or similar).



##########
hadoop-ozone/dist/src/main/smoketest/omha/om-leader-transfer.robot:
##########
@@ -44,30 +44,135 @@ Get One OM Follower Node
                             LOG                     Follower OM: ${followerOM}
     [return]                ${followerOM}
 
+Get OM Leader and One Follower Node
+       ${follower_node} =    Get One OM Follower Node
+       ${leader_node} =      Get OM Leader Node
+       [Return]              ${leader_node}    ${follower_node}
 
-** Test Cases ***
-Transfer Leadership for OM
+*** Test Cases ***
+Transfer Leadership for OM with Valid ServiceID Specified
     # Find Leader OM and one Follower OM
-    ${leaderOM} =           Get OM Leader Node
-                            LOG                     Leader OM: ${leaderOM}
-    ${followerOM} =         Get One OM Follower Node
-                            LOG                     Follower OM: ${followerOM}
+    ${leaderOM}  ${followerOM} =  Get OM Leader and One Follower Node
+
     # Transfer leadership to the Follower OM
     ${result} =             Execute                 ozone admin om transfer 
--service-id=omservice -n ${followerOM}
                             LOG                     ${result}
                             Should Contain          ${result}               
Transfer leadership successfully
 
     ${newLeaderOM} =        Get OM Leader Node
                             Should be Equal         ${followerOM}           
${newLeaderOM}
+                            Should not be Equal     ${leaderOM}             
${newLeaderOM}
 
-Transfer Leadership for OM randomly
+Transfer Leadership for OM with Multiple ServiceIDs, Valid ServiceID Specified
+    # Find Leader OM and one Follower OM
+    ${leaderOM}  ${followerOM} =  Get OM Leader and One Follower Node
+
+    # Transfer leadership to the Follower OM
+    ${result} =             Execute                 ozone admin 
--set=ozone.om.service.ids=omservice,omservice2 om transfer 
--service-id=omservice -n ${followerOM}
+                            LOG                     ${result}
+                            Should Contain          ${result}               
Transfer leadership successfully
+
+    ${newLeaderOM} =        Get OM Leader Node
+                            Should be Equal         ${followerOM}           
${newLeaderOM}
+                            Should not be Equal      ${leaderOM}            
${newLeaderOM}
+
+Transfer Leadership for OM with Multiple ServiceIDs, Unconfigured ServiceID 
Specified
+    # Find one Follower OM
+    ${followerOM} =         Get One OM Follower Node
+                            LOG                                      Follower 
OM: ${followerOM}
+
+    # Transfer leadership to the Follower OM
+    ${result} =             Execute And Ignore Error                 ozone 
admin --set=ozone.om.service.ids=omservice,omservice2 om transfer 
--service-id=omservice3 -n ${followerOM}
+                            LOG                     ${result}

Review Comment:
   These `LOG` statements are not necessary, Robot report (XML and HTML) 
contain actual values of variables, commands being executed, command output, 
exit code, etc.



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