diff --git a/scripts/fetch_tools.sh b/scripts/fetch_tools.sh index 308da1927e..8328dcfc0d 100755 --- a/scripts/fetch_tools.sh +++ b/scripts/fetch_tools.sh @@ -291,13 +291,23 @@ gettool_ginkgo() { pushd "${clone_dir}" &>/dev/null local test_binary="./bin/extended-platform-tests" - go build -o "${test_binary}" ./cmd/extended-platform-tests + make build # Copy binary to centralized location if [[ -f "${test_binary}" ]]; then cp "${test_binary}" "${binary_path}" chmod +x "${binary_path}" echo "Binary installed to ${binary_path}" + + # Copy handleresult.py to the tools directory + if [[ -f "${clone_dir}/pipeline/handleresult.py" ]] && [[ -f "${HANDLERESULT_SCRIPT}" ]]; then + cp "${clone_dir}/pipeline/handleresult.py" "${HANDLERESULT_SCRIPT}" + chmod +x "${HANDLERESULT_SCRIPT}" + echo "handleresult.py installed to ${HANDLERESULT_SCRIPT}" + else + echo "Warning: pipeline/handleresult.py not found in repository" + fi + popd &>/dev/null else echo "Error: Test binary not found after build" diff --git a/test/bin/common.sh b/test/bin/common.sh index 2f064cbe47..1886a86010 100644 --- a/test/bin/common.sh +++ b/test/bin/common.sh @@ -27,6 +27,7 @@ export IMAGEDIR="${OUTPUTDIR}/test-images" # Ginkgo test binary path export GINKGO_TEST_BINARY="${OUTPUTDIR}/bin/extended-platform-tests" +export HANDLERESULT_SCRIPT="${OUTPUTDIR}/bin/handleresult.py" # The storage pool base name for VMs. # The actual pool names will be '${VM_POOL_BASENAME}-${SCENARIO}'. diff --git a/test/bin/scenario.sh b/test/bin/scenario.sh index c72ebff7f6..f19dd56079 100755 --- a/test/bin/scenario.sh +++ b/test/bin/scenario.sh @@ -1139,7 +1139,7 @@ run_gingko_tests() { local -r filter_pattern="$1" echo "Applying filter: ${filter_pattern}" if [[ "${filter_pattern}" == ~* ]]; then - sed -i "/${filter_pattern#~}/d" "${case_selected}" + sed -i "/${filter_pattern#\~}/d" "${case_selected}" else sed -i -n "/${filter_pattern}/p" "${case_selected}" fi @@ -1161,9 +1161,46 @@ run_gingko_tests() { record_junit "${vmname}" "run_gingko_tests" "OK" popd &>/dev/null + # Clean the JUnit XML files + echo "Cleaning JUnit XML files..." + cleanup_success=true + + if [[ ! -f "${HANDLERESULT_SCRIPT}" ]]; then + echo "Warning: pipeline/handleresult.py not found. Skipping XML cleanup." + else + for junit_file in "${test_results_dir}"/junit_e2e_*.xml; do + if [[ -f "${junit_file}" ]]; then + filename=$(basename "${junit_file}") + echo "Processing: ${filename}" + + # Create backup + cp "${junit_file}" "${junit_file}.backup" + + # Clean the XML + temp_file="${junit_file}.tmp" + if python3 "${HANDLERESULT_SCRIPT}" -a replace -i "${junit_file}" -o "${temp_file}" 2>/dev/null; then + mv "${temp_file}" "${junit_file}" + + echo "✓ Cleaned: ${filename}" + rm "${junit_file}.backup" # Remove backup on success + else + echo "✗ Failed to clean: ${filename} (restored from backup)" + mv "${junit_file}.backup" "${junit_file}" # Restore from backup + cleanup_success=false + fi + fi + done + fi + # Display results summary echo "Gingko test execution completed" echo "Results are available in: ${test_results_dir}" + if [[ "${cleanup_success}" == "true" ]]; then + echo "✓ JUnit XML files have been cleaned (Monitor test cases removed)" + else + echo "⚠ Some XML files could not be cleaned (originals preserved)" + fi + if [[ -f "${test_results_dir}/test-output.log" ]]; then echo "Test output log: ${test_results_dir}/test-output.log" fi