This is an automated email from the ASF dual-hosted git repository.
adoroszlai 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 5d7bbc801df HDDS-16784. Run rebot in pod in kubernetes check (#11938)
5d7bbc801df is described below
commit 5d7bbc801dfec9f76d4f29b86cb1811529244da2
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Tue Nov 10 17:16:19 2026 +0100
HDDS-16784. Run rebot in pod in kubernetes check (#11938)
Co-authored-by: Chi-Hsuan Huang <[email protected]>
---
.../dist/src/main/k8s/examples/test-all.sh | 8 ++---
hadoop-ozone/dist/src/main/k8s/examples/testlib.sh | 40 ++++++++++++++++------
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh
b/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh
index e231c490414..b250e1cd603 100755
--- a/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh
+++ b/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh
@@ -25,7 +25,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"
>/dev/null && pwd )
source "${SCRIPT_DIR}/testlib.sh"
ALL_RESULT_DIR="$SCRIPT_DIR/result"
-rm "$ALL_RESULT_DIR"/* || true
+rm -fr "$ALL_RESULT_DIR"
mkdir -p "$ALL_RESULT_DIR"
RESULT=0
@@ -44,15 +44,13 @@ for test in $(find "$SCRIPT_DIR" -name test.sh | grep
"${OZONE_TEST_SELECTOR:-""
echo "ERROR: Test execution of ${TEST_NAME} is FAILED!!!!"
fi
- cp "$TEST_DIR"/result/output.xml "$ALL_RESULT_DIR"/"${TEST_NAME}".xml || true
+ mv -fv "$TEST_DIR"/result "$ALL_RESULT_DIR"/"${TEST_NAME}" || true
mkdir -p "$ALL_RESULT_DIR"/"${TEST_NAME}"
- mv "$TEST_DIR"/logs/*log "$ALL_RESULT_DIR"/"${TEST_NAME}"/ || true
+ mv -fv "$TEST_DIR"/logs/*log "$ALL_RESULT_DIR"/"${TEST_NAME}"/ || true
if [[ "${RESULT}" == "1" ]] && [[ "${FAIL_FAST:-}" == "true" ]]; then
break
fi
done
-run_rebot "$ALL_RESULT_DIR" "$ALL_RESULT_DIR" "-N smoketests *.xml"
-
exit ${RESULT}
diff --git a/hadoop-ozone/dist/src/main/k8s/examples/testlib.sh
b/hadoop-ozone/dist/src/main/k8s/examples/testlib.sh
index 6e9637900fc..74a6a4bcc53 100644
--- a/hadoop-ozone/dist/src/main/k8s/examples/testlib.sh
+++ b/hadoop-ozone/dist/src/main/k8s/examples/testlib.sh
@@ -83,7 +83,7 @@ all_pods_are_running() {
}
pre_run_setup() {
- rm -fr logs result
+ create_robot_dir
regenerate_resources
reset_k8s_env
start_k8s_env
@@ -116,11 +116,13 @@ post_run() {
get_logs
stop_k8s_env
revert_resources
+ delete_robot_dir
set -e
}
get_logs() {
print_phase "Collecting container logs"
+ rm -fr logs
mkdir -p logs
for pod in $(kubectl get pods -o custom-columns=NAME:.metadata.name | tail
-n +2); do
for initContainer in $(kubectl get pod -o
jsonpath='{.spec.initContainers[*].name}' "${pod}"); do
@@ -161,7 +163,11 @@ regenerate_resources() {
local runner_version=${OZONE_RUNNER_VERSION:-${default_version}} # may be
specified by user running the test
local runner_image="${OZONE_RUNNER_IMAGE:-apache/ozone-runner}" # may be
specified by user running the test
- flekszible generate -t mount:hostPath="$OZONE_ROOT",path=/opt/hadoop -t
image:image="${runner_image}:${runner_version}" -t ozone/onenode
+ flekszible generate \
+ -t mount:name=ozone,path=/opt/hadoop,hostPath="$OZONE_ROOT" \
+ -t mount:name=robot,path=/robot,hostPath="$ROBOT_OUTPUT_DIR" \
+ -t image:image="${runner_image}:${runner_version}" \
+ -t ozone/onenode
}
revert_resources() {
@@ -171,7 +177,6 @@ revert_resources() {
execute_robot_test() {
print_phase "Executing robot tests $@"
- mkdir -p result
CONTAINER="$1"
shift 1 #Remove first argument which was the container name
@@ -179,16 +184,17 @@ execute_robot_test() {
# shellcheck disable=SC2206
ARGUMENTS=($@)
- kubectl exec -it "${CONTAINER}" -- bash -c 'rm -rf /tmp/report'
- kubectl exec -it "${CONTAINER}" -- bash -c 'mkdir -p /tmp/report'
- kubectl exec -it "${CONTAINER}" -- robot --nostatusrc -d /tmp/report
${ARGUMENTS[@]-} || true
- kubectl cp "${CONTAINER}":/tmp/report/output.xml
"result/$CONTAINER-$RANDOM.xml" || true
+ kubectl exec -it "${CONTAINER}" -- robot --log NONE --nostatusrc
--outputdir /robot --report NONE --timestampoutputs ${ARGUMENTS[@]-}
}
combine_reports() {
- if [[ -d result ]]; then
- rm -f result/output.xml
- run_rebot result result "-o output.xml -N '$(basename $(pwd))' *.xml"
+ if [[ -d "${ROBOT_OUTPUT_DIR}" ]] && [[ -n "${CONTAINER:-}" ]]; then
+ local title="$(basename $(pwd))"
+ kubectl exec -it "${CONTAINER}" -- rebot --logtitle "${title}" --name
"${title}" --nostatusrc \
+ --outputdir /robot --output output.xml --report NONE /robot/*.xml || true
+ rm -fr result
+ mkdir -p result
+ mv -iv "${ROBOT_OUTPUT_DIR}"/{log.html,output.xml} result/
fi
}
@@ -197,3 +203,17 @@ print_phase() {
echo "**** $1 ****"
echo ""
}
+
+create_robot_dir() {
+ if [[ -z "${ROBOT_OUTPUT_DIR:-}" ]]; then
+ export ROBOT_OUTPUT_DIR="$(mktemp -d "${TMPDIR:-/tmp}"/robot-data-XXXXXX)"
+ export ROBOT_OUTPUT_DIR_CREATED="true"
+ chmod go+rwx "${ROBOT_OUTPUT_DIR}"
+ fi
+}
+
+delete_robot_dir() {
+ if [[ "${ROBOT_OUTPUT_DIR_CREATED:-}" == "true" ]] && [[ -n
"${ROBOT_OUTPUT_DIR:-}" ]] && [[ -d "${ROBOT_OUTPUT_DIR}" ]]; then
+ rm -frv "${ROBOT_OUTPUT_DIR}"
+ fi
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]