adoroszlai commented on code in PR #5439:
URL: https://github.com/apache/ozone/pull/5439#discussion_r1361942234
##########
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:
_Future_ improvement idea: set default value `${followerOM}=${EMPTY}`, get
rid of `${isEqualCheck}`, and replace the condition with `${followerOM} !=
${EMPTY}` (or similar, I'm not sure of the syntax).
This lets the caller indicate if it expects specific new leader simply by
passing the second argument.
##########
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}
+
+
+*** 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}
+ Assert OM Leader Role Transitions ${leaderOM} ${followerOM} true
+
+Transfer Leadership for OM with Multiple ServiceIDs, Valid ServiceID Specified
Review Comment:
_Future_ improvement idea: `Transfer Leadership for OM` is the same for all
test cases. Since they are run in context of this script, I think we can omit
it. This lets us avoid truncation of case-specific details (config, arguments):
```
Om-Leader-Transfer :: Smoketest for OM leader transfer
==============================================================================
Transfer Leadership for OM with Valid ServiceID Specified | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM with Multiple ServiceIDs, Valid Service... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM with Multiple ServiceIDs, Unconfigured ... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM with Multiple ServiceIDs, Invalid Servi... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM without ServiceID specified | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM with Multiple ServiceIDs, No ServiceID ... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM randomly with Valid ServiceID Specified | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM randomly with Multiple ServiceIDs, Vali... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM randomly with Multiple ServiceIDs, Unco... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM randomly with Multiple ServiceIDs, Inva... | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM randomly without ServiceID specified | PASS
|
------------------------------------------------------------------------------
Transfer Leadership for OM randomly with Multiple ServiceIDs, No S... | PASS
|
------------------------------------------------------------------------------
Om-Leader-Transfer :: Smoketest for OM leader transfer | PASS
|
12 tests, 12 passed, 0 failed
```
--
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]