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

Document how to write engine tests #10096

Open
korthout opened this issue Aug 17, 2022 · 0 comments
Open

Document how to write engine tests #10096

korthout opened this issue Aug 17, 2022 · 0 comments
Labels
area/test Marks an issue as improving or extending the test coverage of the project component/engine component/zeebe Related to the Zeebe component/team kind/documentation Categorizes an issue or PR as documentation related

Comments

@korthout
Copy link
Member

Description

As part of our ongoing efforts to document Zeebe's internals and make it easier for developers to contribute, we should document how to write engine tests.

This documentation should probably include:

  • what we value in tests
  • how to set up a scenario and run it
  • how to assert results
  • how to make tests run fast

We should also go into some details related to time travel:

Hiya team 👋 Recently, we moved from repeated tasks to tasks that reschedule themselves with a fixed delay. Although the change makes sense, I’ve run into a drawback: time-traveling in tests doesn’t affect the later iterations of the task scheduling.

Example:
The time is 09:00 and I schedule a task to run every 10 min. At 09:10 it triggers. At 09:20 it triggers. At 09:25 I add 30 min to the clock, it does not trigger 3 times immediately, but instead triggers once immediately and then again at 09:35.

I ran into this, in the test I’m writing for the Delete existing PENDING_DEPLOYMENT bug, where I want to trigger the redistribution. The redistribution of deployments works by checking every 10 seconds whether there are any deployments that can be retried. They are skipped the first time to make sure we don’t retry immediately after our initial try (for example if the deployment is created just before the redistribution checks again).

So in the test I have to:

  • deploy the process
  • time travel to trigger the redistribution check
  • wait for the redistribution check task to finish so that it is rescheduled again
  • then and only then can I add more time to trigger the redistribution check again

This is cumbersome in tests, so I’m considering making the Deployment Redistributor available for access in the EngineRule, so I can trigger it directly. But I’d like to consider whether this is a unique case, or that we may have other such cases in the future.

@korthout korthout added the kind/documentation Categorizes an issue or PR as documentation related label Aug 17, 2022
@Zelldon Zelldon added area/test Marks an issue as improving or extending the test coverage of the project component/engine labels Jan 3, 2023
@romansmirnov romansmirnov added the component/zeebe Related to the Zeebe component/team label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test Marks an issue as improving or extending the test coverage of the project component/engine component/zeebe Related to the Zeebe component/team kind/documentation Categorizes an issue or PR as documentation related
Projects
None yet
Development

No branches or pull requests

3 participants