Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gmunozfe merged PR #3944: URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944 -- 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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
kie-ci3 commented on PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#issuecomment-3090539796
**PR job** `#10` was: **UNSTABLE**
Possible explanation: This should be test failures
Reproducer
build-chain build full_downstream -f
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
-o 'bc' -p apache/incubator-kie-kogito-runtimes -u
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944
--skipParallelCheckout
NOTE: To install the build-chain tool, please refer to
https://github.com/kiegroup/github-action-build-chain#local-execution
Please look here:
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/10/display/redirect
**Test results:**
- PASSED: 3616
- FAILED: 1
Those are the test failures:
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/10/testReport/org.kie.kogito.codegen.tests/PublishEventIT/testCompensationProcess/";>org.kie.kogito.codegen.tests.PublishEventIT.testCompensationProcess
Expected size: 9 but was: 11 in:[ProcessInstanceNodeEventBody
[eventDate=Fri Jul 18 12:49:55 EDT 2025, eventUser=null, eventType=2,
processId=defaultPackage.TimerProcess, processVersion=1.0,
processInstanceId=2ab62cb1-380a-4902-8417-c30eecdf2f18,
connectionNodeInstanceId=SequenceFlow_1,
nodeDefinitionId=_E76AD186-6FA6-4378-B45B-C8F73E2C497C, nodeName=timer fired,
nodeType=ActionNode, nodeInstanceId=fe2d4e7c-ec1c-42d5-9492-013058803514,
data={}],ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55
EDT 2025, eventUser=null, eventType=2, processId=defaultPackage.TimerProcess,
processVersion=1.0, processInstanceId=2ab62cb1-380a-4902-8417-c30eecdf2f18,
connectionNodeInstanceId=SequenceFlow_2,
nodeDefinitionId=_F9AC8B12-8E75-49B5-B799-292F66270627, nodeName=start,
nodeType=StartNode, nodeInstanceId=0653a737-9c23-429e-b866-4bdac3176dc2,
data={}],ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55
EDT 2025, eventUser=null, eventType=2, processId=
compensateAll, processVersion=1.0,
processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=null,
nodeDefinitionId=_B580FC2E-3924-472A-BCFB-A2ACBADA2B94, nodeName=Compensation
2, nodeType=ActionNode, nodeInstanceId=3974d66f-cc56-4375-b459-d2e4fbabb75b,
data={}],ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55
EDT 2025, eventUser=null, eventType=2, processId=compensateAll,
processVersion=1.0, processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=,
nodeDefinitionId=_3F8F7865-7B32-4E44-B323-44CCBFC96C8F, nodeName=BoundaryEvent,
nodeType=BoundaryEventNode,
nodeInstanceId=bd6c5441-d12a-40a5-93f0-ec41d48dd012, data={}],
ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55 EDT 2025,
eventUser=null, eventType=2, processId=compensateAll, processVersion=1.0,
processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=null,
nodeDefinitionId=_D91EB7E7-A287-4958-BF8E-27E364349BE9, nodeName=
Compensation, nodeType=ActionNode,
nodeInstanceId=32cbdc57-118e-4310-bc78-7e7b3076dd86, data={}],
ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55 EDT 2025,
eventUser=null, eventType=2, processId=compensateAll, processVersion=1.0,
processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=,
nodeDefinitionId=_C9728638-4D98-4C28-972D-C8C5A7CA0290, nodeName=BoundaryEvent,
nodeType=BoundaryEventNode,
nodeInstanceId=80889aa6-7ebd-4c90-9db2-e5724c6ae7df, data={}],
ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55 EDT 2025,
eventUser=null, eventType=2, processId=compensateAll, processVersion=1.0,
processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=null,
nodeDefinitionId=_E38F40D5-3A9A-4332-A4DC-CE0A2D37E179, nodeName=End,
nodeType=EndNode, nodeInstanceId=02e0f7f5-ac85-465c-b2e3-6978d6f42898,
data={}],ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55
EDT 2025, eventUser=null, eventType
=2, processId=compensateAll, processVersion=1.0,
processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=_457153B3-F67D-4D9F-ABF8-FFD10B6D934C,
nodeDefinitionId=_CC9F5867-27CF-42CF-8838-648F44FD4CF1, nodeName=Compensate all
tasks, nodeType=ActionNode,
nodeInstanceId=cd47fb5f-b192-4cd0-9223-21e59120d320, data={}],
ProcessInstanceNodeEventBody [eventDate=Fri Jul 18 12:49:55 EDT 2025,
eventUser=null, eventType=2, processId=compensateAll, processVersion=1.0,
processInstanceId=01be5352-8bca-4727-ae31-d268f40adfb5,
connectionNodeInstanceId=_ACA65ACF-CBDA-4452-8C1A-609D54F1B749,
nodeDefinitionId=_AA20EA8B-91E3-4171-8345-BFFBB103CD7F, nodeName=ScriptTask2,
nodeType=ActionNode, nodeInstanceId=6da4afa1-585e-
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on PR #3944: URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#issuecomment-3075036293 > +1 when we have greens. LGTM, thanks for adding the suggestions. @wmedvede should be good now -- 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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
kie-ci3 commented on PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#issuecomment-3074338942
**PR job** `#8` was: **UNSTABLE**
Possible explanation: This should be test failures
Reproducer
build-chain build full_downstream -f
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
-o 'bc' -p apache/incubator-kie-kogito-runtimes -u
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944
--skipParallelCheckout
NOTE: To install the build-chain tool, please refer to
https://github.com/kiegroup/github-action-build-chain#local-execution
Please look here:
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/8/display/redirect
**Test results:**
- PASSED: 3614
- FAILED: 1
Those are the test failures:
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/8/testReport/org.kie.kogito.quarkus.workflows/EventWithHeaderIT/triggerWorkflowWithCloudEvent/";>org.kie.kogito.quarkus.workflows.EventWithHeaderIT.triggerWorkflowWithCloudEvent
Expecting value to be true but was false
--
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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on code in PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2207482627
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/EventWithHeaderIT.java:
##
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.net.URI;
+import java.time.OffsetDateTime;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.test.quarkus.QuarkusTestProperty;
+import org.kie.kogito.test.quarkus.kafka.KafkaTestClient;
+import org.kie.kogito.testcontainers.quarkus.KafkaQuarkusTestResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import io.cloudevents.core.builder.CloudEventBuilder;
+import io.cloudevents.jackson.JsonCloudEventData;
+import io.cloudevents.jackson.JsonFormat;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.path.json.JsonPath;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static
org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils.assertProcessInstanceHasFinished;
+
+@QuarkusIntegrationTest
+@QuarkusTestResource(SimpleServerServicesMock.class)
+@QuarkusTestResource(KafkaQuarkusTestResource.class)
+class EventWithHeaderIT {
+
+private static final String SERVICE_URL = "/event-with-headers";
+private static final String SERVICE_GET_BY_ID_URL = SERVICE_URL + "/{id}";
+private static final String EVENT_TYPE = "lock-event";
+private static final String EVENT_TOPIC = "lock-event";
+
+private static final String DEFAULT_OUT_EVENT_TOPIC =
"kogito-sw-out-events";
+
+public static final String SIMPLE_TOKEN = "TEST_TOKEN";
+
+@QuarkusTestProperty(name = KafkaQuarkusTestResource.KOGITO_KAFKA_PROPERTY)
+String kafkaBootstrapServers;
+ObjectMapper objectMapper;
+KafkaTestClient kafkaClient;
+
+private static final Logger LOGGER =
LoggerFactory.getLogger(EventWithHeaderIT.class);
+
+@BeforeEach
+void setup() {
+kafkaClient = new KafkaTestClient(kafkaBootstrapServers);
+objectMapper = new ObjectMapper()
+.registerModule(new JavaTimeModule())
+.registerModule(JsonFormat.getCloudEventJacksonModule())
+
.disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+}
+
+@AfterEach
+void cleanUp() {
+if (kafkaClient != null) {
+kafkaClient.shutdown();
+}
+}
+
+@Test
+@SuppressWarnings("squid:S2699")
+void callbackStateSuccessful() throws Exception {
+
+String response =
objectMapper.writeValueAsString(CloudEventBuilder.v1()
+.withId(UUID.randomUUID().toString())
+.withSource(URI.create(""))
+.withType(EventWithHeaderIT.EVENT_TYPE)
+.withTime(OffsetDateTime.now())
+.withExtension("xauthorizationsimple", SIMPLE_TOKEN)
+
.withData(JsonCloudEventData.wrap(objectMapper.createObjectNode().put("name",
"The Kraken")))
+.build());
+
+final CountDownLatch countDownLatch = new CountDownLatch(1);
+final AtomicReference cloudEvent = new AtomicReference<>();
+kafkaClient.consume(DEFAULT_OUT_EVENT_TOPIC, rawCloudEvent -> {
+cloudEvent.set(rawCloudEvent);
+countDownLatch.countDown();
Review Comment:
I cannot really test the processInstanceID in itself as I cannot know which
it is until I received the callback `id-event` CloudEvent, what I can do is to
test that the event is of type `lock-event`
--
This is an automated message from the Apache Git Service.
To resp
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on code in PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2207421965
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/EventWithHeaderIT.java:
##
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.net.URI;
+import java.time.OffsetDateTime;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.test.quarkus.QuarkusTestProperty;
+import org.kie.kogito.test.quarkus.kafka.KafkaTestClient;
+import org.kie.kogito.testcontainers.quarkus.KafkaQuarkusTestResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import io.cloudevents.core.builder.CloudEventBuilder;
+import io.cloudevents.jackson.JsonCloudEventData;
+import io.cloudevents.jackson.JsonFormat;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.path.json.JsonPath;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static
org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils.assertProcessInstanceHasFinished;
+
+@QuarkusIntegrationTest
+@QuarkusTestResource(SimpleServerServicesMock.class)
+@QuarkusTestResource(KafkaQuarkusTestResource.class)
+class EventWithHeaderIT {
+
+private static final String SERVICE_URL = "/event-with-headers";
+private static final String SERVICE_GET_BY_ID_URL = SERVICE_URL + "/{id}";
+private static final String EVENT_TYPE = "lock-event";
+private static final String EVENT_TOPIC = "lock-event";
+
+private static final String DEFAULT_OUT_EVENT_TOPIC =
"kogito-sw-out-events";
+
+public static final String SIMPLE_TOKEN = "TEST_TOKEN";
+
+@QuarkusTestProperty(name = KafkaQuarkusTestResource.KOGITO_KAFKA_PROPERTY)
+String kafkaBootstrapServers;
+ObjectMapper objectMapper;
+KafkaTestClient kafkaClient;
+
+private static final Logger LOGGER =
LoggerFactory.getLogger(EventWithHeaderIT.class);
+
+@BeforeEach
+void setup() {
+kafkaClient = new KafkaTestClient(kafkaBootstrapServers);
+objectMapper = new ObjectMapper()
+.registerModule(new JavaTimeModule())
+.registerModule(JsonFormat.getCloudEventJacksonModule())
+
.disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+}
+
+@AfterEach
+void cleanUp() {
+if (kafkaClient != null) {
+kafkaClient.shutdown();
+}
+}
+
+@Test
+@SuppressWarnings("squid:S2699")
+void callbackStateSuccessful() throws Exception {
+
+String response =
objectMapper.writeValueAsString(CloudEventBuilder.v1()
Review Comment:
you are right, this is not a response but a message, I'll fix that
--
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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on code in PR #3944: URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2207417927 ## kogito-build/kogito-dependencies-bom/pom.xml: ## @@ -51,7 +51,7 @@ 2.4.10 1.0.0-preview.20240207 2.2.0 - 2.10.0-lts + 2.11.0-lts Review Comment: This PR is opened for a while now, I'll rebase, this should fix this -- 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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
wmedvede commented on code in PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2204200618
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/EventWithHeaderIT.java:
##
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.net.URI;
+import java.time.OffsetDateTime;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.test.quarkus.QuarkusTestProperty;
+import org.kie.kogito.test.quarkus.kafka.KafkaTestClient;
+import org.kie.kogito.testcontainers.quarkus.KafkaQuarkusTestResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import io.cloudevents.core.builder.CloudEventBuilder;
+import io.cloudevents.jackson.JsonCloudEventData;
+import io.cloudevents.jackson.JsonFormat;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.path.json.JsonPath;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static
org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils.assertProcessInstanceHasFinished;
+
+@QuarkusIntegrationTest
+@QuarkusTestResource(SimpleServerServicesMock.class)
+@QuarkusTestResource(KafkaQuarkusTestResource.class)
+class EventWithHeaderIT {
+
+private static final String SERVICE_URL = "/event-with-headers";
+private static final String SERVICE_GET_BY_ID_URL = SERVICE_URL + "/{id}";
+private static final String EVENT_TYPE = "lock-event";
+private static final String EVENT_TOPIC = "lock-event";
+
+private static final String DEFAULT_OUT_EVENT_TOPIC =
"kogito-sw-out-events";
+
+public static final String SIMPLE_TOKEN = "TEST_TOKEN";
+
+@QuarkusTestProperty(name = KafkaQuarkusTestResource.KOGITO_KAFKA_PROPERTY)
+String kafkaBootstrapServers;
+ObjectMapper objectMapper;
+KafkaTestClient kafkaClient;
+
+private static final Logger LOGGER =
LoggerFactory.getLogger(EventWithHeaderIT.class);
+
+@BeforeEach
+void setup() {
+kafkaClient = new KafkaTestClient(kafkaBootstrapServers);
+objectMapper = new ObjectMapper()
+.registerModule(new JavaTimeModule())
+.registerModule(JsonFormat.getCloudEventJacksonModule())
+
.disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+}
+
+@AfterEach
+void cleanUp() {
+if (kafkaClient != null) {
+kafkaClient.shutdown();
+}
+}
+
+@Test
+@SuppressWarnings("squid:S2699")
+void callbackStateSuccessful() throws Exception {
+
+String response =
objectMapper.writeValueAsString(CloudEventBuilder.v1()
+.withId(UUID.randomUUID().toString())
+.withSource(URI.create(""))
+.withType(EventWithHeaderIT.EVENT_TYPE)
+.withTime(OffsetDateTime.now())
+.withExtension("xauthorizationsimple", SIMPLE_TOKEN)
+
.withData(JsonCloudEventData.wrap(objectMapper.createObjectNode().put("name",
"The Kraken")))
+.build());
+
+final CountDownLatch countDownLatch = new CountDownLatch(1);
+final AtomicReference cloudEvent = new AtomicReference<>();
+kafkaClient.consume(DEFAULT_OUT_EVENT_TOPIC, rawCloudEvent -> {
+cloudEvent.set(rawCloudEvent);
+countDownLatch.countDown();
+});
+kafkaClient.produce(response, EventWithHeaderIT.EVENT_TOPIC);
+// give some time to consume the event and verify the expected
decision was made.
Review Comment:
The current workflow is not performing any decision, comment confuses to
follow the test.
--
This i
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
wmedvede commented on code in PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2204069735
##
kogito-build/kogito-dependencies-bom/pom.xml:
##
@@ -51,7 +51,7 @@
2.4.10
1.0.0-preview.20240207
2.2.0
-
2.10.0-lts
+
2.11.0-lts
Review Comment:
I believe main already has 2.11.0-lts
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/EventWithHeaderIT.java:
##
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.net.URI;
+import java.time.OffsetDateTime;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.test.quarkus.QuarkusTestProperty;
+import org.kie.kogito.test.quarkus.kafka.KafkaTestClient;
+import org.kie.kogito.testcontainers.quarkus.KafkaQuarkusTestResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import io.cloudevents.core.builder.CloudEventBuilder;
+import io.cloudevents.jackson.JsonCloudEventData;
+import io.cloudevents.jackson.JsonFormat;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.path.json.JsonPath;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static
org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils.assertProcessInstanceHasFinished;
+
+@QuarkusIntegrationTest
+@QuarkusTestResource(SimpleServerServicesMock.class)
+@QuarkusTestResource(KafkaQuarkusTestResource.class)
+class EventWithHeaderIT {
+
+private static final String SERVICE_URL = "/event-with-headers";
+private static final String SERVICE_GET_BY_ID_URL = SERVICE_URL + "/{id}";
+private static final String EVENT_TYPE = "lock-event";
+private static final String EVENT_TOPIC = "lock-event";
+
+private static final String DEFAULT_OUT_EVENT_TOPIC =
"kogito-sw-out-events";
+
+public static final String SIMPLE_TOKEN = "TEST_TOKEN";
+
+@QuarkusTestProperty(name = KafkaQuarkusTestResource.KOGITO_KAFKA_PROPERTY)
+String kafkaBootstrapServers;
+ObjectMapper objectMapper;
+KafkaTestClient kafkaClient;
+
+private static final Logger LOGGER =
LoggerFactory.getLogger(EventWithHeaderIT.class);
+
+@BeforeEach
+void setup() {
+kafkaClient = new KafkaTestClient(kafkaBootstrapServers);
+objectMapper = new ObjectMapper()
+.registerModule(new JavaTimeModule())
+.registerModule(JsonFormat.getCloudEventJacksonModule())
+
.disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+}
+
+@AfterEach
+void cleanUp() {
+if (kafkaClient != null) {
+kafkaClient.shutdown();
+}
+}
+
+@Test
+@SuppressWarnings("squid:S2699")
+void callbackStateSuccessful() throws Exception {
+
+String response =
objectMapper.writeValueAsString(CloudEventBuilder.v1()
Review Comment:
nitpick, `response` for the produced event confuses to follow the test
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/EventWithHeaderIT.java:
##
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apach
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on PR #3944: URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#issuecomment-3018604028 > Looks good to me, however I'm wondering if other rainy tests could be added as well for testing the resilience and robustness of the system, just like: > > * Missing/invalid _xauthorizationsimple_ header > * Malformed CloudEvent > * Wrong token in header > * External service failure > > Wdyt? @gmunozfe The goal of those tests are not to verify the workflow itself but rather simply verify that if a workflow is triggered but a CloudEvent, the headers it holds are correctfully provided to the openapi generator so it can use them, for instance, to propagate token So testing anything related to the correctfulness of the workflow triggered by the CloudEvent are out of the scope, this should be delegated to the end user implementing its own workflow If there is a Malformed CloudEvent, the workflow would never be triggered so the goal of the test cannot be fulfil anyway -- 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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on code in PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2174609616
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/SimpleServerServicesMock.java:
##
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.util.Collections;
+import java.util.Map;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+
+import jakarta.ws.rs.core.HttpHeaders;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.configureFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static
com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+import static jakarta.ws.rs.core.HttpHeaders.CONTENT_TYPE;
+import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
+
+public class SimpleServerServicesMock implements
QuarkusTestResourceLifecycleManager {
+private static final String BEARER = "Bearer ";
+
+public static final String SIMPLE_SERVER_SERVICE_MOCK_URL =
"simple-server-service-mock.url";
+
+private WireMockServer wireMockServer;
+
+@Override
+public Map start() {
+wireMockServer = new WireMockServer(options().dynamicPort());
+wireMockServer.start();
+configureFor(wireMockServer.port());
+
+stubForExternalService("/simple", EventWithHeaderIT.SIMPLE_TOKEN);
+
+return Collections.singletonMap(SIMPLE_SERVER_SERVICE_MOCK_URL,
wireMockServer.baseUrl());
+}
+
+private static void stubForExternalService(String
tokenPropagationExternalServiceUrl, String authorizationToken) {
+stubFor(get(tokenPropagationExternalServiceUrl)
+.withHeader(HttpHeaders.AUTHORIZATION, equalTo(BEARER +
authorizationToken))
+.willReturn(aResponse()
+.withHeader(CONTENT_TYPE, APPLICATION_JSON)
+.withBody("{}")));
+}
+
+@Override
+public void stop() {
+if (wireMockServer != null) {
+wireMockServer.stop();
Review Comment:
not sure that's really needed here as the stop method comes from
QuarkusTestResourceLifecycleManager and this method will be called at the end
of the test suite, so the server will not be used anymore.
--
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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gmunozfe commented on code in PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#discussion_r2167400014
##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/SimpleServerServicesMock.java:
##
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.util.Collections;
+import java.util.Map;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+
+import jakarta.ws.rs.core.HttpHeaders;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.configureFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static
com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+import static jakarta.ws.rs.core.HttpHeaders.CONTENT_TYPE;
+import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
+
+public class SimpleServerServicesMock implements
QuarkusTestResourceLifecycleManager {
+private static final String BEARER = "Bearer ";
+
+public static final String SIMPLE_SERVER_SERVICE_MOCK_URL =
"simple-server-service-mock.url";
+
+private WireMockServer wireMockServer;
+
+@Override
+public Map start() {
+wireMockServer = new WireMockServer(options().dynamicPort());
+wireMockServer.start();
+configureFor(wireMockServer.port());
+
+stubForExternalService("/simple", EventWithHeaderIT.SIMPLE_TOKEN);
+
+return Collections.singletonMap(SIMPLE_SERVER_SERVICE_MOCK_URL,
wireMockServer.baseUrl());
+}
+
+private static void stubForExternalService(String
tokenPropagationExternalServiceUrl, String authorizationToken) {
+stubFor(get(tokenPropagationExternalServiceUrl)
+.withHeader(HttpHeaders.AUTHORIZATION, equalTo(BEARER +
authorizationToken))
+.willReturn(aResponse()
+.withHeader(CONTENT_TYPE, APPLICATION_JSON)
+.withBody("{}")));
+}
+
+@Override
+public void stop() {
+if (wireMockServer != null) {
+wireMockServer.stop();
Review Comment:
you could also invoke `wireMockServer.resetAll(); `at this point to reuse or
use in parallel tests this mock
--
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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
gabriel-farache commented on PR #3944: URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#issuecomment-2997553364 @fjtirado I think we can merge this one now, and then https://github.com/apache/incubator-kie-issues/issues/1968 can be closed -- 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]
Re: [PR] apache/incubator-kie-issues#1968 - Add IT to test header propagation for workflow triggered by CloudEvent [incubator-kie-kogito-runtimes]
kie-ci3 commented on PR #3944:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944#issuecomment-2963024445
**PR job** `#5` was: **UNSTABLE**
Possible explanation: This should be test failures
Reproducer
build-chain build full_downstream -f
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
-o 'bc' -p apache/incubator-kie-kogito-runtimes -u
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3944
--skipParallelCheckout
NOTE: To install the build-chain tool, please refer to
https://github.com/kiegroup/github-action-build-chain#local-execution
Please look here:
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/display/redirect
**Test results:**
- PASSED: 3544
- FAILED: 22
Those are the test failures:
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.mongodb/KogitoProcessInstancesFactoryIT/___/";>org.kie.kogito.mongodb.KogitoProcessInstancesFactoryIT.(?)
Container startup failed for image mirror.gcr.io/library/mongo:5.0.31
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.mongodb/MongoDBProcessInstancesIT/___/";>org.kie.kogito.mongodb.MongoDBProcessInstancesIT.(?)
Container startup failed for image mirror.gcr.io/library/mongo:5.0.31
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.mongodb/PersistentProcessInstancesIT/___/";>org.kie.kogito.mongodb.PersistentProcessInstancesIT.(?)
Container startup failed for image mirror.gcr.io/library/mongo:5.0.31
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.mongodb/PersistentProcessInstancesWithLockIT/___/";>org.kie.kogito.mongodb.PersistentProcessInstancesWithLockIT.(?)
Container startup failed for image mirror.gcr.io/library/mongo:5.0.31
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.mongodb.correlation/MongoDBCorrelationServiceIT/___/";>org.kie.kogito.mongodb.correlation.MongoDBCorrelationServiceIT.(?)
Container startup failed for image mirror.gcr.io/library/mongo:5.0.31
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.mongodb.transaction/AbstractTransactionManagerIT/___/";>org.kie.kogito.mongodb.transaction.AbstractTransactionManagerIT.(?)
Container startup failed for image mirror.gcr.io/library/mongo:5.0.31
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.quarkus.workflows/EventWithHeaderIT/callbackStateSuccessful/";>org.kie.kogito.quarkus.workflows.EventWithHeaderIT.callbackStateSuccessful
Assertion condition defined as a
org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils 1 expectation
failed.Expected status code <404> but was <200>. within 3 minutes.
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.it/MongoDBOptimisticLockingIT/PR_check___Build_projects___testPersistence/";>PR
check / Build projects /
org.kie.kogito.it.MongoDBOptimisticLockingIT.testPersistence
java.util.concurrent.CompletionException: java.lang.RuntimeException: Unable
to start Quarkus test resource class
org.kie.kogito.testcontainers.quarkus.MongoDBQuarkusTestResource
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3944/5/testReport/org.kie.kogito.it/MongoDBOptimisticLockingIT/PR_check___Build_projects___testPersistence/";>PR
check / Build projects /
org.kie.kogito.it.MongoDBOptimisticLockingIT.testPersistence
Failed to load ApplicationContext for
[WebMergedContextConfiguration@5ba90d8a testClass =
org.kie.kogito.it.MongoDBOptimisticLockingIT, locations = [], classes =
[org.kie.kogito.it.KogitoSpringbootApplication], contextInitializerClasses =
[org.kie.kogito.testcontainers.springboot.MongoDBSpringBootTestResource],
activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties =
["kogito.persistence.optimistic.lock=true",
"org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true",
"server.port=0"], contextCustomizers =
[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@3b79fd76,
org.springframework.boot.test.json.DuplicateJsonObjectContextCust
