Skip to content

Commit 4b0c2e9

Browse files
committed
Fix CI test failure: Make install-wp-tests.sh non-interactive
The script was prompting for user input when the test database already exists, causing CI to fail. This commit adds a check for CI environment ( variable) or non-interactive shell (! -t 0) and automatically proceeds with database recreation in those cases. Fixes the Code Coverage Check failure on PR #700.
1 parent 56c0de7 commit 4b0c2e9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/bin/install-wp-tests.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,13 @@ install_db() {
193193
if [ $(mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ]
194194
then
195195
echo "Reinstalling will delete the existing test database ($DB_NAME)"
196-
read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB
196+
# In CI or non-interactive environments, automatically proceed with recreation
197+
if [ -n "$CI" ] || [ ! -t 0 ]; then
198+
echo "Running in CI or non-interactive mode, automatically recreating database..."
199+
DELETE_EXISTING_DB="y"
200+
else
201+
read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB
202+
fi
197203
recreate_db $DELETE_EXISTING_DB
198204
else
199205
create_db

0 commit comments

Comments
 (0)