diff --git a/.gitignore b/.gitignore index 151e33cefc68060a8e423c3ec775126dd6763a89..00941bb5af067040269d23ab91d781bfb6cd5bc7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,3 @@ tangostationcontrol/docs/build **/pending_log_messages.db **/.eggs -log/*.log -log/*.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06f953487993e9035ccfe04eba1a5f223bc44423..c642888588327b2369367a21720aa65f123704fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -448,10 +448,9 @@ integration_test_docker: variables: DOCKER_TLS_CERTDIR: "/certs" artifacts: - name: integration-test-logs when: always paths: - - $CI_PROJECT_DIR/log/* + - log/ before_script: - | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" && -z "$CI_COMMIT_TAG" ]]; then @@ -470,20 +469,23 @@ integration_test_docker: - export BASH_SOURCE=$(pwd)/bootstrap/etc/lofar20rc.sh # Hack HOSTNAME env variable into host.docker.internal, set in docker-compose - export HOSTNAME=host.docker.internal -# - export HOSTNAME=$(hostname -i) -# - export HOSTNAME=$(cat /run/systemd/netif/leases/2 | grep ^ADDRESS= | awk -F'=' '{print $2}') # source the lofarrc file and mask its non zero exit code - . bootstrap/etc/lofar20rc.sh || true # TANGO_HOST must be unset our databaseds will be unreachable - unset TANGO_HOST -## Allow docker image script to execute -# - chmod u+x $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh # Do not remove 'bash' or statement will be ignored by primitive docker shell - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag -## Allow integration test to execute -# - chmod u+x $CI_PROJECT_DIR/sbin/run_integration_test.sh # Do not remove 'bash' or statement will be ignored by primitive docker shell - bash $CI_PROJECT_DIR/sbin/run_integration_test.sh + after_script: +# Collect output of all containers + - | + mkdir -p log + for container in $(docker ps -a --format "{{.Names}}") + do + echo "Saving log for container $container" + docker logs "${container}" >& "log/${container}.log" + done wheel_packaging: stage: packaging artifacts: diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh index 91952e01713c35bdd40d6a7bb3869420c29b7f24..acac6e21e1aeb0850d19aa420a4fe5c9a72970b9 100755 --- a/sbin/run_integration_test.sh +++ b/sbin/run_integration_test.sh @@ -9,10 +9,6 @@ if [ -z "$LOFAR20_DIR" ]; then LOFAR20_DIR=$(readlink -f "${LOFAR20_DIR_RELATIVE}") fi -# Where to store any logs and output files we produce -ARTIFACT_DIR="${LOFAR20_DIR}/log" -mkdir -p "${ARTIFACT_DIR}" - cd "$LOFAR20_DIR/docker-compose" || exit 1 # Start the database server first @@ -48,9 +44,6 @@ bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/tango-archive 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 -# Dump the resulting configuration for offline analysis -bash "${LOFAR20_DIR}"/bin/dump_ConfigDb.sh >& "${ARTIFACT_DIR}"/integration-test-ConfigDb-dump.json - cd "$LOFAR20_DIR/docker-compose" || exit 1 # shellcheck disable=SC2086 make start $SIMULATORS @@ -72,24 +65,11 @@ cd "$LOFAR20_DIR/docker-compose" || exit 1 make up integration-test # Run the default integration tests -TEST_RESULT=0 -make run integration-test default || TEST_RESULT=$? - -if [ ${TEST_RESULT} -eq 0 ] -then - # Configure integration test for recv_cluster module - bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/integrations/recvcluster_ConfigDb.json - make restart device-recv device-tilebeam - sleep 5 - - TEST_RESULT=0 - make run integration-test recv_cluster || TEST_RESULT=$? -fi +make run integration-test default -# Dump logs of important containers -for container in $DEVICES databaseds dsconfig tangodb -do - docker logs "${CONTAINER_NAME_PREFIX}${container}" >& "${ARTIFACT_DIR}/${container}.log" -done +# Configure integration test for recv_cluster module +bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/integrations/recvcluster_ConfigDb.json +make restart device-recv device-tilebeam +sleep 5 -exit $TEST_RESULT +make run integration-test recv_cluster