From 43c9dbcd554878df8c251a0c5b680b01d7aee7fb Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Wed, 8 Apr 2026 12:45:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test:=20fix=20BDD=20test=20scrip?= =?UTF-8?q?t=20to=20use=20portable=20directory=20navigation=20and=20proper?= =?UTF-8?q?=20database=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/run-bdd-tests.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/run-bdd-tests.sh b/scripts/run-bdd-tests.sh index 6f369e0..2361545 100755 --- a/scripts/run-bdd-tests.sh +++ b/scripts/run-bdd-tests.sh @@ -80,6 +80,20 @@ else fi # Run the BDD tests +# For local environment, set database environment variables to use localhost +# For CI environment, the database is already configured as a service +if [ -z "$GITHUB_ACTIONS" ] && [ -z "$GITEA_ACTIONS" ]; then + echo "🔧 Setting database environment variables for local environment..." + export DLC_DATABASE_HOST="localhost" + export DLC_DATABASE_PORT="5432" + export DLC_DATABASE_USER="postgres" + export DLC_DATABASE_PASSWORD="postgres" + export DLC_DATABASE_NAME="dance_lessons_coach_bdd_test" + export DLC_DATABASE_SSL_MODE="disable" +else + echo "🏗️ CI environment detected, using service configuration" +fi + test_output=$(go test ./features/... -v 2>&1) test_exit_code=$? @@ -109,5 +123,6 @@ if [ $test_exit_code -eq 0 ]; then exit 0 else echo "❌ BDD tests failed" + echo echo 'DLC_DATABASE_HOST=localhost DLC_DATABASE_PORT=5432 DLC_DATABASE_USER=postgres DLC_DATABASE_PASSWORD=postgres DLC_DATABASE_NAME=dance_lessons_coach_bdd_test DLC_DATABASE_SSL_MODE=disable go test ./features/... -v' exit 1 fi