HDDS-1716. Smoketest results are generated with an internal user
Closes #1002
This commit is contained in:
parent
aa9f0850e8
commit
75b1e458b1
|
@ -29,7 +29,7 @@ rm "$ALL_RESULT_DIR/*"
|
|||
RESULT=0
|
||||
IFS=$'\n'
|
||||
# shellcheck disable=SC2044
|
||||
for test in $(find $SCRIPT_DIR -name test.sh); do
|
||||
for test in $(find "$SCRIPT_DIR" -name test.sh); do
|
||||
echo "Executing test in $(dirname "$test")"
|
||||
|
||||
#required to read the .env file from the right location
|
||||
|
@ -43,5 +43,5 @@ for test in $(find $SCRIPT_DIR -name test.sh); do
|
|||
cp "$RESULT_DIR"/robot-*.xml "$ALL_RESULT_DIR"
|
||||
done
|
||||
|
||||
docker run --rm -v "$SCRIPT_DIR/result:/opt/result" apache/ozone-runner rebot -N "smoketests" -d "/opt/result" "/opt/result/robot-*.xml"
|
||||
rebot -N "smoketests" -d "$SCRIPT_DIR/result" "$SCRIPT_DIR/result/robot-*.xml"
|
||||
exit $RESULT
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
COMPOSE_ENV_NAME=$(basename "$COMPOSE_DIR")
|
||||
COMPOSE_FILE=$COMPOSE_DIR/docker-compose.yaml
|
||||
RESULT_DIR="$COMPOSE_DIR/result"
|
||||
RESULT_DIR_INSIDE="${OZONE_DIR:-/opt/hadoop}/compose/$(basename "$COMPOSE_ENV_NAME")/result"
|
||||
RESULT_DIR=${RESULT_DIR:-"$COMPOSE_DIR/result"}
|
||||
RESULT_DIR_INSIDE="/tmp/smoketest/$(basename "$COMPOSE_ENV_NAME")/result"
|
||||
SMOKETEST_DIR_INSIDE="${OZONE_DIR:-/opt/hadoop}/smoketest"
|
||||
|
||||
#delete previous results
|
||||
|
@ -75,10 +74,15 @@ execute_robot_test(){
|
|||
CONTAINER="$1"
|
||||
TEST="$2"
|
||||
TEST_NAME=$(basename "$TEST")
|
||||
TEST_NAME=${TEST_NAME%.*}
|
||||
TEST_NAME="$(basename "$COMPOSE_DIR")-${TEST_NAME%.*}"
|
||||
set +e
|
||||
OUTPUT_NAME="$COMPOSE_ENV_NAME-$TEST_NAME-$CONTAINER"
|
||||
docker-compose -f "$COMPOSE_FILE" exec -e SECURITY_ENABLED="${SECURITY_ENABLED}" -T "$CONTAINER" python -m robot --log NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$RESULT_DIR_INSIDE/robot-$OUTPUT_NAME.xml" "$SMOKETEST_DIR_INSIDE/$TEST"
|
||||
OUTPUT_PATH="$RESULT_DIR_INSIDE/robot-$OUTPUT_NAME.xml"
|
||||
docker-compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" mkdir -p "$RESULT_DIR_INSIDE"
|
||||
docker-compose -f "$COMPOSE_FILE" exec -e SECURITY_ENABLED="${SECURITY_ENABLED}" -T "$CONTAINER" python -m robot --log NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST"
|
||||
|
||||
FULL_CONTAINER_NAME=$(docker-compose -f "$COMPOSE_FILE" ps | grep "_${CONTAINER}_" | head -n 1 | awk '{print $1}')
|
||||
docker cp "$FULL_CONTAINER_NAME:$OUTPUT_PATH" "$RESULT_DIR/"
|
||||
set -e
|
||||
|
||||
}
|
||||
|
@ -93,6 +97,12 @@ stop_docker_env(){
|
|||
|
||||
## @description Generate robot framework reports based on the saved results.
|
||||
generate_report(){
|
||||
#Generate the combined output and return with the right exit code (note: robot = execute test, rebot = generate output)
|
||||
docker run --rm -v "$DIR/..:${OZONE_DIR:-/opt/hadoop}" apache/ozone-runner rebot -d "$RESULT_DIR_INSIDE" "$RESULT_DIR_INSIDE/robot-*.xml"
|
||||
|
||||
if command -v rebot > /dev/null 2>&1; then
|
||||
#Generate the combined output and return with the right exit code (note: robot = execute test, rebot = generate output)
|
||||
rebot -d "$RESULT_DIR" "$RESULT_DIR/robot-*.xml"
|
||||
else
|
||||
echo "Robot framework is not installed, the reports can be generated (sudo pip install robotframework)."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue