Skip to content

Commit 04d962a

Browse files
authored
Bug 1851435: document test suites and add selenium/webservices options to run-tests-in-docker.sh (#188)
1 parent ffbdc92 commit 04d962a

2 files changed

Lines changed: 78 additions & 8 deletions

File tree

‎docker/README.md‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,64 @@ This container expects /app/data to be a persistent, shared, writable
226226
directory owned by uid 10001. This must be a shared (NFS/EFS/etc) volume
227227
between all nodes.
228228

229+
## Running the Test Suites
230+
231+
The `docker/run-tests-in-docker.sh` script builds a test image and runs a
232+
suite inside it. It takes a suite name as its first argument, or prompts
233+
with a menu if run with no arguments.
234+
235+
| Option | Suite | What it runs |
236+
| --- | --- | --- |
237+
| sanity | `test_sanity` | Static and style checks under `t/` |
238+
| mysql | `test_bmo` | Perl suite (`t/bmo/*.t`) against MySQL. Default. |
239+
| pg | `test_bmo` | Perl suite against PostgreSQL |
240+
| sqlite | `test_bmo` | Perl suite against SQLite |
241+
| mariadb | `test_bmo` | Perl suite against MariaDB |
242+
| selenium | `test_selenium` | Browser suite (`qa/t/test_*.t`) |
243+
| webservices | `test_webservices` | API suite (`qa/t/{webservice,rest}_*.t`) |
244+
| release | `test_bmo` | Release checks |
245+
246+
Example:
247+
248+
``` bash
249+
bash docker/run-tests-in-docker.sh selenium
250+
```
251+
252+
### Selenium and webservice suites
253+
254+
Both suites are driven by `scripts/entrypoint.pl`, which loads test data,
255+
starts httpd inside the container, and then runs `prove` against
256+
`/app/qa/t`. They use the MySQL compose stack
257+
(`docker-compose.test-mysql.yml`), which adds a
258+
`selenium/standalone-firefox:3.141.59` service with a 512m `shm_size`.
259+
The browser is reached over `TWD_HOST`, `TWD_PORT` and `TWD_BROWSER`,
260+
with QA configuration read from `.github/selenium_test.conf`.
261+
262+
These suites are intentionally not part of the GitHub Actions workflow.
263+
The full browser run takes roughly 30 minutes, which is too slow for a
264+
merge gate, so it stays available through the container only.
265+
266+
`test_selenium` and `test_webservices` take no file arguments, so they
267+
always run their full glob. A single file can be run with `prove`
268+
directly, but the QA tests require the httpd and the loaded test data
269+
that these commands set up, so a bare single-file run will fail unless
270+
that environment is already in place.
271+
272+
### Known failures
273+
274+
- `qa/t/test_create_user_accounts.t` exercises the account creation
275+
flow that is being reworked to separate login names from email
276+
addresses. Failures there are expected until that work lands.
277+
278+
- `qa/t/test_edit_products_properties.t` has been seen to fail one
279+
assertion intermittently while the product change it checks is
280+
recorded correctly in the audit log. Re-run before investigating.
281+
282+
283+
284+
285+
286+
229287
## Administrative Tasks
230288

231289
### Generating cpanfile and cpanfile.snapshot files

‎docker/run-tests-in-docker.sh‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,25 @@ DEFAULT_TEST_ARGS=(-q -f t/bmo/*.t)
2020
SUITE_ARGS=()
2121
if [ "$#" -eq 0 ]; then
2222
echo "Available test options:"
23-
echo " 1) sanity - Run sanity tests"
24-
echo " 2) mysql - Run BMO tests with MySQL (default)"
25-
echo " 3) pg - Run BMO tests with PostgreSQL"
26-
echo " 4) sqlite - Run BMO tests with SQLite"
27-
echo " 5) mariadb - Run BMO tests with MariaDB"
28-
echo " 6) release - Run release tests"
23+
echo " 1) sanity - Run sanity tests"
24+
echo " 2) mysql - Run BMO tests with MySQL (default)"
25+
echo " 3) pg - Run BMO tests with PostgreSQL"
26+
echo " 4) sqlite - Run BMO tests with SQLite"
27+
echo " 5) mariadb - Run BMO tests with MariaDB"
28+
echo " 6) release - Run release tests"
29+
echo " 7) selenium - Run Selenium tests (qa/t/test_*.t)"
30+
echo " 8) webservices - Run webservice/REST tests (qa/t/{webservice,rest}_*.t)"
2931
echo
30-
read -rp "Select a test option (1-6, default is mysql): " choice
32+
read -rp "Select a test option (1-8, default is mysql): " choice
3133
case "$choice" in
3234
1) set -- "sanity" ;;
3335
2|"") set -- "mysql" ;;
3436
3) set -- "pg" ;;
3537
4) set -- "sqlite" ;;
3638
5) set -- "mariadb" ;;
3739
6) set -- "release" ;;
40+
7) set -- "selenium" ;;
41+
8) set -- "webservices" ;;
3842
*) echo "Invalid choice. Using default (mysql)"; set -- "mysql" ;;
3943
esac
4044
fi
@@ -53,6 +57,14 @@ elif [ "$SUITE" == "sqlite" ]; then
5357
DOCKER_COMPOSE_FILE=docker-compose.test-sqlite.yml
5458
elif [ "$SUITE" == "mariadb" ]; then
5559
DOCKER_COMPOSE_FILE=docker-compose.test-mariadb.yml
60+
elif [ "$SUITE" == "selenium" ]; then
61+
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
62+
TEST_NAME="test_selenium"
63+
DEFAULT_TEST_ARGS=()
64+
elif [ "$SUITE" == "webservices" ]; then
65+
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
66+
TEST_NAME="test_webservices"
67+
DEFAULT_TEST_ARGS=()
5668
elif [ "$SUITE" == "release" ]; then
5769
DOCKER_FILE=docker/images/Dockerfile.perl-testsuite
5870
if $DOCKER build -t bugzilla-release-test -f "$DOCKER_FILE" .; then
@@ -63,7 +75,7 @@ elif [ "$SUITE" == "release" ]; then
6375
exit $?
6476
else
6577
echo "Unknown test suite: $SUITE"
66-
echo "Usage: $0 [sanity|mysql|pg|sqlite|mariadb|release] [suite args...]"
78+
echo "Usage: $0 [sanity|mysql|pg|sqlite|mariadb|selenium|webservices|release] [suite args...]"
6779
exit 1
6880
fi
6981

0 commit comments

Comments
 (0)