Skip to content

Commit

Permalink
Use node group instead of node uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
dmironov-wallarm committed Nov 11, 2024
1 parent 95f2885 commit 6ddbad6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 5 additions & 3 deletions test/docker-compose.split.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ services:
environment:
WALLARM_API_HOST: ${WALLARM_API_HOST}
WALLARM_API_CA_VERIFY: ${WALLARM_API_CA_VERIFY:-true}
WALLARM_API_TOKEN: ${WALLARM_API_TOKEN}
WALLARM_API_TOKEN: ${USER_TOKEN}
POSTANALYTIC_ADDRESS: post-analytics
WALLARM_LABELS: ${WALLARM_LABELS:-'group=defaultDockerNode'}
NODE_GROUP_NAME: ${NODE_GROUP_NAME}
WALLARM_LABELS: "group=${NODE_GROUP_NAME}"
healthcheck:
test: bash -c '[ -f /opt/wallarm/etc/wallarm/node.yaml ]'
timeout: 5s
Expand All @@ -24,7 +25,7 @@ services:
environment:
WALLARM_API_HOST: ${WALLARM_API_HOST}
WALLARM_API_CA_VERIFY: ${WALLARM_API_CA_VERIFY:-true}
WALLARM_API_TOKEN: ${WALLARM_API_TOKEN}
WALLARM_API_TOKEN: ${USER_TOKEN}
POSTANALYTIC_ONLY: true
WALLARM_LABELS: ${WALLARM_LABELS}
healthcheck:
Expand All @@ -35,6 +36,7 @@ services:
pytest:
image: dkr.wallarm.com/tests/smoke-tests:latest
environment:
NODE_GROUP_NAME: ${NODE_GROUP_NAME}
WALLARM_API_HOST: ${WALLARM_API_HOST}
WALLARM_API_PRESET: ${WALLARM_API_PRESET:-audit}
WALLARM_API_CA_VERIFY: ${WALLARM_API_CA_VERIFY:-true}
Expand Down
10 changes: 2 additions & 8 deletions test/smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ NODE_MODE=$1
LOGS_DIR="${PWD}/test/logs/${NODE_MODE}"

COMPOSE_CMD="NODE_IMAGE=$IMAGE docker-compose -p $NODE_MODE -f test/docker-compose.$NODE_MODE.yaml"
NODE_GROUP_NAME="github-docker-$(tr -dc A-Za-z0-9 </dev/urandom | head -c 12; echo)"

echo "Staring Docker compose in ${NODE_MODE} mode ..."
eval "$COMPOSE_CMD up -d --wait --quiet-pull"
Expand All @@ -115,13 +116,6 @@ if [ "$ALLURE_UPLOAD_REPORT" = "true" ]; then
RUN_TESTS="pytest allurectl watch --job-uid $RAND_NUM -- pytest"
fi

echo "Retrieving Wallarm Node UUID ..."
NODE_UUID=$(eval "$COMPOSE_CMD exec node cat /opt/wallarm/etc/wallarm/node.yaml | grep uuid | awk '{print \$2}'")
if [[ -z "${NODE_UUID}" ]]; then
echo -e "${RED}Failed to retrieve Wallarm Node UUID${NC}"
exit 1
fi

PYTEST_CMD="$COMPOSE_CMD exec $GITHUB_VARS -e NODE_UUID=$NODE_UUID $RUN_TESTS -n $PYTEST_WORKERS $PYTEST_ARGS"
PYTEST_CMD="$COMPOSE_CMD exec $GITHUB_VARS $RUN_TESTS -n $PYTEST_WORKERS $PYTEST_ARGS"
echo "Running tests ..."
eval $PYTEST_CMD

0 comments on commit 6ddbad6

Please sign in to comment.