Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2e brownfield fix #657

Merged
merged 20 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 14 additions & 33 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ const (
)

var (
testResources []step.Resource
testResourcesApex []step.ResourceApex
tagsSpecified []string
stepRunner *step.Runner
beautify string
testCsm bool
testApex bool
testResources []step.Resource
tagsSpecified []string
stepRunner *step.Runner
beautify string
testApex bool
)

func Contains(slice []string, str string) bool {
Expand Down Expand Up @@ -94,27 +92,12 @@ var _ = BeforeSuite(func() {
By(fmt.Sprint(tagsSpecified))

By("Reading values file")
res, err := step.GetTestResources(valuesFile)
var err error
testResources, testApex, err = step.GetTestResources(valuesFile)
if err != nil {
framework.Failf("Failed to read values file: %v", err)
}

testResources = res
if strings.Contains(testResources[0].CustomResource[0].Kind, "ContainerStorageModule") {
testCsm = true
}

By("Reading apex values file")
resApex, err := step.GetTestResourcesApex(valuesFile)
if err != nil {
framework.Failf("Failed to read apex values file: %v", err)
}

testResourcesApex = resApex
if strings.Contains(testResourcesApex[0].CustomResourceApex[0].Kind, "ApexConnectivityClient") {
testApex = true
}

By("Getting a k8s client")
ctrlClient, err := client.New(config.GetConfigOrDie(), client.Options{})
if err != nil {
Expand All @@ -131,33 +114,31 @@ var _ = BeforeSuite(func() {
step.StepRunnerInit(stepRunner, ctrlClient, clientSet)

beautify = " "

})

var _ = Describe("[run-e2e-test] E2E Testing", func() {

It("Running all test Given Test Scenarios", func() {
if testApex {
for _, test := range testResourcesApex {
By(fmt.Sprintf("Starting: %s ", test.ScenarioApex.Scenario))
if ContainsTag(test.ScenarioApex.Tags, tagsSpecified) == false {
for _, test := range testResources {
By(fmt.Sprintf("Starting: %s ", test.Scenario.Scenario))
if ContainsTag(test.Scenario.Tags, tagsSpecified) == false {
By(fmt.Sprintf("Not tagged for this test run, skipping"))
By(fmt.Sprintf("Ending: %s\n", test.ScenarioApex.Scenario))
By(fmt.Sprintf("Ending: %s\n", test.Scenario.Scenario))
continue
}

for _, stepName := range test.ScenarioApex.Steps {
for _, stepName := range test.Scenario.Steps {
By(fmt.Sprintf("%s Executing %s", beautify, stepName))
Eventually(func() error {
return stepRunner.RunStepClient(stepName, test)
}, timeout, interval).Should(BeNil())
}
By(fmt.Sprintf("Ending: %s\n", test.ScenarioApex.Scenario))
By(fmt.Sprintf("Ending: %s\n", test.Scenario.Scenario))
time.Sleep(5 * time.Second)
}

}
if testCsm {
} else {
for _, test := range testResources {
By(fmt.Sprintf("Starting: %s ", test.Scenario.Scenario))
if ContainsTag(test.Scenario.Tags, tagsSpecified) == false {
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/dell/csm-operator/tests/e2e

go 1.22
go 1.22.0

require (
github.com/dell/csm-operator v0.0.0
Expand All @@ -10,7 +10,7 @@ require (
k8s.io/api v0.28.9
k8s.io/apimachinery v0.28.9
k8s.io/client-go v0.28.9
k8s.io/kubernetes v1.29.7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this version downgrade required? It's also affecting other dependency versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a recent PR where the version was upgraded casing compilation failure in the e2e test files and hence we need to downgrade it to a version where the tests compile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tdawe Yes the the version 1.29.7 was failing compiling e2e because K8s updated few other packages where our code wasnt complaint. We would need to change our code accordingly to match 1.29 k8s soon

k8s.io/kubernetes v1.28.12
k8s.io/utils v0.0.0-20240423183400-0849a56e8f22
sigs.k8s.io/controller-runtime v0.15.2
sigs.k8s.io/yaml v1.4.0
Expand All @@ -28,7 +28,7 @@ require (
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
Expand All @@ -43,7 +43,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/cel-go v0.16.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand Down Expand Up @@ -113,7 +113,7 @@ require (
k8s.io/controller-manager v0.28.9 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kms v0.28.9 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/kubectl v0.0.0 // indirect
k8s.io/kubelet v0.0.0 // indirect
k8s.io/pod-security-admission v0.0.0 // indirect
Expand Down
Loading
Loading