Skip to content
Snippets Groups Projects
Commit 480cbcdb authored by Corné Lukken's avatar Corné Lukken
Browse files

Merge branch 'L2SS-589-integration-test-modules' into 'master'

Resolve L2SS-589 "Integration test modules"

Closes L2SS-589

See merge request !231
parents 91c2f0a3 d1b470f2
No related branches found
No related tags found
1 merge request!231Resolve L2SS-589 "Integration test modules"
Showing
with 33 additions and 12 deletions
...@@ -26,7 +26,7 @@ endif ...@@ -26,7 +26,7 @@ endif
# the host. # the host.
LOG_HOSTNAME ?= localhost LOG_HOSTNAME ?= localhost
# If the first make argument is "start" or "stop"... # If the first make argument is "start", "stop"...
ifeq (start,$(firstword $(MAKECMDGOALS))) ifeq (start,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true SERVICE_TARGET = true
else ifeq (stop,$(firstword $(MAKECMDGOALS))) else ifeq (stop,$(firstword $(MAKECMDGOALS)))
...@@ -48,6 +48,8 @@ else ifeq (attach,$(firstword $(MAKECMDGOALS))) ...@@ -48,6 +48,8 @@ else ifeq (attach,$(firstword $(MAKECMDGOALS)))
ifndef TANGO_HOST ifndef TANGO_HOST
$(error TANGO_HOST must specify the Tango database device, e.g., make TANGO_HOST=powersupply-databaseds:10000 ...) $(error TANGO_HOST must specify the Tango database device, e.g., make TANGO_HOST=powersupply-databaseds:10000 ...)
endif endif
else ifeq (run,$(firstword $(MAKECMDGOALS)))
RUN_TARGET = true
endif endif
ifdef SERVICE_TARGET ifdef SERVICE_TARGET
...@@ -55,6 +57,13 @@ ifdef SERVICE_TARGET ...@@ -55,6 +57,13 @@ ifdef SERVICE_TARGET
SERVICE := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) SERVICE := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets # ...and turn them into do-nothing targets
$(eval $(SERVICE):;@:) $(eval $(SERVICE):;@:)
else ifdef RUN_TARGET
# Isolate second argument as service, the rest is arguments for run command
SERVICE := $(wordlist 2, 2, $(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(SERVICE):;@:)
SERVICE_ARGS := $(wordlist 3, $(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(SERVICE_ARGS):;@:)
endif endif
# #
...@@ -131,7 +140,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \ ...@@ -131,7 +140,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
DOCKER_GID=$(DOCKER_GID) DOCKER_GID=$(DOCKER_GID)
.PHONY: up down minimal start stop restart build build-nocache status clean pull help .PHONY: up down minimal run start stop restart build build-nocache status clean pull help
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
pull: ## pull the images from the Docker hub pull: ## pull the images from the Docker hub
...@@ -150,6 +159,9 @@ build-nocache: ## rebuild images from scratch ...@@ -150,6 +159,9 @@ build-nocache: ## rebuild images from scratch
up: minimal ## start the base TANGO system and prepare requested services up: minimal ## start the base TANGO system and prepare requested services
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) up --no-start --no-recreate $(SERVICE) $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) up --no-start --no-recreate $(SERVICE)
run: minimal ## run a service using arguments and delete it afterwards
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) run --rm $(SERVICE) $(SERVICE_ARGS)
down: ## stop all services and tear down the system down: ## stop all services and tear down the system
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) down $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) down
ifneq ($(NETWORK_MODE),host) ifneq ($(NETWORK_MODE),host)
......
...@@ -29,3 +29,8 @@ services: ...@@ -29,3 +29,8 @@ services:
- --strict - --strict
- -- - --
- tox --recreate -e integration - tox --recreate -e integration
command:
# Allow for arguments to be passed that wil be put after the entrypoint
# tox is configured to take these arguments as integration test directory
# specifications.
- ""
...@@ -31,7 +31,6 @@ sleep 60 ...@@ -31,7 +31,6 @@ sleep 60
bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/LOFAR_ConfigDb.json bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/LOFAR_ConfigDb.json
bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/simulators_ConfigDb.json bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/simulators_ConfigDb.json
bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/dummy_positions_ConfigDb.json bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/dummy_positions_ConfigDb.json
#bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/integration_ConfigDb.json
cd "$LOFAR20_DIR/docker-compose" || exit 1 cd "$LOFAR20_DIR/docker-compose" || exit 1
make start sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim make start sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim
...@@ -51,5 +50,5 @@ sleep 60 ...@@ -51,5 +50,5 @@ sleep 60
cd "$LOFAR20_DIR/docker-compose" || exit 1 cd "$LOFAR20_DIR/docker-compose" || exit 1
make up integration-test make up integration-test
# Run the integration test with the output displayed on stdout # Run the default integration tests
docker start -a "${CONTAINER_NAME_PREFIX}"integration-test make run integration-test default
# Integration Tests # Integration Tests
Integration tests are separated into multi modules. Each module requires a
different state and configuration. These configurations are managed externally.
Invocation of individual modules is achieved through tox:
`tox -e integration MODULE_SUBFOLDER`
## Approach ## Approach
A special docker container is build to perform the integration tests. This A special docker container is build to perform the integration tests. This
...@@ -7,9 +13,9 @@ container will be build by the makefiles but should only be started by the ...@@ -7,9 +13,9 @@ container will be build by the makefiles but should only be started by the
dedicated integration test script. This script will ensure that other containers dedicated integration test script. This script will ensure that other containers
are running and are in the required state. are running and are in the required state.
* Launch recv-sim and sdptr-sim simulators. * Launch simulators.
* Reconfigure dsconfig to use these simulators. * Reconfigure dsconfig to use these simulators.
* Create and start the integration-test container. * Create and start the integration-test container for the specific module.
## Running ## Running
...@@ -18,8 +24,3 @@ are running and are in the required state. ...@@ -18,8 +24,3 @@ are running and are in the required state.
```shell ```shell
sbin/run_integration_test.sh sbin/run_integration_test.sh
``` ```
## Limitations
Our makefile will always launch the new container upon creation, resulting in
the integration tests actually being run twice.
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# Distributed under the terms of the APACHE license. # Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info. # See LICENSE.txt for more info.
import time
import numpy import numpy
import datetime import datetime
import json import json
...@@ -74,6 +75,9 @@ class TestDeviceBeam(AbstractTestBases.TestDeviceBase): ...@@ -74,6 +75,9 @@ class TestDeviceBeam(AbstractTestBases.TestDeviceBase):
HBAT_delays_r1 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value) HBAT_delays_r1 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value)
self.assertIsNotNone(HBAT_delays_r1) self.assertIsNotNone(HBAT_delays_r1)
time.sleep(3)
# Verify writing operation does not lead to errors
self.proxy.HBAT_set_pointing(self.pointing_direction) # write values to RECV self.proxy.HBAT_set_pointing(self.pointing_direction) # write values to RECV
HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value) HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value)
self.assertIsNotNone(HBAT_delays_r2) self.assertIsNotNone(HBAT_delays_r2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment