File: integration.sh

package info (click to toggle)
golang-github-envoyproxy-go-control-plane 0.13.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,776 kB
  • sloc: sh: 190; makefile: 110
file content (46 lines) | stat: -rwxr-xr-x 1,199 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail

##
## Integration testing script for the control plane library against the Envoy binary.
## This is a wrapper around the test app `pkg/test/main` that spawns/kills Envoy.
##

MESSAGE=$'Hi, there!\n'

# Management server type. Valid values are "ads", "xds", "rest", "delta", or "delta-ads"
XDS=${XDS:-ads}

# pprof profiler. True means turn on profiling
PPROF=${PPROF:-false}

# Number of RTDS layers.
if [ "$XDS" = "ads" ]; then
  RUNTIMES=2
else
  RUNTIMES=1
fi

# Start the http server that sits upstream of Envoy
(bin/upstream -message="$MESSAGE")&
UPSTREAM_PID=$!

# Envoy start-up command
ENVOY=${ENVOY:-/usr/local/bin/envoy}
ENVOY_LOG="envoy.${XDS}$@.log"
echo Envoy log: ${ENVOY_LOG}

# Start envoy: important to keep drain time short
(${ENVOY} -c sample/bootstrap-${XDS}.yaml --drain-time-s 1 -l debug 2> ${ENVOY_LOG})&
ENVOY_PID=$!

function cleanup() {
  kill ${ENVOY_PID} ${UPSTREAM_PID}
  wait ${ENVOY_PID} ${UPSTREAM_PID} 2> /dev/null || true
}
trap cleanup EXIT

# run the test suite (which also contains the control plane)
bin/test --xds=${XDS} --runtimes=${RUNTIMES} --pprof=${PPROF} -debug -message="$MESSAGE" "$@"