Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,64 @@ This container expects /app/data to be a persistent, shared, writable
directory owned by uid 10001. This must be a shared (NFS/EFS/etc) volume
between all nodes.

## Running the Test Suites

The `docker/run-tests-in-docker.sh` script builds a test image and runs a
suite inside it. It takes a suite name as its first argument, or prompts
with a menu if run with no arguments.

| Option | Suite | What it runs |
| --- | --- | --- |
| sanity | `test_sanity` | Static and style checks under `t/` |
| mysql | `test_bmo` | Perl suite (`t/bmo/*.t`) against MySQL. Default. |
| pg | `test_bmo` | Perl suite against PostgreSQL |
| sqlite | `test_bmo` | Perl suite against SQLite |
| mariadb | `test_bmo` | Perl suite against MariaDB |
| selenium | `test_selenium` | Browser suite (`qa/t/test_*.t`) |
| webservices | `test_webservices` | API suite (`qa/t/{webservice,rest}_*.t`) |
| release | `test_bmo` | Release checks |

Example:

``` bash
bash docker/run-tests-in-docker.sh selenium
```

### Selenium and webservice suites

Both suites are driven by `scripts/entrypoint.pl`, which loads test data,
starts httpd inside the container, and then runs `prove` against
`/app/qa/t`. They use the MySQL compose stack
(`docker-compose.test-mysql.yml`), which adds a
`selenium/standalone-firefox:3.141.59` service with a 512m `shm_size`.
The browser is reached over `TWD_HOST`, `TWD_PORT` and `TWD_BROWSER`,
with QA configuration read from `.github/selenium_test.conf`.

These suites are intentionally not part of the GitHub Actions workflow.
The full browser run takes roughly 30 minutes, which is too slow for a
merge gate, so it stays available through the container only.

`test_selenium` and `test_webservices` take no file arguments, so they
always run their full glob. A single file can be run with `prove`
directly, but the QA tests require the httpd and the loaded test data
that these commands set up, so a bare single-file run will fail unless
that environment is already in place.

### Known failures

- `qa/t/test_create_user_accounts.t` exercises the account creation
flow that is being reworked to separate login names from email
addresses. Failures there are expected until that work lands.

- `qa/t/test_edit_products_properties.t` has been seen to fail one
assertion intermittently while the product change it checks is
recorded correctly in the audit log. Re-run before investigating.






## Administrative Tasks

### Generating cpanfile and cpanfile.snapshot files
Expand Down
28 changes: 20 additions & 8 deletions docker/run-tests-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,25 @@ DEFAULT_TEST_ARGS=(-q -f t/bmo/*.t)
SUITE_ARGS=()
if [ "$#" -eq 0 ]; then
echo "Available test options:"
echo " 1) sanity - Run sanity tests"
echo " 2) mysql - Run BMO tests with MySQL (default)"
echo " 3) pg - Run BMO tests with PostgreSQL"
echo " 4) sqlite - Run BMO tests with SQLite"
echo " 5) mariadb - Run BMO tests with MariaDB"
echo " 6) release - Run release tests"
echo " 1) sanity - Run sanity tests"
echo " 2) mysql - Run BMO tests with MySQL (default)"
echo " 3) pg - Run BMO tests with PostgreSQL"
echo " 4) sqlite - Run BMO tests with SQLite"
echo " 5) mariadb - Run BMO tests with MariaDB"
echo " 6) release - Run release tests"
echo " 7) selenium - Run Selenium tests (qa/t/test_*.t)"
echo " 8) webservices - Run webservice/REST tests (qa/t/{webservice,rest}_*.t)"
echo
read -rp "Select a test option (1-6, default is mysql): " choice
read -rp "Select a test option (1-8, default is mysql): " choice
case "$choice" in
1) set -- "sanity" ;;
2|"") set -- "mysql" ;;
3) set -- "pg" ;;
4) set -- "sqlite" ;;
5) set -- "mariadb" ;;
6) set -- "release" ;;
7) set -- "selenium" ;;
8) set -- "webservices" ;;
*) echo "Invalid choice. Using default (mysql)"; set -- "mysql" ;;
esac
fi
Expand All @@ -53,6 +57,14 @@ elif [ "$SUITE" == "sqlite" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-sqlite.yml
elif [ "$SUITE" == "mariadb" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-mariadb.yml
elif [ "$SUITE" == "selenium" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
TEST_NAME="test_selenium"
DEFAULT_TEST_ARGS=()
elif [ "$SUITE" == "webservices" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
TEST_NAME="test_webservices"
DEFAULT_TEST_ARGS=()
elif [ "$SUITE" == "release" ]; then
DOCKER_FILE=docker/images/Dockerfile.perl-testsuite
if $DOCKER build -t bugzilla-release-test -f "$DOCKER_FILE" .; then
Expand All @@ -63,7 +75,7 @@ elif [ "$SUITE" == "release" ]; then
exit $?
else
echo "Unknown test suite: $SUITE"
echo "Usage: $0 [sanity|mysql|pg|sqlite|mariadb|release] [suite args...]"
echo "Usage: $0 [sanity|mysql|pg|sqlite|mariadb|selenium|webservices|release] [suite args...]"
exit 1
fi

Expand Down
Loading