mirror of https://github.com/status-im/consul.git
restore the discovery of tests cases by file system existence (#8983)
This commit is contained in:
parent
37cfa479d8
commit
da4ec9ff27
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue