This is an automated email from the ASF dual-hosted git repository.
tejaskriya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 9987f6a285c HDDS-13326. Add acceptance tests for ozone debug replicas
verify --container-state (#8783)
9987f6a285c is described below
commit 9987f6a285cdce1dc0df203ff948e52d793c8e8f
Author: Sarveksha Yeshavantha Raju
<[email protected]>
AuthorDate: Mon Aug 4 10:45:16 2025 +0530
HDDS-13326. Add acceptance tests for ozone debug replicas verify
--container-state (#8783)
---
dev-support/byteman/container-state-template.btm | 24 +++++++++
.../dist/src/main/compose/common/replicas-test.sh | 3 ++
.../smoketest/debug/container-state-verifier.robot | 58 ++++++++++++++++++++++
.../smoketest/debug/ozone-debug-keywords.robot | 4 ++
4 files changed, 89 insertions(+)
diff --git a/dev-support/byteman/container-state-template.btm
b/dev-support/byteman/container-state-template.btm
new file mode 100644
index 00000000000..d1ca5449f5c
--- /dev/null
+++ b/dev-support/byteman/container-state-template.btm
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+RULE Change container state to STATE_PLACEHOLDER
+CLASS org.apache.hadoop.ozone.container.common.impl.ContainerData
+METHOD getState
+AT ENTRY
+IF TRUE
+DO
+ traceln("BYTEMAN RULE: Overriding getState() to return STATE_PLACEHOLDER
state");
+ return
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos$ContainerDataProto$State.valueOf("STATE_PLACEHOLDER")
+ENDRULE
diff --git a/hadoop-ozone/dist/src/main/compose/common/replicas-test.sh
b/hadoop-ozone/dist/src/main/compose/common/replicas-test.sh
index 520ab8c4790..f69b4b23f1a 100755
--- a/hadoop-ozone/dist/src/main/compose/common/replicas-test.sh
+++ b/hadoop-ozone/dist/src/main/compose/common/replicas-test.sh
@@ -38,6 +38,7 @@ chunkinfo="${key}-blocks-${prefix}"
docker-compose exec -T ${SCM} bash -c "ozone debug replicas chunk-info
${volume}/${bucket}/${key}" > "$chunkinfo"
host="$(jq -r '.keyLocations[0][0].datanode["hostname"]' ${chunkinfo})"
container="${host%%.*}"
+dn_with_num="$(sed -E 's/^.*-(datanode[0-9]+)-[0-9]+$/\1/' <<< "$container")"
# corrupt the first block of key on one of the datanodes
datafile="$(jq -r '.keyLocations[0][0].file' ${chunkinfo})"
@@ -61,5 +62,7 @@ wait_for_datanode "${container}" HEALTHY 60
execute_robot_test ${SCM} -v "PREFIX:${prefix}" -v "DATANODE:${host}"
debug/block-existence-check.robot
+execute_robot_test ${SCM} -v "PREFIX:${prefix}" -v "DATANODE:${host}" -v
"FAULT_INJ_DATANODE:${dn_with_num}" debug/container-state-verifier.robot
+
execute_robot_test ${OM} kinit.robot
execute_robot_test ${OM} -v "PREFIX:${prefix}"
debug/ozone-debug-tests-ec3-2.robot
diff --git
a/hadoop-ozone/dist/src/main/smoketest/debug/container-state-verifier.robot
b/hadoop-ozone/dist/src/main/smoketest/debug/container-state-verifier.robot
new file mode 100644
index 00000000000..fbad5bd377b
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/debug/container-state-verifier.robot
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Test container state on a UNHEALTHY, DELETED and INVALID
container
+Resource ../ozone-fi/BytemanKeywords.robot
+Resource ozone-debug-keywords.robot
+
+*** Variables ***
+${PREFIX} ${EMPTY}
+${DATANODE} ${EMPTY}
+${FAULT_INJ_DATANODE} ${EMPTY}
+${VOLUME} cli-debug-volume${PREFIX}
+${BUCKET} cli-debug-bucket
+${TESTFILE} testfile
+${CHECK_TYPE} containerState
+${TEMPLATE_RULE}
/opt/hadoop/share/ozone/byteman/container-state-template.btm
+
+*** Keywords ***
+Create Container State Rule
+ [Arguments] ${state}
+ ${rule_file} = Set Variable /tmp/container-state-${state}.btm
+ Execute sed 's/STATE_PLACEHOLDER/${state}/g' ${TEMPLATE_RULE}
> ${rule_file}
+ Return From Keyword ${rule_file}
+
+Verify Container State with Rule
+ [Arguments] ${expected_state}
+ ${rule_file} = Create Container State Rule ${expected_state}
+ Add Byteman Rule ${FAULT_INJ_DATANODE} ${rule_file}
+ List Byteman Rules ${FAULT_INJ_DATANODE}
+
+ ${output} = Execute replicas verify container state debug tool
+ ${json} = Parse replicas verify JSON output ${output}
+ Check to Verify Replicas ${json} ${CHECK_TYPE} ${DATANODE} Replica
state is ${expected_state}
+
+ Remove Byteman Rule ${FAULT_INJ_DATANODE} ${rule_file}
+
+*** Test Cases ***
+Verify Container State With Unhealthy Container Replica
+ Verify Container State with Rule UNHEALTHY
+
+Verify Container State With Deleted Container Replica
+ Verify Container State with Rule DELETED
+
+Verify Container State With Invalid Container Replica
+ Verify Container State with Rule INVALID
diff --git
a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-keywords.robot
b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-keywords.robot
index 19257a62c72..6711484590c 100644
--- a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-keywords.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-keywords.robot
@@ -30,6 +30,10 @@ Execute replicas verify block existence debug tool
${output} Execute ozone debug replicas verify
--block-existence o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET}/${TESTFILE}
--all-results
[Return] ${output}
+Execute replicas verify container state debug tool
+ ${output} Execute ozone debug replicas verify
--container-state o3://${OM_SERVICE_ID}/${VOLUME}/${BUCKET}/${TESTFILE}
--all-results
+ [Return] ${output}
+
Parse replicas verify JSON output
[Arguments] ${output}
${json} = Evaluate json.loads('''${output}''') json
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]