2021-04-29 23:27:03 -07:00
|
|
|
#!/bin/bash
|
2021-06-14 17:15:24 -07:00
|
|
|
set -euxo pipefail
|
2021-04-29 23:27:03 -07:00
|
|
|
|
|
|
|
# Runs a basic e2e test. It is not meant to be fully comprehensive,
|
|
|
|
# but rather should catch obvious bugs before they make it into prod.
|
|
|
|
#
|
|
|
|
# Script assumptions:
|
|
|
|
# - The gradle build has already been run.
|
2021-06-14 17:15:24 -07:00
|
|
|
# - Python 3.6+ is installed and in the PATH.
|
2021-04-29 23:27:03 -07:00
|
|
|
|
2022-05-09 19:49:57 -07:00
|
|
|
# Log the locally loaded images
|
2022-05-10 18:24:27 -07:00
|
|
|
# docker images | grep "datahub-"
|
2021-04-29 23:27:03 -07:00
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
cd "$DIR"
|
2022-12-27 00:08:01 +05:30
|
|
|
if [ "${RUN_QUICKSTART:-true}" == "true" ]; then
|
|
|
|
source ./run-quickstart.sh
|
2024-08-13 15:53:23 -05:00
|
|
|
else
|
|
|
|
mkdir -p ~/.datahub/plugins/frontend/auth/
|
|
|
|
echo "test_user:test_pass" >> ~/.datahub/plugins/frontend/auth/user.props
|
|
|
|
echo "datahub:datahub" > ~/.datahub/plugins/frontend/auth/user.props
|
|
|
|
|
2025-04-07 23:21:03 +05:30
|
|
|
|
2024-08-13 15:53:23 -05:00
|
|
|
python3 -m venv venv
|
2024-12-27 13:50:28 -05:00
|
|
|
set +x
|
2024-08-13 15:53:23 -05:00
|
|
|
source venv/bin/activate
|
2024-12-27 13:50:28 -05:00
|
|
|
set -x
|
2024-09-08 04:59:58 -07:00
|
|
|
python -m pip install --upgrade 'uv>=0.1.10'
|
2024-08-13 15:53:23 -05:00
|
|
|
uv pip install -r requirements.txt
|
2022-12-27 00:08:01 +05:30
|
|
|
fi
|
2022-11-03 22:53:49 +05:30
|
|
|
|
2022-07-14 22:04:06 +05:30
|
|
|
(cd ..; ./gradlew :smoke-test:yarnInstall)
|
2021-12-13 23:08:30 -08:00
|
|
|
|
2023-02-27 19:06:16 +05:30
|
|
|
source ./set-cypress-creds.sh
|
2022-11-05 03:08:51 +05:30
|
|
|
|
2024-08-13 15:53:23 -05:00
|
|
|
# set environment variables for the test
|
|
|
|
source ./set-test-env-vars.sh
|
2024-07-26 11:15:46 -07:00
|
|
|
|
2025-04-07 10:13:07 +05:30
|
|
|
echo "TEST_STRATEGY: $TEST_STRATEGY, BATCH_COUNT: $BATCH_COUNT, BATCH_NUMBER: $BATCH_NUMBER"
|
|
|
|
|
2024-12-26 21:22:16 +05:30
|
|
|
# TEST_STRATEGY:
|
|
|
|
# if set to pytests, runs all pytests, skips cypress tests(though cypress test launch is via a pytest).
|
|
|
|
# if set tp cypress, runs all cypress tests
|
|
|
|
# if blank, runs all.
|
2025-04-07 10:13:07 +05:30
|
|
|
# When invoked via the github action, BATCH_COUNT and BATCH_NUMBER env vars are set to run a slice of those tests per
|
2024-12-26 21:22:16 +05:30
|
|
|
# worker for parallelism. docker-unified.yml generates a test matrix of pytests/cypress in batches. As number of tests
|
|
|
|
# increase, the batch_count config (in docker-unified.yml) may need adjustment.
|
|
|
|
if [[ "${TEST_STRATEGY}" == "pytests" ]]; then
|
|
|
|
#pytests only - github test matrix runs pytests in one of the runners when applicable.
|
|
|
|
pytest -rP --durations=20 -vv --continue-on-collection-errors --junit-xml=junit.smoke-pytests.xml -k 'not test_run_cypress'
|
|
|
|
elif [[ "${TEST_STRATEGY}" == "cypress" ]]; then
|
|
|
|
# run only cypress tests. The test inspects BATCH_COUNT and BATCH_NUMBER and runs only a subset of tests in that batch.
|
|
|
|
# github workflow test matrix will invoke this in multiple runners for each batch.
|
2025-03-13 21:05:45 +05:30
|
|
|
# Skipping the junit at the pytest level since cypress itself generates junits on a per-test basis. The pytest is a single test for all cypress
|
|
|
|
# tests and isnt very helpful.
|
2025-04-07 10:13:07 +05:30
|
|
|
pytest -rP --durations=20 -vvs --continue-on-collection-errors tests/cypress/integration_test.py
|
2022-12-27 00:08:01 +05:30
|
|
|
else
|
2025-04-07 10:13:07 +05:30
|
|
|
pytest -rP --durations=20 -vvs --continue-on-collection-errors --junit-xml=junit.smoke-all.xml
|
2022-12-27 00:08:01 +05:30
|
|
|
fi
|