Skip to content

Commit cc1abb2

Browse files
Add example services as a submodule
Add example services as a submodule and include it in the system tests docker compose file, rewrite the system test docs to make use of this. The system tests will now be easier to run and debug locally, since this automates a lot of the setup and tear down process.
1 parent 4cba476 commit cc1abb2

6 files changed

Lines changed: 30 additions & 26 deletions

File tree

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,3 @@ lockfiles/
7171

7272
# Editor/IDE project files
7373
.idea/
74-
75-
# Example IOCs
76-
example-services/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "example-services"]
2+
path = example-services
3+
url = https://github.com/epics-containers/example-services.git

example-services

Submodule example-services added at 3c0274b

tests/system_tests/.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export EPICS_CA_NAME_SERVERS=127.0.0.1:9064
2+
export EPICS_PVA_NAME_SERVERS=127.0.0.1:9075
3+
export EPICS_CA_ADDR_LIST=127.0.0.1:9064
4+
5+
# default profile for compose project (I don't think this gets picked up)
6+
COMPOSE_PROFILES=test

tests/system_tests/compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
include:
2+
- ../../example-services/compose.yaml
3+
14
services:
25
numtracker:
36
image: ghcr.io/diamondlightsource/numtracker:1.0.1

tests/system_tests/test_blueapi_system.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,28 @@
5454
To enable and execute these tests, set `REQUIRES_AUTH=1` and provide valid credentials.
5555
"""
5656

57-
# These system tests are primarily intended to be run from the Github CI,
58-
# and therefore these instructions may require multiple terminals, running
59-
# outside of the officially support devcontainer and other inefficiencies.
57+
58+
# These system tests are run in the "system_tests" CI job, they can also be run
59+
# and debugged locally.
60+
#
61+
# 1. Spin up dummy versions of assocaited services
62+
# (outside of devcontainer)
63+
#
64+
# git submodule init
65+
# docker compose -f tests/system_tests/compose.yaml up -d
6066
#
61-
# Should the system tests CI fail, testing with a live blueapi server (e.g. with the
62-
# training rigs) may be a simpler solution than running the system tests locally.
63-
# The github action for the system tests are the best example to follow.
64-
# Start devices
65-
# 1. $ git clone https://github.com/epics-containers/example-services
66-
# 2. $ docker compose -f example-services/compose.yaml up \
67-
# bl01t-di-cam-01 bl01t-mo-sim-01 ca-gateway --detach
67+
# 2. Spin up blueapi server (inside devcontainer)
6868
#
69-
# Start services
70-
# in this directory (i.e. blueapi/tests/system_tests)
71-
# $ docker compose up --detach
69+
# source tests/system_tests/.env
70+
# blueapi -c tests/system_tests/config.yaml serve
7271
#
73-
# Start blueapi server configured to talk via the ca-gateway
74-
# $ EPICS_CA_NAME_SERVERS=127.0.0.1:9064 EPICS_PVA_NAME_SERVERS=127.0.0.1:9075 \
75-
# blueapi -c config.yaml serve
72+
# 3. Run the system tests
73+
# tox -e system-test
7674
#
77-
# Run the system tests using tox:
78-
# $ tox -e system-test
75+
# 4. To tear down the associated services
76+
# (outside of devcontainer)
7977
#
80-
# Tear down
81-
# Tear down blueapi by passing SIGINT in the console where it was started (ctrl+c)
82-
# Remove the containers and networking configured by the compose files:
83-
# $ docker compose -f example-services/compose.yaml down
84-
# $ docker compose down
78+
# docker compose -f tests/system_tests/compose.yaml down
8579

8680

8781
@pytest.fixture

0 commit comments

Comments
 (0)