go.ligato.io/vpp-agent/v3@v3.5.0/tests/integration/run_integration.sh (about) 1 #!/usr/bin/env bash 2 set -Eeuo pipefail 3 4 echo "Preparing integration tests.." 5 6 args=($*) 7 VPP_IMG="${VPP_IMG:-ligato/vpp-base}" 8 testname="vpp-agent-integration-test" 9 imgname="vpp-agent-integration-tests" 10 11 # Compile testing suite 12 go test -c -o ./tests/integration/integration.test \ 13 -covermode atomic \ 14 -tags 'osusergo netgo integration' \ 15 -ldflags '-w -s -extldflags "-static"' \ 16 ./tests/integration/... 17 18 # Build testing image 19 docker build \ 20 -f ./tests/integration/Dockerfile.integration \ 21 --build-arg VPP_IMG \ 22 --tag "${imgname}" \ 23 ./tests/integration 24 25 vppver=$(docker run --rm -i "$VPP_IMG" dpkg-query -f '${Version}' -W vpp) 26 27 cleanup() { 28 echo "stopping test container" 29 docker stop -t 1 "${testname}" 2>/dev/null 30 docker rm -v "${testname}" 2>/dev/null 31 } 32 33 trap 'cleanup' EXIT 34 35 echo "=============================================================" 36 echo -e " VPP Integration Test - \e[1;33m${vppver}\e[0m" 37 echo "=============================================================" 38 39 # Run integration tests 40 if docker run -i \ 41 --name "${testname}" \ 42 --privileged \ 43 --label io.ligato.vpp-agent.testsuite=integration \ 44 --label io.ligato.vpp-agent.testname="${testname}" \ 45 --env INITIAL_LOGLVL \ 46 --env VPPVER=${vppver:0:5} \ 47 --volume $(pwd)/report:/reports \ 48 ${DOCKER_ARGS-} \ 49 "${imgname}" ${args[@]:-} 50 then 51 echo >&2 "-------------------------------------------------------------" 52 echo >&2 -e " \e[32mPASSED\e[0m (took: ${SECONDS}s)" 53 echo >&2 "-------------------------------------------------------------" 54 exit 0 55 else 56 res=$? 57 echo >&2 "-------------------------------------------------------------" 58 echo >&2 -e " \e[31mFAILED!\e[0m (exit code: $res)" 59 echo >&2 "-------------------------------------------------------------" 60 exit $res 61 fi