Skip to content

Commit

Permalink
Minor tweaks to e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rhkp committed Aug 26, 2024
1 parent eb0a2e5 commit 3fb36d9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ Dockerfile
/target/

database/index.db
e2e-test-report.xml
e2e-test-report*.xml
*.tar
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ generate-all: generate generate-deploy bundle addheaders vet fmt

.PHONY: test-e2e # You will need to have a Minikube/Kind cluster up in running to run this target, and run container-builder before the test
test-e2e:
go test ./test/e2e/* -v -ginkgo.v -ginkgo.no-color -ginkgo.junit-report=./e2e-test-report.xml -timeout 120m
go test ./test/e2e/e2e_suite_test.go ./test/e2e/helpers.go ./test/e2e/clusterplatform_test.go -v -ginkgo.v -ginkgo.no-color -ginkgo.junit-report=./e2e-test-report-clusterplatform_test.xml -timeout 60m;
go test ./test/e2e/e2e_suite_test.go ./test/e2e/helpers.go ./test/e2e/platform_test.go -v -ginkgo.v -ginkgo.no-color -ginkgo.junit-report=./e2e-test-report-platform_test.xml -timeout 60m;
go test ./test/e2e/e2e_suite_test.go ./test/e2e/helpers.go ./test/e2e/workflow_test.go -v -ginkgo.v -ginkgo.no-color -ginkgo.junit-report=./e2e-test-report-workflow_test.xml -timeout 60m;

.PHONY: before-pr
before-pr: test generate-all
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/clusterplatform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ var _ = Describe("Validate a clusterplatform", Ordered, func() {
)

BeforeEach(func() {
targetNamespace = fmt.Sprintf("test-%d", rand.Intn(1024)+1)
targetNamespace = fmt.Sprintf("test-%d", rand.Intn(randomIntRange)+1)
cmd := exec.Command("kubectl", "create", "namespace", targetNamespace)
_, err := utils.Run(cmd)
Expect(err).NotTo(HaveOccurred())

targetNamespace2 = fmt.Sprintf("test-%d", rand.Intn(1024)+1)
targetNamespace2 = fmt.Sprintf("test-%d", rand.Intn(randomIntRange)+1)
cmd = exec.Command("kubectl", "create", "namespace", targetNamespace2)
_, err = utils.Run(cmd)
Expect(err).NotTo(HaveOccurred())
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ type check struct {
Data map[string]string `json:"data"`
}

const (
ephemeral = "ephemeral"
postgreSQL = "postgreSQL"
clusterWideEphemeral = "cluster-wide-ephemeral"
ephemeralDataIndex = "ephemeral-data-index"
ephemeralJobService = "ephemeral-job-service"
)

const randomIntRange = 16384 //Set to large number to avoid cluster namespace name collisions

var (
upStatus string = "UP"
)
Expand Down
12 changes: 2 additions & 10 deletions test/e2e/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ import (
. "github.com/onsi/gomega"
)

const (
ephemeral = "ephemeral"
postgreSQL = "postgreSQL"
clusterWideEphemeral = "cluster-wide-ephemeral"
ephemeralDataIndex = "ephemeral-data-index"
ephemeralJobService = "ephemeral-job-service"
)

var _ = Describe("Validate the persistence", Ordered, func() {

var (
Expand All @@ -52,7 +44,7 @@ var _ = Describe("Validate the persistence", Ordered, func() {
)

BeforeEach(func() {
targetNamespace = fmt.Sprintf("test-%d", rand.Intn(1024)+1)
targetNamespace = fmt.Sprintf("test-%d", rand.Intn(randomIntRange)+1)
cmd := exec.Command("kubectl", "create", "namespace", targetNamespace)
_, err := utils.Run(cmd)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -113,7 +105,7 @@ var _ = Describe("Validate the persistence", Ordered, func() {
Expect(sf).NotTo(BeEmpty(), "sonataflow name is empty")
EventuallyWithOffset(1, func() bool {
return verifyWorkflowIsInRunningStateInNamespace(sf, targetNamespace)
}, 10*time.Minute, 5).Should(BeTrue())
}, 15*time.Minute, 1*time.Minute).Should(BeTrue())
}
},
Entry("with both Job Service and Data Index and ephemeral persistence and the workflow in a dev profile", test.GetSonataFlowE2EPlatformServicesDirectory(), metadata.DevProfile.String(), ephemeral),
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var _ = Describe("SonataFlow Operator", Ordered, func() {

var targetNamespace string
BeforeEach(func() {
targetNamespace = fmt.Sprintf("test-%d", rand.Intn(1024)+1)
targetNamespace = fmt.Sprintf("test-%d", rand.Intn(randomIntRange)+1)
cmd := exec.Command("kubectl", "create", "namespace", targetNamespace)
_, err := utils.Run(cmd)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -153,7 +153,7 @@ var _ = Describe("Validate the persistence ", Ordered, func() {
)

BeforeEach(func() {
ns = fmt.Sprintf("test-%d", rand.Intn(1024)+1)
ns = fmt.Sprintf("test-%d", rand.Intn(randomIntRange)+1)
cmd := exec.Command("kubectl", "create", "namespace", ns)
_, err := utils.Run(cmd)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -188,7 +188,7 @@ var _ = Describe("Validate the persistence ", Ordered, func() {
out, err := utils.Run(cmd)
GinkgoWriter.Printf("%s\n", string(out))
return err
}, 12*time.Minute, 5).Should(Succeed())
}, 15*time.Minute, 1*time.Minute).Should(Succeed())

By("Evaluate status of the workflow's pod database connection health endpoint")
cmd = exec.Command("kubectl", "get", "pod", "-l", "sonataflow.org/workflow-app", "-n", ns, "-ojsonpath={.items[*].metadata.name}")
Expand Down Expand Up @@ -224,7 +224,7 @@ var _ = Describe("Validate the persistence ", Ordered, func() {
}
}
return false
}, 1*time.Minute).Should(BeTrue())
}, 4*time.Minute).Should(BeTrue())
// Persistence initialization checks
cmd = exec.Command("kubectl", "get", "pod", "-l", "sonataflow.org/workflow-app", "-n", ns, "-ojsonpath={.items[*].metadata.name}")
output, err = utils.Run(cmd)
Expand Down

0 comments on commit 3fb36d9

Please sign in to comment.