Skip to content

Commit

Permalink
Group docker e2e simple flow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d8660091 committed Jun 17, 2024
1 parent f2629b8 commit 599de90
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/test/e2e/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ func listTests(regex string, testsToSkip []string) (tests, skippedTests []string
}

if strings.HasPrefix(line, "Test") {
tests = append(tests, line)
if strings.HasPrefix(line, "Suite") {
for k, s := range Suites {
if strings.HasSuffix(line, k) {
for _, st := range s {
tests = append(tests, line+"/"+st.GetName())
}
break
}
}
} else {
tests = append(tests, line)
}
}
}

Expand Down
31 changes: 31 additions & 0 deletions internal/test/e2e/suite.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package e2e

import "github.com/aws/eks-anywhere/pkg/api/v1alpha1"

var kubeVersions = []v1alpha1.KubernetesVersion{v1alpha1.Kube128, v1alpha1.Kube129, v1alpha1.Kube130}

// Subtest is an interface to represent a test case.
type Subtest interface {
GetName() string
}

// Suites contain all test suites. The key is the suite suffix.
var Suites = map[string][]Subtest{
"SimpleFlowSuite": {},
}

// SimpleFlowTest is a struct to represent a simple flow test.
type SimpleFlowTest struct {
KubeVersion v1alpha1.KubernetesVersion
}

// GetName return the test case name.
func (st *SimpleFlowTest) GetName() string {
return string(st.KubeVersion)
}

func init() {
for _, k := range kubeVersions {
Suites["SimpleFlowSuite"] = append(Suites["SimpleFlowSuite"], &SimpleFlowTest{KubeVersion: k})
}
}
15 changes: 15 additions & 0 deletions test/e2e/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/test/framework"

"github.com/aws/eks-anywhere/internal/test/e2e"
)

// Labels
Expand Down Expand Up @@ -1459,3 +1461,16 @@ func TestDockerKubernetes129to130EtcdScaleDown(t *testing.T) {
),
)
}

func TestDockerKubernetesSimpleFlowSuite(t *testing.T) {
for _, ts := range e2e.Suites["SimpleFlowTest"] {
t.Run(ts.GetName(), func(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewDocker(t),
framework.WithClusterFiller(api.WithKubernetesVersion(ts.(*e2e.SimpleFlowTest).KubeVersion)),
)
runSimpleFlow(test)
})
}
}

0 comments on commit 599de90

Please sign in to comment.