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

Fixing status flaky test #3777

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

fjtirado
Copy link
Contributor

@fjtirado fjtirado commented Nov 14, 2024

AbstracPRocessInstance.getStatus does not inmediately match WorfklowProcessIntance.getState after KogitoProcessEventListener.afterProcessCompleted is invoked (eventually they are sync). There is a chance that tests that relies on afterProcessCompleted to handle CountdownLatch receive a wrong status is they check the status just after the countdownlatch reach zero (thats why those test are flaky)

@@ -400,8 +400,7 @@ public void testEventBasedSplit2() throws Exception {
org.kie.kogito.process.ProcessInstance<EventBasedSplit2Model> instanceTimer = processDefinition.createInstance(modelTimer);
instanceTimer.start();
assertThat(instanceTimer.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE);
assertThat(countDownListener.waitTillCompleted(15000)).isTrue();
assertThat(instanceYes.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED);
Copy link
Contributor Author

@fjtirado fjtirado Nov 14, 2024

Choose a reason for hiding this comment

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

This is a leffover, instanceYes has already being checked (btw, this probably makes the issue less frequent adding a small delay ;))
I also restored the timer to the default value (since that was not the issue)

There is a chance that status is invoked over a process instance that
has been finished, but the container kogito process instance does not
know yet, even if processcompleted listener has been executed (and thats
the issue)

Although this can be fixed by altering the order in which the different
listener are invoked (which might probably have other undesired effect),
I do not see a reason why status should not be read from underlying
process instance, if present.

Probably processInstance field should be embedded into an atomic
reference, but volatile might have the same effect with few code
changes.
@kie-ci3
Copy link
Contributor

kie-ci3 commented Nov 14, 2024

PR job #3 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 #3777 --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-3777/3/display/redirect

Test results:

  • PASSED: 3446
  • FAILED: 32

Those are the test failures:

org.kie.persistence.filesystem.FileSystemProcessInstancesTest.testBasicFlow
Expecting value to be true but was false
org.kie.persistence.filesystem.FileSystemProcessInstancesTest.testBasicFlowWithStartFrom Cannot invoke "org.jbpm.workflow.instance.WorkflowProcessInstance.getVariables()" because "this.processInstance" is null
org.kie.persistence.filesystem.FileSystemProcessInstancesTest.testValuesReadMode No value present
org.kie.persistence.filesystem.FileSystemProcessInstancesTest.testFindByIdReadMode No value present
org.kie.persistence.jdbc.PostgreSqlProcessInstancesIT.testBasicFlow No value present
org.kie.persistence.jdbc.PostgreSqlProcessInstancesIT.testMultipleProcesses
Expected size: 1 but was: 0 in:
[]
org.kie.persistence.jdbc.PostgreSqlProcessInstancesIT.testProcessWithDifferentVersion
Expected size: 1 but was: 0 in:
[]
org.kie.persistence.jdbc.PostgreSqlProcessInstancesIT.testBasicTaskFlow
Expecting value to be true but was false
org.kie.persistence.jdbc.PostgreSqlProcessInstancesIT.testRemove
Expected size: 1 but was: 0 in:
[]
org.kie.persistence.jdbc.PostgreSqlProcessInstancesIT.testUpdate No value present
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testMigrateSingle Process instance with id '93678156-9b87-4d63-9840-78bd53cf3c56' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testMigrateAll Process instance with id '471ba762-b82c-4748-9d6c-2912f3155ace' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testBasicFlow Process instance with id '4ae463b8-1971-4492-89e0-46a7b698cb46' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testMultipleProcesses Process instance with id '648b8a1d-76ac-4222-a6cb-0013ca5c4436' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testProcessWithDifferentVersion Process instance with id '0e4d0dc1-6414-4ee3-ae2d-0daa69c283f1' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testBasicTaskFlow Process instance with id 'ca019b0b-7bb2-4dc4-b969-4ba52fc5a316' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testRemove Process instance with id 'a835b0c3-d594-4452-aee5-50a55738f6d0' updated or deleted by other request
org.kie.persistence.jdbc.PostgreSqlProcessInstancesLockIT.testUpdate Process instance with id '05beb70d-669c-4275-a42a-e928d8adf2f0' updated or deleted by other request
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testMigrateSingle Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testMigrateAll Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testBasicFlow Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testMultipleProcesses Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testProcessWithDifferentVersion Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testRemove Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testUpdate Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testMigrateSingle Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testMigrateAll Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testBasicFlow Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testMultipleProcesses Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testProcessWithDifferentVersion Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testRemove Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null
org.kie.persistence.postgresql.PostgresqlProcessInstancesWithLockIT.testUpdate Cannot invoke "org.jbpm.process.instance.ProcessInstance.configureTimers()" because "jbpmProcessInstance" is null

@fjtirado
Copy link
Contributor Author

fjtirado commented Nov 14, 2024

Tries a first commit that read state from process insance if process instance is not null. Not working, because disconnected process instance are not null, and if set to null, it causes side effect on persistece module, Try altering the order of listeners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants