Tejaskriya commented on code in PR #8941:
URL: https://github.com/apache/ozone/pull/8941#discussion_r2284840117
##########
hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-keywords.robot:
##########
@@ -65,3 +65,32 @@ Check Replica Passed
Should Be True ${check['completed']}
Should Be True ${check['pass']}
Should Be Empty ${check['failures']}
+
+Execute replicas verify with replication filter
+ [Arguments] ${replication_type} ${replication_factor}
${verification_type}
+ ${output} Execute ozone debug replicas verify
--${verification_type} --type ${replication_type} --replication
${replication_factor} o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET} --all-results
+ [Return] ${output}
+
+Create test key with replication config
+ [Arguments] ${key_name} ${replication_type} ${replication_factor}
+ Execute ozone sh key put --type ${replication_type}
--replication ${replication_factor}
o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET}/${key_name} ${TEMP_DIR}/${TESTFILE}
Review Comment:
There is a shell.robot having `Create Key` keyword which takes arguments and
a file too, we can use that instead of creating a new keyword here
You might need to add the file as a resource in the test robot file
##########
hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-tests.robot:
##########
@@ -27,23 +28,75 @@ ${VOLUME} cli-debug-volume${PREFIX}
${BUCKET} cli-debug-bucket
${DEBUGKEY} debugKey
${TESTFILE} testfile
+${RATIS_ONE_KEY} ratis-one-key
+${RATIS_THREE_KEY} ratis-three-key
+${EC_KEY} ec-key
*** Keywords ***
Write keys
Execute ozone sh volume create o3://${OM_SERVICE_ID}/${VOLUME}
--space-quota 100TB --namespace-quota 100
Execute ozone sh bucket create
o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET} --space-quota 1TB
Execute dd if=/dev/urandom of=${TEMP_DIR}/${TESTFILE}
bs=100000 count=15
+ # Create default key (RATIS THREE by default)
Execute ozone sh key put
o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET}/${TESTFILE} ${TEMP_DIR}/${TESTFILE}
+ # Create RATIS ONE key
+ Create test key with replication config ${RATIS_ONE_KEY} RATIS
ONE
+ # Create RATIS THREE key
+ Create test key with replication config ${RATIS_THREE_KEY} RATIS
THREE
+ # Create EC rs-3-2-1024k key
+ Create test key with replication config ${EC_KEY} EC
rs-3-2-1024k
*** Test Cases ***
-Test ozone debug replicas verify checksums
+Test ozone debug replicas verify checksums, block-existence and container-state
${output} = Execute ozone debug replicas verify --checksums
--block-existence --container-state
o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET}/${TESTFILE}
${json} = Parse replicas verify JSON output ${output}
# 'keys' array should be empty if all keys and their replicas passed
Should Be Empty ${json}[keys]
Should Be True ${json}[pass] ${True}
+Test ozone debug replicas verify with RATIS ONE filter
+ ${output} = Execute replicas verify with replication filter RATIS
ONE checksums
+ ${json} = Parse replicas verify JSON output ${output}
+
+ ${keys} = Get From Dictionary ${json} keys
+ ${key_count} = Get Length ${keys}
+ Should Be Equal As Integers ${key_count} 1
Review Comment:
This section is common between the 3 tests, with few parameters different.
Can you create a keyword in this file itself, which takes these parameters:
`${replication_type} ${replication_factor} ${verification_type}
${key_count}`, and does all these operations?
This new keyword can be used in all the 3 tests instead of repeating the
same logic in all 3.
##########
hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-keywords.robot:
##########
@@ -65,3 +65,32 @@ Check Replica Passed
Should Be True ${check['completed']}
Should Be True ${check['pass']}
Should Be Empty ${check['failures']}
+
+Execute replicas verify with replication filter
+ [Arguments] ${replication_type} ${replication_factor}
${verification_type}
+ ${output} Execute ozone debug replicas verify
--${verification_type} --type ${replication_type} --replication
${replication_factor} o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET} --all-results
+ [Return] ${output}
+
+Create test key with replication config
+ [Arguments] ${key_name} ${replication_type} ${replication_factor}
+ Execute ozone sh key put --type ${replication_type}
--replication ${replication_factor}
o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET}/${key_name} ${TEMP_DIR}/${TESTFILE}
+
+Verify key exists in output
+ [Arguments] ${json} ${expected_key_name}
+ ${keys} = Get From Dictionary ${json} keys
+ ${key_names} = Create List
+ FOR ${key} IN @{keys}
+ ${key_name} = Get From Dictionary ${key} name
+ Append To List ${key_names} ${key_name}
+ END
+ Should Contain ${key_names} ${expected_key_name} Key
${expected_key_name} not found in output
+
+Verify key not in output
+ [Arguments] ${json} ${expected_key_name}
+ ${keys} = Get From Dictionary ${json} keys
+ ${key_names} = Create List
+ FOR ${key} IN @{keys}
+ ${key_name} = Get From Dictionary ${key} name
+ Append To List ${key_names} ${key_name}
+ END
+ Should Not Contain ${key_names} ${expected_key_name} Key
${expected_key_name} should not be in filtered output
Review Comment:
These 2 are quite similar (only the last assert is different). Instead, we
can have 1 keyword that returns the list ${key_names}. That can be used in the
tests.
The "Should Contain" and "Should Not Contain" can be done in the tests
instead.
--
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]