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 4c0387b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ e2e-tests-binary:

.PHONY: build-integration-test-binary
build-integration-test-binary:
GOOS=$(GO_OS) GOARCH=$(GO_ARCH) $(GO) build -o bin/test github.com/aws/eks-anywhere/cmd/integration_test
GOOS=$(GO_OS) GOARCH=$(GO_ARCH) $(GO) build -o bin/test -tags "$(E2E_TAGS)" github.com/aws/eks-anywhere/cmd/integration_test

.PHONY: conformance
conformance:
Expand Down
36 changes: 18 additions & 18 deletions cmd/integration_test/build/buildspecs/quick-test-eks-a-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,23 @@ phases:
- ${CODEBUILD_SRC_DIR}/cmd/integration_test/build/script/start_docker.sh
- make eks-a-for-dev-e2e build-integration-test-binary e2e-tests-binary E2E_TAGS="e2e all_providers" E2E_OUTPUT_FILE=bin/e2e.test
- export CLUSTER_NAME_PREFIX="${BRANCH_NAME//./-}"
- >
./bin/test e2e cleanup vsphere
-n ${CLUSTER_NAME_PREFIX}
-v 4
- >
./bin/test e2e cleanup cloudstack
-n ${CLUSTER_NAME_PREFIX}
--delete-duplicate-networks
-v 6
- >
./bin/test e2e cleanup nutanix
-n ${CLUSTER_NAME_PREFIX}
-e ${T_NUTANIX_ENDPOINT}
-p ${T_NUTANIX_PORT}
--insecure
--ignoreErrors
-v 4
# - >
# ./bin/test e2e cleanup vsphere
# -n ${CLUSTER_NAME_PREFIX}
# -v 4
# - >
# ./bin/test e2e cleanup cloudstack
# -n ${CLUSTER_NAME_PREFIX}
# --delete-duplicate-networks
# -v 6
# - >
# ./bin/test e2e cleanup nutanix
# -n ${CLUSTER_NAME_PREFIX}
# -e ${T_NUTANIX_ENDPOINT}
# -p ${T_NUTANIX_PORT}
# --insecure
# --ignoreErrors
# -v 4
build:
commands:
- export JOB_ID=$CODEBUILD_BUILD_ID
Expand All @@ -224,7 +224,7 @@ phases:
-i ${INTEGRATION_TEST_INSTANCE_PROFILE}
-m ${INTEGRATION_TEST_MAX_EC2_COUNT}
-p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT}
-r ${TESTS}
-r "TestDockerKubernetesSimpleFlowSuite"
-v 4
--skip ${SKIPPED_TESTS}
--bundles-override=${BUNDLES_OVERRIDE}
Expand Down
14 changes: 13 additions & 1 deletion internal/test/e2e/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/aws/eks-anywhere/pkg/executables"
"github.com/aws/eks-anywhere/pkg/types"
e2etest "github.com/aws/eks-anywhere/test/e2e"
)

func listTests(regex string, testsToSkip []string) (tests, skippedTests []string, err error) {
Expand All @@ -29,7 +30,18 @@ func listTests(regex string, testsToSkip []string) (tests, skippedTests []string
}

if strings.HasPrefix(line, "Test") {
tests = append(tests, line)
if strings.HasSuffix(line, "Suite") {
for k, s := range e2etest.Suites {

Check failure on line 34 in internal/test/e2e/list.go

View workflow job for this annotation

GitHub Actions / build

undefined: e2etest.Suites

Check failure on line 34 in internal/test/e2e/list.go

View workflow job for this annotation

GitHub Actions / govulncheck

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

Expand Down
13 changes: 13 additions & 0 deletions test/e2e/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1459,3 +1459,16 @@ func TestDockerKubernetes129to130EtcdScaleDown(t *testing.T) {
),
)
}

func TestDockerKubernetesSimpleFlowSuite(t *testing.T) {
for _, ts := range Suites[SimpleFlowSuite] {
t.Run(ts.GetName(), func(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewDocker(t),
framework.WithClusterFiller(api.WithKubernetesVersion(ts.(*SimpleFlowTest).KubeVersion)),
)
runSimpleFlow(test)
})
}
}
32 changes: 32 additions & 0 deletions test/e2e/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package e2e

import (
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
)
Expand All @@ -16,3 +17,34 @@ func init() {
// There might a better way for this, but this will do for now.
ctrl.SetLogger(klog.Background())
}

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

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

// SimpleFlowSuite is a suite name.
const SimpleFlowSuite = "SimpleFlowSuite"

// 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})
}
}

0 comments on commit 4c0387b

Please sign in to comment.