open-consul/test/integration/connect/envoy/main_test.go
Daniel Nephin dcc76f8774
Make envoy integration tests a go test suite (#7842)
* test/integration: only run against 1 envoy version

These tests are slow enough that it seems unlikely that anyone is
running multiple versions locally. If someone wants to, a for loop
outside of run_test.sh should do the right thing.

Remove unused vars.

* Remove logic to iterate over test cases, run a single case

* Add a golang runner for integration tests

* Use build tags for envoy integration tests

And add junit-xml report
2020-05-19 14:00:00 -04:00

70 lines
1.6 KiB
Go

// +build integration
package envoy
import (
"os"
"os/exec"
"testing"
)
func TestEnvoy(t *testing.T) {
var testcases = []string{
"case-badauthz",
"case-basic",
"case-centralconf",
"case-cfg-resolver-dc-failover-gateways-none",
"case-cfg-resolver-dc-failover-gateways-remote",
"case-cfg-resolver-defaultsubset",
"case-cfg-resolver-subset-onlypassing",
"case-cfg-resolver-subset-redirect",
"case-cfg-resolver-svc-failover",
"case-cfg-resolver-svc-redirect-http",
"case-cfg-resolver-svc-redirect-tcp",
"case-consul-exec",
"case-dogstatsd-udp",
"case-gateways-local",
"case-gateways-remote",
"case-gateway-without-services",
"case-grpc",
"case-http",
"case-http2",
"case-http-badauthz",
"case-ingress-gateway-http",
"case-ingress-gateway-multiple-services",
"case-ingress-gateway-simple",
"case-ingress-mesh-gateways-resolver",
"case-multidc-rsa-ca",
"case-prometheus",
"case-statsd-udp",
"case-stats-proxy",
"case-terminating-gateway-simple",
"case-terminating-gateway-subsets",
"case-terminating-gateway-without-services",
"case-upstream-config",
"case-wanfed-gw",
"case-zipkin",
}
runCmd(t, "suite_setup")
defer runCmd(t, "suite_teardown")
for _, tc := range testcases {
t.Run(tc, func(t *testing.T) {
runCmd(t, "run_tests", "CASE_DIR="+tc)
})
}
}
func runCmd(t *testing.T, c string, env ...string) {
t.Helper()
cmd := exec.Command("./run-tests.sh", c)
cmd.Env = append(os.Environ(), env...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
t.Fatalf("command failed: %v", err)
}
}