Skip to content

Commit

Permalink
HDDS-11801. Logs missing if kubernetes check fails before tests (#7496)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Jan 3, 2025
1 parent d013188 commit 99fd5fc
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions hadoop-ozone/dist/src/main/k8s/examples/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -u -o pipefail

#
# Test executor to test all the compose/*/test.sh test scripts.
# Test executor to test all the k8s/examples/*/test.sh test scripts.
#
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )

set -ex

ALL_RESULT_DIR="$SCRIPT_DIR/result"
rm "$ALL_RESULT_DIR"/* || true
mkdir -p "$ALL_RESULT_DIR"
Expand All @@ -35,15 +34,23 @@ for test in $(find "$SCRIPT_DIR" -name test.sh | grep "${OZONE_TEST_SELECTOR:-""
TEST_NAME="$(basename "$TEST_DIR")"

echo ""
echo "#### Executing tests of ${TEST_DIR} #####"
echo "#### Executing tests of ${TEST_NAME} #####"
echo ""
cd "$TEST_DIR" || continue
./test.sh
if ! ./test.sh; then
RESULT=1
echo "ERROR: Test execution of ${TEST_NAME} is FAILED!!!!"
fi

cp "$TEST_DIR"/result/output.xml "$ALL_RESULT_DIR"/"${TEST_NAME}".xml
cp "$TEST_DIR"/result/output.xml "$ALL_RESULT_DIR"/"${TEST_NAME}".xml || true
mkdir -p "$ALL_RESULT_DIR"/"${TEST_NAME}"
mv "$TEST_DIR"/logs/*log "$ALL_RESULT_DIR"/"${TEST_NAME}"/
mv "$TEST_DIR"/logs/*log "$ALL_RESULT_DIR"/"${TEST_NAME}"/ || true

if [[ "${RESULT}" == "1" ]] && [[ "${FAIL_FAST:-}" == "true" ]]; then
break
fi
done

rebot -N "smoketests" -d "$ALL_RESULT_DIR/" "$ALL_RESULT_DIR/*.xml"

exit ${RESULT}

0 comments on commit 99fd5fc

Please sign in to comment.