ricardozanini commented on code in PR #540:
URL: 
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/540#discussion_r1802003321


##########
test/e2e/workflow_test.go:
##########
@@ -274,5 +272,93 @@ var _ = Describe("Workflow Persistence Use Cases :: ", 
Label("flows-persistence"
                Entry("defined from the sonataflow platform as reference and 
without DI and JS", test.GetPathFromE2EDirectory("workflows", "persistence", 
"from_platform_without_di_and_js_services"), true, false),
                Entry("defined from the sonataflow platform as reference but 
not required by the workflow", test.GetPathFromE2EDirectory("workflows", 
"persistence", "from_platform_with_no_persistence_required"), false, false),
        )
+})
+
+var _ = Describe("Workflow Monitoring Use Cases :: ", 
Label("flows-monitoring"), Ordered, func() {
+
+       var targetNamespace string
+       BeforeEach(func() {
+               targetNamespace = fmt.Sprintf("test-%d", 
rand.Intn(randomIntRange)+1)
+               err := kubectlCreateNamespace(targetNamespace)
+               Expect(err).NotTo(HaveOccurred())
+       })
+       AfterEach(func() {
+               // Remove resources in test namespace
+               if !CurrentSpecReport().Failed() && len(targetNamespace) > 0 {
+                       cmd := exec.Command("kubectl", "delete", "sonataflow", 
"--all", "-n", targetNamespace, "--wait")
+                       _, err := utils.Run(cmd)
+                       Expect(err).NotTo(HaveOccurred())
+                       err = kubectlDeleteNamespace(targetNamespace)
+                       Expect(err).NotTo(HaveOccurred())
+               }
+       })
+       Describe("basic workflow monitoring", func() {
+               projectDir, _ := utils.GetProjectDir()
 
+               It("should create servicemonitor for workflow deployed as k8s 
deployment when monitoring enabled in platform", func() {
+                       By("Deploy the SonataFlowPlatform CR and the workflow")
+                       var manifests []byte
+                       EventuallyWithOffset(1, func() error {
+                               var err error
+                               cmd := exec.Command("kubectl", "kustomize", 
filepath.Join(projectDir,
+                                       
"test/e2e/testdata/workflows/prometheus", "k8s_deployment"))
+                               manifests, err = utils.Run(cmd)
+                               return err
+                       }, time.Minute, time.Second).Should(Succeed())
+                       cmd := exec.Command("kubectl", "create", "-n", 
targetNamespace, "-f", "-")

Review Comment:
   After creating the workflow, we then replace the image in the CR. Please see 
the other examples.



##########
test/e2e/testdata/workflows/prometheus/k8s_deployment/02-sonataflow_greeting.yaml:
##########
@@ -0,0 +1,57 @@
+# Copyright 2024 Apache Software Foundation (ASF)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+  name: greeting
+  annotations:
+    sonataflow.org/description: Greeting example on k8s!
+    sonataflow.org/version: 0.0.1
+    sonataflow.org/profile: preview

Review Comment:
   We don't build these CRs anymore, we must use `gitops` here. Please see the 
other CRs and the other tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to