Skip to content

Commit 3579aa1

Browse files
authored
⚗️ CI: Use keep docker up in tests to improve test speed (ITISFoundation#3309)
1 parent ccec5a6 commit 3579aa1

File tree

32 files changed

+558
-480
lines changed

32 files changed

+558
-480
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 124 additions & 117 deletions
Large diffs are not rendered by default.

ci/github/integration-testing/director-v2.bash

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,23 @@ export DOCKER_IMAGE_TAG
1111

1212
install() {
1313
bash ci/helpers/ensure_python_pip.bash
14+
make devenv
15+
# shellcheck source=/dev/null
16+
source .venv/bin/activate
1417
pushd services/director-v2
15-
pip3 install -r requirements/ci.txt
18+
make install-ci
1619
popd
17-
pip list -v
20+
.venv/bin/pip list --verbose
1821
make pull-version || (make build tag-version)
1922
make info-images
2023
}
2124

2225
test() {
23-
echo "testing in services/director-v2/tests/integration/$1"
24-
pytest \
25-
--asyncio-mode=auto \
26-
--color=yes \
27-
--cov-append \
28-
--cov-config=.coveragerc \
29-
--cov-report=term-missing \
30-
--cov-report=xml \
31-
--cov=simcore_service_director_v2 \
32-
--durations=10 \
33-
--log-date-format="%Y-%m-%d %H:%M:%S" \
34-
--log-format="%(asctime)s %(levelname)s %(message)s" \
35-
--log-level=DEBUG \
36-
--verbose \
37-
-m "not heavy_load" \
38-
"services/director-v2/tests/integration/$1"
26+
# shellcheck source=/dev/null
27+
source .venv/bin/activate
28+
pushd services/director-v2
29+
make test-ci-integration test-subfolder="$1"
30+
popd
3931
}
4032

4133
clean_up() {

ci/github/integration-testing/simcore-sdk.bash

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,24 @@ export DOCKER_IMAGE_TAG
1010

1111
install() {
1212
bash ci/helpers/ensure_python_pip.bash
13+
make devenv
14+
# shellcheck source=/dev/null
15+
source .venv/bin/activate
1316
pushd packages/simcore-sdk
14-
pip3 install -r requirements/ci.txt
17+
make install-ci
1518
popd
16-
pip list -v
19+
.venv/bin/pip list --verbose
1720
# pull the test images if registry is set up, else build the images
1821
make pull-version || (make build tag-version)
1922
make info-images
2023
}
2124

2225
test() {
23-
pytest \
24-
--asyncio-mode=auto \
25-
--color=yes \
26-
--cov-append \
27-
--cov-config=.coveragerc \
28-
--cov-report=term-missing \
29-
--cov-report=xml \
30-
--cov=simcore_sdk \
31-
--durations=10 \
32-
--log-date-format="%Y-%m-%d %H:%M:%S" \
33-
--log-format="%(asctime)s %(levelname)s %(message)s" \
34-
--log-level=DEBUG \
35-
--verbose \
36-
-m "not heavy_load" \
37-
packages/simcore-sdk/tests/integration
26+
# shellcheck source=/dev/null
27+
source .venv/bin/activate
28+
pushd packages/simcore-sdk
29+
make tests-integration-ci
30+
popd
3831
}
3932

4033
clean_up() {

ci/github/integration-testing/webserver.bash

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,23 @@ export DOCKER_IMAGE_TAG
1111

1212
install() {
1313
bash ci/helpers/ensure_python_pip.bash
14+
make devenv
15+
# shellcheck source=/dev/null
16+
source .venv/bin/activate
1417
pushd services/web/server
15-
pip3 install -r requirements/ci.txt
18+
make install-ci
1619
popd
17-
pip list -v
20+
.venv/bin/pip list --verbose
1821
make pull-version || (make build tag-version)
1922
make info-images
2023
}
2124

2225
test() {
23-
pytest \
24-
--asyncio-mode=auto \
25-
--color=yes \
26-
--cov-append \
27-
--cov-config=.coveragerc \
28-
--cov-report=term-missing \
29-
--cov-report=xml \
30-
--cov=simcore_service_webserver \
31-
--durations=10 \
32-
--log-date-format="%Y-%m-%d %H:%M:%S" \
33-
--log-format="%(asctime)s %(levelname)s %(message)s" \
34-
--verbose \
35-
-m "not heavy_load" \
36-
"services/web/server/tests/integration/$1"
26+
# shellcheck source=/dev/null
27+
source .venv/bin/activate
28+
pushd services/web/server
29+
make test-ci-integration test-subfolder="$1"
30+
popd
3731
}
3832

3933
clean_up() {

ci/github/unit-testing/api-server.bash

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,21 @@ IFS=$'\n\t'
77

88
install() {
99
bash ci/helpers/ensure_python_pip.bash
10+
make devenv
11+
# shellcheck source=/dev/null
12+
source .venv/bin/activate
1013
pushd services/api-server
11-
pip3 install -r requirements/ci.txt
14+
make install-ci
1215
popd
13-
pip list --verbose
16+
.venv/bin/pip list --verbose
1417
}
1518

1619
test() {
17-
pytest \
18-
--asyncio-mode=auto \
19-
--color=yes \
20-
--cov-append \
21-
--cov-config=.coveragerc \
22-
--cov-report=term-missing \
23-
--cov-report=xml \
24-
--cov=simcore_service_api_server \
25-
--durations=10 \
26-
--log-date-format="%Y-%m-%d %H:%M:%S" \
27-
--log-format="%(asctime)s %(levelname)s %(message)s" \
28-
--verbose \
29-
-m "not heavy_load" \
30-
services/api-server/tests/unit
20+
# shellcheck source=/dev/null
21+
source .venv/bin/activate
22+
pushd services/api-server
23+
make test-ci-unit
24+
popd
3125
}
3226

3327
# Check if the function exists (bash specific)

ci/github/unit-testing/catalog.bash

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,21 @@ IFS=$'\n\t'
77

88
install() {
99
bash ci/helpers/ensure_python_pip.bash
10+
make devenv
11+
# shellcheck source=/dev/null
12+
source .venv/bin/activate
1013
pushd services/catalog
11-
pip3 install -r requirements/ci.txt
14+
make install-ci
1215
popd
13-
pip list --verbose
16+
.venv/bin/pip list --verbose
1417
}
1518

1619
test() {
17-
pytest \
18-
--asyncio-mode=auto \
19-
--color=yes \
20-
--cov-append \
21-
--cov-config=.coveragerc \
22-
--cov-report=term-missing \
23-
--cov-report=xml \
24-
--cov=simcore_service_catalog \
25-
--durations=10 \
26-
--log-date-format="%Y-%m-%d %H:%M:%S" \
27-
--log-format="%(asctime)s %(levelname)s %(message)s" \
28-
--verbose \
29-
-m "not heavy_load" \
30-
services/catalog/tests/unit
20+
# shellcheck source=/dev/null
21+
source .venv/bin/activate
22+
pushd services/catalog
23+
make test-ci-unit
24+
popd
3125
}
3226

3327
# Check if the function exists (bash specific)

ci/github/unit-testing/dask-sidecar.bash

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,21 @@ IFS=$'\n\t'
77

88
install() {
99
bash ci/helpers/ensure_python_pip.bash
10+
make devenv
11+
# shellcheck source=/dev/null
12+
source .venv/bin/activate
1013
pushd services/dask-sidecar
11-
pip3 install -r requirements/ci.txt
14+
make install-ci
1215
popd
13-
pip list -v
16+
.venv/bin/pip list --verbose
1417
}
1518

1619
test() {
17-
pytest \
18-
--asyncio-mode=auto \
19-
--color=yes \
20-
--cov-append \
21-
--cov-config=.coveragerc \
22-
--cov-report=term-missing \
23-
--cov-report=xml \
24-
--cov=simcore_service_dask_sidecar \
25-
--durations=10 \
26-
--log-date-format="%Y-%m-%d %H:%M:%S" \
27-
--log-format="%(asctime)s %(levelname)s %(message)s" \
28-
--verbose \
29-
-m "not heavy_load" \
30-
services/dask-sidecar/tests/unit
20+
# shellcheck source=/dev/null
21+
source .venv/bin/activate
22+
pushd services/dask-sidecar
23+
make test-ci-unit
24+
popd
3125
}
3226

3327
# Check if the function exists (bash specific)

ci/github/unit-testing/datcore-adapter.bash

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,21 @@ IFS=$'\n\t'
77

88
install() {
99
bash ci/helpers/ensure_python_pip.bash
10+
make devenv
11+
# shellcheck source=/dev/null
12+
source .venv/bin/activate
1013
pushd services/datcore-adapter
11-
pip3 install -r requirements/ci.txt
14+
make install-ci
1215
popd
13-
pip list --verbose
16+
.venv/bin/pip list --verbose
1417
}
1518

1619
test() {
17-
pytest \
18-
--asyncio-mode=auto \
19-
--color=yes \
20-
--cov-append \
21-
--cov-config=.coveragerc \
22-
--cov-report=term-missing \
23-
--cov-report=xml \
24-
--cov=simcore_service_datcore_adapter \
25-
--durations=10 \
26-
--log-date-format="%Y-%m-%d %H:%M:%S" \
27-
--log-format="%(asctime)s %(levelname)s %(message)s" \
28-
--numprocesses=auto \
29-
--verbose \
30-
-m "not heavy_load" \
31-
services/datcore-adapter/tests/unit
20+
# shellcheck source=/dev/null
21+
source .venv/bin/activate
22+
pushd services/datcore-adapter
23+
make test-ci-unit pytest-parameters="--numprocesses=auto"
24+
popd
3225
}
3326

3427
# Check if the function exists (bash specific)

ci/github/unit-testing/director-v2.bash

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,24 @@ IFS=$'\n\t'
77

88
install() {
99
bash ci/helpers/ensure_python_pip.bash
10+
make devenv
11+
# shellcheck source=/dev/null
12+
source .venv/bin/activate
1013
pushd services/director-v2
11-
pip3 install -r requirements/ci.txt
14+
make install-ci
1215
popd
13-
pip list --verbose
16+
.venv/bin/pip list --verbose
1417
}
1518

1619
test() {
20+
# shellcheck source=/dev/null
21+
source .venv/bin/activate
1722
# tests without DB can be safely run in parallel
18-
pytest \
19-
--asyncio-mode=auto \
20-
--color=yes \
21-
--cov-append \
22-
--cov-config=.coveragerc \
23-
--cov-report=term-missing \
24-
--cov-report=xml \
25-
--cov=simcore_service_director_v2 \
26-
--durations=10 \
27-
--ignore-glob=**/with_dbs/** \
28-
--log-date-format="%Y-%m-%d %H:%M:%S" \
29-
--log-format="%(asctime)s %(levelname)s %(message)s" \
30-
--numprocesses=auto \
31-
--verbose \
32-
-m "not heavy_load" \
33-
services/director-v2/tests/unit
34-
23+
pushd services/director-v2
24+
make test-ci-unit pytest-parameters="--numprocesses=auto --ignore-glob=**/with_dbs/**"
3525
# these tests cannot be run in parallel
36-
pytest \
37-
--asyncio-mode=auto \
38-
--color=yes \
39-
--cov-append \
40-
--cov-config=.coveragerc \
41-
--cov-report=term-missing \
42-
--cov-report=xml \
43-
--cov=simcore_service_director_v2 \
44-
--durations=10 \
45-
--log-date-format="%Y-%m-%d %H:%M:%S" \
46-
--log-format="%(asctime)s %(levelname)s %(message)s" \
47-
--verbose \
48-
-m "not heavy_load" \
49-
services/director-v2/tests/unit/with_dbs
26+
make test-ci-unit test-subfolder=with_dbs
27+
popd
5028
}
5129

5230
# Check if the function exists (bash specific)

ci/github/unit-testing/director.bash

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,38 @@ install() {
1414
python -m ensurepip
1515

1616
echo "INFO:" "$(pip --version)" "@" "$(command -v pip)"
17-
1817
# NOTE: pip<22.0 for python 3.6
1918
pip3 install --upgrade \
2019
pip~=21.0 \
2120
wheel \
2221
setuptools
22+
python3 -m venv .venv
23+
# shellcheck source=/dev/null
24+
source .venv/bin/activate
2325
pushd services/director
2426
pip3 install -r requirements/ci.txt
2527
popd
26-
pip list -v
28+
.venv/bin/pip list --verbose
2729
}
2830

2931
test() {
32+
# shellcheck source=/dev/null
33+
source .venv/bin/activate
34+
pushd services/director
3035
pytest \
31-
--color=yes \
32-
--cov-append \
33-
--cov-config=.coveragerc \
34-
--cov-report=term-missing \
35-
--cov-report=xml \
36-
--cov=simcore_service_director \
37-
--durations=10 \
38-
--log-date-format="%Y-%m-%d %H:%M:%S" \
36+
--color=yes \
37+
--cov-append \
38+
--cov-config=.coveragerc \
39+
--cov-report=term-missing \
40+
--cov-report=xml \
41+
--cov=simcore_service_director \
42+
--durations=10 \
43+
--keep-docker-up \
44+
--log-date-format="%Y-%m-%d %H:%M:%S" \
3945
--log-format="%(asctime)s %(levelname)s %(message)s" \
40-
--verbose \
41-
-m "not heavy_load" \
42-
services/director/tests
46+
--verbose \
47+
tests/
48+
popd
4349
}
4450

4551
# Check if the function exists (bash specific)

0 commit comments

Comments
 (0)