Skip to content
Snippets Groups Projects
Select Git revision
  • 219c41d13de1e38dc83b2f4c4d1b45c4da508738
  • master default protected
  • L2SS-2199-apply-dab-to-xy
  • L2SS-2417-more-vector-memory
  • test-pytango-10.0.3
  • revert-cs032-ccd-ip
  • deploy-components-parallel
  • fix-chrony-exporter
  • L2SS-2407-swap-iers-caltable-monitoring-port
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • all-stations-lofar2
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • v0.55.5-r2 protected
  • v0.52.8-rc1 protected
  • v0.55.5 protected
  • v0.55.4 protected
  • 0.55.2.dev0
  • 0.55.1.dev0
  • 0.55.0.dev0
  • v0.54.0 protected
  • 0.53.2.dev0
  • 0.53.1.dev0
  • v0.52.3-r2 protected
  • remove-snmp-client
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
41 results

run_integration_test.sh

Blame
  • lukken's avatar
    L2SS-951: Finishing touch for documentation
    Corné Lukken authored
    350c9880
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    run_integration_test.sh 5.22 KiB
    #!/bin/bash -e
    
    # Usage function explains how parameters are parsed
    function usage {
        echo "./$(basename "$0")
          no arguments, builds and configures all docker containers and starts each
          stage of the integration test one after the other. Between each stage the
          dsconfig is updated accordingly."
        echo ""
        echo "./$(basename "$0") -h
          displays this help message"
        echo ""
        echo "./$(basename "$0") import-path.<class><function-name>
          A specific test can be defined by specifying the entire an import path
          and optionally extending this with a specific class and function. For
          instance tangostationcontrol.integration_test.observations.test_archiver.TestArchiver.test_get_multimember_devices"
        echo ""
    }
    
    # Configure the config database, restart containers and run a specific
    # integration module or even specific tests
    # integration_test module restarted_containers config_files specific_test
    function integration_test {
      IFS=" " read -r -a restarts <<< "${2}"
      IFS=" " read -r -a configs <<< "${3}"
      for config in "${configs[@]}"; do
        echo "Updating config ${config} ..."
        bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${config}"
      done
      if [ ! -z "${2+x}" ]; then
        # shellcheck disable=SC2145
        echo "make restart ${restarts[@]} ..."
        make restart "${restarts[@]}"
      fi
      sleep 10
      echo "make integration ${1} ..."
      make integration "${1}"
    }
    
    # list of arguments expected in the input
    optstring=":h"
    
    while getopts ${optstring} arg; do
      case ${arg} in
        h)
          usage
          exit 0
          ;;
        ?)
          echo "Invalid option: -${OPTARG}."
          exit 2
          ;;
      esac
    done
    
    if [ -z "$LOFAR20_DIR" ]; then
        # We assume we aren't in the PATH, so we can derive our path.
        # We need our parent directory.
        LOFAR20_DIR_RELATIVE=$(dirname "$0")/..
    
        # As an absolute path
        LOFAR20_DIR=$(readlink -f "${LOFAR20_DIR_RELATIVE}")
    fi
    
    cd "$LOFAR20_DIR/docker-compose" || exit 1
    
    
    
    # Start the database server first
    make build databaseds dsconfig
    make start databaseds dsconfig
    
    # Give dsconfig and databaseds time to start
    sleep 1 # dsconfig container must be up and running...
    # shellcheck disable=SC2016
    echo '/usr/local/bin/wait-for-it.sh ${TANGO_HOST} --strict --timeout=300 -- true' | make run dsconfig bash -
    
    DEVICES="device-boot device-apsct device-ccd device-apspu device-sdp device-recv device-bst device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam device-psoc device-pcon device-antennafield device-temperature-manager device-observation device-observation-control"
    
    SIMULATORS="sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim ccd-sim"
    
    # Build only the required images, please do not build everything that makes CI
    # take really long to finish, especially grafana / jupyter / prometheus.
    # jupyter is physically large > 2.5gb and overlayfs is really slow.
    
    # shellcheck disable=SC2086
    make build $DEVICES $SIMULATORS
    make build elk integration-test
    make build archiver-timescale hdbppts-cm hdbppts-es
    
    # Start and stop sequence
    # shellcheck disable=SC2086
    make stop $DEVICES $SIMULATORS hdbppts-es hdbppts-cm archiver-timescale
    make stop device-docker # this one does not test well in docker-in-docker
    make stop elk
    
    # Run dummy integration test to install pytango in tox virtualenv without
    # the memory pressure of the ELK stack.
    # Alternatively this step can be avoided if we use:
    # `tox --sitepackages -e integration` for the integration docker container,
    # however, that does require creating a container specific integration job.
    # TODO(L2SS-992): Remove me and above documentation
    integration_test dummy
    
    make start elk
    
    # Give elk time to start
    sleep 10
    
    # Update the dsconfig
    # Do not remove `bash`, otherwise statement ignored by gitlab ci shell!
    bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/LOFAR_ConfigDb.json
    bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/test_environment_ConfigDb.json
    bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/tango-archiver-data/archiver-devices.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
    
    cd "$LOFAR20_DIR/docker-compose" || exit 1
    # shellcheck disable=SC2086
    make start $SIMULATORS
    
    # Give the simulators time to start
    sleep 5
    
    # shellcheck disable=SC2086
    make start $DEVICES
    # Archive devices: archive-timescale first
    make start archiver-timescale
    
    # Give devices time to restart
    # TODO(Corne Lukken): Use a nicer more reliable mechanism
    sleep 70
    
    # Give archiver-timescale time to start
    # shellcheck disable=SC2016
    echo '/usr/local/bin/wait-for-it.sh archiver-timescale:5432 --strict --timeout=300 -- true' | make run dsconfig bash -
    
    # Archive devices: Now that archiver-timescale is up we can start the CM and ES
    make start hdbppts-cm hdbppts-es
    
    # Start the integration test
    cd "$LOFAR20_DIR/docker-compose" || exit 1
    make up integration-test
    
    integration_test default
    
    integration_test recv_cluster "device-recv device-tilebeam device-antennafield" "${LOFAR20_DIR}/CDB/integrations/recvcluster_ConfigDb.json"
    
    integration_test observations "archiver-timescale hdbppts-cm hdbppts-es" "${LOFAR20_DIR}/CDB/integrations/multiobs_ConfigDb.json"