Skip to content

Commit 98d3f77

Browse files
committed
chore: improve and document testing against different images
1 parent 6e80723 commit 98d3f77

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ jobs:
3939
script:
4040
- pip3 install tox
4141
- tox -e py_func_v4
42+
- stage: test
43+
name: cli_func_nightly
44+
dist: bionic
45+
python: 3.8
46+
env: GITLAB_TAG=nightly
47+
script:
48+
- pip3 install tox
49+
- tox -e cli_func_v4
50+
- stage: test
51+
name: py_func_nightly
52+
dist: bionic
53+
python: 3.8
54+
env: GITLAB_TAG=nightly
55+
script:
56+
- pip3 install tox
57+
- tox -e py_func_v4
4258
- stage: test
4359
name: docs
4460
dist: bionic
@@ -67,3 +83,5 @@ jobs:
6783
script:
6884
- pip3 install tox
6985
- tox -e py38
86+
allow_failures:
87+
- env: IMAGE_TAG=nightly

README.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,26 @@ To run these tests:
156156
# run the python API tests:
157157
./tools/py_functional_tests.sh
158158
159+
By default, the tests run against the ``gitlab/gitlab-ce:latest`` image. You can
160+
override both the image and tag with the ``-i`` and ``-t`` options, or by providing
161+
either the ``GITLAB_IMAGE`` or ``GITLAB_TAG`` environment variables.
162+
163+
This way you can run tests against different versions, such as ``nightly`` for
164+
features in an upcoming release, or an older release (e.g. ``12.8.0-ce.0``).
165+
The tag must match an exact tag on Docker Hub:
166+
167+
.. code-block:: bash
168+
169+
# run tests against `nightly` or specific tag
170+
./tools/py_functional_tests.sh -t nightly
171+
./tools/py_functional_tests.sh -t 12.8.0-ce.0
172+
173+
# run tests against the latest gitlab EE image
174+
./tools/py_functional_tests.sh -i gitlab/gitlab-ee
175+
176+
# override tags with environment variables
177+
GITLAB_TAG=nightly ./tools/py_functional_tests.sh
178+
159179
You can also build a test environment using the following command:
160180

161181
.. code-block:: bash

tools/build_test_env.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ try() { "$@" || fatal "'$@' failed"; }
2828
REUSE_CONTAINER=
2929
NOVENV=
3030
API_VER=4
31-
GITLAB_IMAGE="gitlab/gitlab-ce"
32-
GITLAB_TAG="latest"
31+
GITLAB_IMAGE="${GITLAB_IMAGE:-gitlab/gitlab-ce}"
32+
GITLAB_TAG="${GITLAB_TAG:-latest}"
3333
VENV_CMD="python3 -m venv"
34-
while getopts :knp:a: opt "$@"; do
34+
while getopts :knp:a:i:t: opt "$@"; do
3535
case $opt in
3636
k) REUSE_CONTAINER=1;;
3737
n) NOVENV=1;;
3838
a) API_VER=$OPTARG;;
39+
i) GITLAB_IMAGE=$OPTARG;;
3940
t) GITLAB_TAG=$OPTARG;;
4041
:) fatal "Option -${OPTARG} requires a value";;
4142
'?') fatal "Unknown option: -${OPTARG}";;

0 commit comments

Comments
 (0)