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

chore: refactor worker test #248

Merged
merged 1 commit into from
Mar 10, 2022
Merged

chore: refactor worker test #248

merged 1 commit into from
Mar 10, 2022

Conversation

pihme
Copy link
Contributor

@pihme pihme commented Mar 9, 2022

Description

  • remove Thread.sleep()
  • wait until process instance gets completed

Related issues

closes #244

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually

Documentation:

  • Javadoc has been written
  • The documentation is updated

@pihme
Copy link
Contributor Author

pihme commented Mar 9, 2022

@remcowesterhoud Have a look and tell me what you think. I think it's definitely a step forward and hopefully removes flakiness.

This line is a bit awkward and not intuitive: BpmnAssert.initRecordStream(recordStream);

What could also help would be something like engine.waitForJobCompletion(jobType);

@pihme pihme requested a review from remcowesterhoud March 9, 2022 06:33
@github-actions
Copy link

github-actions bot commented Mar 9, 2022

Unit Test Results

128 files  128 suites   6m 28s ⏱️
325 tests 325 ✔️ 0 💤 0
788 runs  788 ✔️ 0 💤 0

Results for commit 6453fb1.

♻️ This comment has been updated with latest results.

@pihme
Copy link
Contributor Author

pihme commented Mar 9, 2022

We could also do a startProcessInstanceWithResult to make this example less non-sensical.

Btw, in the testbench test this will make sense read as a test, because it will be something like:

// when
startParentProcess();
await().until( parenProcessHasCompleted);
engine.waitForIdleState();

//then
assertThat(childProcess).isStarted().hasVariable(...)

@remcowesterhoud
Copy link
Contributor

remcowesterhoud commented Mar 9, 2022

I like using withResult() better than the await where you need to initialise the RecordStream. I don't want users to have to worry about this. Though, I'm not sure what happens when the process doesn't complete but runs in an incident.

I liked the idea of adding a waitForJobCompletion but I think we should make it more generic. We could make a waitFor(ValueType, Intent). That way we can wait for everything with a single method.

@remcowesterhoud remcowesterhoud marked this pull request as ready for review March 9, 2022 10:30
@remcowesterhoud remcowesterhoud marked this pull request as draft March 9, 2022 10:31
@pihme
Copy link
Contributor Author

pihme commented Mar 9, 2022

I like using withResult() better than the await where you need to initialise the RecordStream. I don't want users to have to worry about this. Though, I'm not sure what happens when the process doesn't complete but runs in an incident.

This will produce a request timeout exception.

I liked the idea of adding a waitForJobCompletion but I think we should make it more generic. We could make a waitFor(ValueType, Intent). That way we can wait for everything with a single method.

Maybe a little too technical, but a good idea.

@pihme pihme force-pushed the 244-refactor-worker-test branch from 1cd4edf to c53869c Compare March 9, 2022 11:59
@pihme pihme marked this pull request as ready for review March 9, 2022 12:00
@pihme
Copy link
Contributor Author

pihme commented Mar 9, 2022

I now have implemented only the refactoring for the test. The additional methods on Engine could be a follow up issue, independently prioritized.

Copy link
Contributor

@remcowesterhoud remcowesterhoud left a comment

Choose a reason for hiding this comment

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

Thanks! I like the changes so much that I'd like to see them a 2nd time in the testcontainer version of this test 😉 (this duplication is already annoying me so this will be one of the first things I want to get rid of next).

I've created a separate issue for the waitFor method: #252

@pihme pihme force-pushed the 244-refactor-worker-test branch from c53869c to 6453fb1 Compare March 10, 2022 13:31
@pihme pihme requested a review from remcowesterhoud March 10, 2022 13:32
Copy link
Contributor

@remcowesterhoud remcowesterhoud left a comment

Choose a reason for hiding this comment

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

LGTM!

@pihme pihme merged commit d7e2150 into main Mar 10, 2022
@remcowesterhoud remcowesterhoud deleted the 244-refactor-worker-test branch March 10, 2022 13:48
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.

Engine.waitForIdleState() does not work as expected
2 participants