restore the discovery of tests cases by file system existence (#8983)

This commit is contained in:
R.B. Boyer 2020-10-19 16:51:38 -05:00 committed by GitHub
parent aabd0130a9
commit 292cad3c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 42 deletions

View File

@ -3,54 +3,19 @@
package envoy
import (
"io/ioutil"
"os"
"os/exec"
"sort"
"strings"
"testing"
"github.com/stretchr/testify/require"
)
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-features",
"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-cfg-router-features",
"case-cfg-splitter-features",
"case-consul-exec",
"case-dogstatsd-udp",
"case-gateways-local",
"case-gateways-remote",
"case-gateway-without-services",
"case-grpc",
"case-http",
"case-http-badauthz",
"case-ingress-gateway-http",
"case-ingress-gateway-grpc",
"case-ingress-gateway-multiple-services",
"case-ingress-gateway-simple",
"case-ingress-gateway-tls",
"case-ingress-mesh-gateways-resolver",
"case-l7-intentions",
"case-multidc-rsa-ca",
"case-prometheus",
"case-statsd-udp",
"case-stats-proxy",
"case-terminating-gateway-hostnames",
"case-terminating-gateway-simple",
"case-terminating-gateway-subsets",
"case-terminating-gateway-without-services",
"case-upstream-config",
"case-wanfed-gw",
"case-zipkin",
}
testcases, err := discoverCases()
require.NoError(t, err)
runCmd(t, "suite_setup")
defer runCmd(t, "suite_teardown")
@ -83,3 +48,26 @@ func runCmd(t *testing.T, c string, env ...string) {
t.Fatalf("command failed: %v", err)
}
}
// Discover the cases so we pick up both oss and ent copies.
func discoverCases() ([]string, error) {
cwd, err := os.Getwd()
if err != nil {
return nil, err
}
dirs, err := ioutil.ReadDir(cwd)
if err != nil {
return nil, err
}
var out []string
for _, fi := range dirs {
if fi.IsDir() && strings.HasPrefix(fi.Name(), "case-") {
out = append(out, fi.Name())
}
}
sort.Strings(out)
return out, nil
}