From 9865cca3be339a5ee019a71c58b0a1160d28e708 Mon Sep 17 00:00:00 2001 From: Jordi Gil Date: Tue, 27 Feb 2024 17:40:16 -0500 Subject: [PATCH] Fix e2e tests and add 'time.Minute' timeout to waitFor condition Signed-off-by: Jordi Gil --- test/e2e/helpers.go | 5 +++-- test/e2e/workflow_test.go | 21 +++++++++++-------- .../02-sonataflow_platform.yaml | 4 ++++ .../02-sonataflow_platform.yaml | 4 ++++ .../02-sonataflow_platform.yaml | 4 ++++ .../02-sonataflow_platform.yaml | 4 ++++ 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/test/e2e/helpers.go b/test/e2e/helpers.go index 345dc2a69..d2dd8e83b 100644 --- a/test/e2e/helpers.go +++ b/test/e2e/helpers.go @@ -44,8 +44,9 @@ type health struct { } type check struct { - Name string `json:"name"` - Status string `json:"status"` + Name string `json:"name"` + Status string `json:"status"` + Data map[string]string `json:"data"` } var ( diff --git a/test/e2e/workflow_test.go b/test/e2e/workflow_test.go index 8815feadb..30a0ae2fd 100644 --- a/test/e2e/workflow_test.go +++ b/test/e2e/workflow_test.go @@ -144,6 +144,10 @@ var _ = Describe("SonataFlow Operator", Ordered, func() { var _ = Describe("Validate the persistence ", Ordered, func() { + const ( + dbConnectionName = "Database connections health check" + defaultDataCheck = "" + ) var ( ns string ) @@ -198,21 +202,20 @@ var _ = Describe("Validate the persistence ", Ordered, func() { } Expect(h.Status).To(Equal(upStatus), "Pod health is not UP") for _, c := range h.Checks { - if withPersistence { - if c.Name == "Database connections health check" { - Expect(c.Status).To(Equal(upStatus), "Pod's database connection is not UP") + if c.Name == dbConnectionName { + Expect(c.Status).To(Equal(upStatus), "Pod's database connection is not UP") + if withPersistence { + Expect(c.Data[defaultDataCheck]).To(Equal(upStatus), "Pod's 'default' database data is not UP") + return true + } else { + Expect(defaultDataCheck).NotTo(BeElementOf(c.Data), "Pod's 'default' database data check exists in health manifest") return true } - } else { - Expect(c.Name).NotTo(Equal("Database connections health check"), "persistence configuration found in workflow") } } - if !withPersistence { - return true - } } return false - }, 1).Should(BeTrue()) + }, 1*time.Minute).Should(BeTrue()) }, Entry("defined in the workflow from an existing kubernetes service as a reference", test.GetSonataFlowE2EWorkflowPersistenceSampleDataDirectory("by_service"), true), Entry("defined in the workflow and from the sonataflow platform", test.GetSonataFlowE2EWorkflowPersistenceSampleDataDirectory("from_platform_overwritten_by_service"), true), diff --git a/test/testdata/workflow/persistence/from_platform_overwritten_by_service/02-sonataflow_platform.yaml b/test/testdata/workflow/persistence/from_platform_overwritten_by_service/02-sonataflow_platform.yaml index 733b0b952..e342b1c18 100644 --- a/test/testdata/workflow/persistence/from_platform_overwritten_by_service/02-sonataflow_platform.yaml +++ b/test/testdata/workflow/persistence/from_platform_overwritten_by_service/02-sonataflow_platform.yaml @@ -28,6 +28,10 @@ spec: port: 3456 databaseName: db_name build: + template: + buildArgs: + - name: QUARKUS_EXTENSIONS + value: org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:999-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final config: strategyOptions: KanikoBuildCacheEnabled: "true" diff --git a/test/testdata/workflow/persistence/from_platform_with_di_and_js_services/02-sonataflow_platform.yaml b/test/testdata/workflow/persistence/from_platform_with_di_and_js_services/02-sonataflow_platform.yaml index 2a7db22a6..66eec55a4 100644 --- a/test/testdata/workflow/persistence/from_platform_with_di_and_js_services/02-sonataflow_platform.yaml +++ b/test/testdata/workflow/persistence/from_platform_with_di_and_js_services/02-sonataflow_platform.yaml @@ -28,6 +28,10 @@ spec: port: 5432 databaseName: sonataflow build: + template: + buildArgs: + - name: QUARKUS_EXTENSIONS + value: org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:999-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final config: strategyOptions: KanikoBuildCacheEnabled: "true" diff --git a/test/testdata/workflow/persistence/from_platform_with_no_persistence_required/02-sonataflow_platform.yaml b/test/testdata/workflow/persistence/from_platform_with_no_persistence_required/02-sonataflow_platform.yaml index 817ce0c31..f61f4a849 100644 --- a/test/testdata/workflow/persistence/from_platform_with_no_persistence_required/02-sonataflow_platform.yaml +++ b/test/testdata/workflow/persistence/from_platform_with_no_persistence_required/02-sonataflow_platform.yaml @@ -28,6 +28,10 @@ spec: port: 5432 databaseName: sonataflow build: + template: + buildArgs: + - name: QUARKUS_EXTENSIONS + value: org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:999-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final config: strategyOptions: KanikoBuildCacheEnabled: "true" diff --git a/test/testdata/workflow/persistence/from_platform_without_di_and_js_services/02-sonataflow_platform.yaml b/test/testdata/workflow/persistence/from_platform_without_di_and_js_services/02-sonataflow_platform.yaml index b5ac4e161..6dc311d62 100644 --- a/test/testdata/workflow/persistence/from_platform_without_di_and_js_services/02-sonataflow_platform.yaml +++ b/test/testdata/workflow/persistence/from_platform_without_di_and_js_services/02-sonataflow_platform.yaml @@ -28,6 +28,10 @@ spec: port: 5432 databaseName: sonataflow build: + template: + buildArgs: + - name: QUARKUS_EXTENSIONS + value: org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:999-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final config: strategyOptions: KanikoBuildCacheEnabled: "true"