Skip to content

Commit

Permalink
restore the discovery of tests cases by file system existence (#8983)
Browse files Browse the repository at this point in the history
  • Loading branch information
rboyer authored Oct 19, 2020
1 parent 37cfa47 commit da4ec9f
Showing 1 changed file with 30 additions and 42 deletions.
72 changes: 30 additions & 42 deletions test/integration/connect/envoy/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}

0 comments on commit da4ec9f

Please sign in to comment.