[e2e tests] Add an option to skip the env setup script when running tests (#50620)

Add the -x option to skip executing the env setup script
This commit is contained in:
Adrian Moldovan 2024-08-13 14:03:10 +01:00 committed by GitHub
parent 3a363d232b
commit f91bcf44c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
E2E tests: add an option to skip the env setup script running before test execution

View File

@ -2,6 +2,22 @@
set -eo pipefail
skipEnvSetup=False
while getopts "x" opt; do
case $opt in
x)
skipEnvSetup=True
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
envName=$1
shift
@ -12,7 +28,6 @@ SCRIPT_PATH=$(
echo "Setting up environment: $envName"
if [ -f "$SCRIPT_PATH/envs/$envName/.env.enc" ]; then
echo "Found encrypted .env file for environment '$envName'"
"$SCRIPT_PATH/bin/dotenv.sh" -d "$envName"
@ -22,7 +37,12 @@ else
rm -f "$SCRIPT_PATH/.env"
fi
"$SCRIPT_PATH/envs/$envName/env-setup.sh"
if [ "$skipEnvSetup" == "True" ]; then
echo "Skipping environment setup"
else
echo "Executing environment setup script(s)"
"$SCRIPT_PATH/envs/$envName/env-setup.sh"
fi
echo "Running tests with environment: '$envName'"
echo "Arguments: $*"