-
Notifications
You must be signed in to change notification settings - Fork 562
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
test: increment time continuously #8508
Conversation
fc0f9c6
to
36f757c
Compare
In order to prevent for flakiness the time needs to be increased everytime so we can retrigger the position distribution.
36f757c
to
abe53bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
I don't understand why the event is not received with the first clock increment though.
Thanks @deepthidevaki I think this is a good point I can take a deeper look again. |
Hey @deepthidevaki I had a deeper look and I think I can explain it. In our test we start the exporters and await the future. The future we await is returned from submitting the Actor, https://github.com/camunda-cloud/zeebe/blob/develop/broker/src/main/java/io/camunda/zeebe/broker/exporter/stream/ExporterDirector.java#L107. Here it becomes interesting. Taking a look at the actor scheduler, we can see that the future is complete after the starting phase is complete, which means I was able to reproduce this via unit tests: @Test
public void shouldCompleteFutureBeforeStartedComplete() {
// given
final CountDownLatch latch = new CountDownLatch(1);
final var scheduler = ActorScheduler.newActorScheduler().build();
scheduler.start();
// when
final ActorFuture<Void> startedFuture =
scheduler.submitActor(
new Actor() {
@Override
protected void onActorStarted() {
try {
latch.await();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
});
// then
startedFuture.join();
assertThat(startedFuture).isDone();
assertThat(latch.getCount()).isEqualTo(1);
} This test completes without issues. The following test will never complete: @Test
public void shouldCompleteFutureBeforeStartingComplete() {
// given
final CountDownLatch latch = new CountDownLatch(1);
final var scheduler = ActorScheduler.newActorScheduler().build();
scheduler.start();
// when
final ActorFuture<Void> startedFuture =
scheduler.submitActor(
new Actor() {
@Override
protected void onActorStarting() {
try {
latch.await();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
});
// then
startedFuture.join();
assertThat(startedFuture).isDone();
assertThat(latch.getCount()).isEqualTo(1);
} So to conclude we already complete the future after the starting phase, after that we wait that the active exporter is in the exporting phase, but this doesn't mean that the passive exporter has completely set up. This means in our test we already increment the time, but the passive exporter might not subscribed yet for the event (this happens in the #onActorStarted) . |
Got it! Thanks for looking into it 👍 |
bors r+ |
Backport failed for Please cherry-pick the changes locally. git fetch origin stable/1.2
git worktree add -d .worktree/backport-8508-to-stable/1.2 origin/stable/1.2
cd .worktree/backport-8508-to-stable/1.2
git checkout -b backport-8508-to-stable/1.2
ancref=$(git merge-base 4cbae45566fe59acc44c65c8d8ef65d8434322cf abe53bce920a22add55eb0d8e856589e7f046e1e)
git cherry-pick -x $ancref..abe53bce920a22add55eb0d8e856589e7f046e1e |
Backport failed for Please cherry-pick the changes locally. git fetch origin release-1.3.0
git worktree add -d .worktree/backport-8508-to-release-1.3.0 origin/release-1.3.0
cd .worktree/backport-8508-to-release-1.3.0
git checkout -b backport-8508-to-release-1.3.0
ancref=$(git merge-base 4cbae45566fe59acc44c65c8d8ef65d8434322cf abe53bce920a22add55eb0d8e856589e7f046e1e)
git cherry-pick -x $ancref..abe53bce920a22add55eb0d8e856589e7f046e1e |
BTW great catch 💪 |
8512: [Backport 1.3]: test: increment time continously r=deepthidevaki a=Zelldon ## Description Backports #8508 problems with cherry-pick, because of the import order. > In order to prevent for flakiness the time needs to be increased everytime so we can retrigger the position distribution. <!-- Please explain the changes you made here. --> ## Related issues <!-- Which issues are closed by this PR or are related --> closes #8475 Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
8512: [Backport 1.3]: test: increment time continously r=Zelldon a=Zelldon ## Description Backports #8508 problems with cherry-pick, because of the import order. > In order to prevent for flakiness the time needs to be increased everytime so we can retrigger the position distribution. <!-- Please explain the changes you made here. --> ## Related issues <!-- Which issues are closed by this PR or are related --> closes #8475 Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
8511: [Backport 1.2] test: increment time continuously r=Zelldon a=Zelldon ## Description Backports #8508 problems with cherry-pick, because of the import order. <!-- Please explain the changes you made here. --> ## Related issues <!-- Which issues are closed by this PR or are related --> closes #8475 Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
8512: [Backport 1.3]: test: increment time continously r=Zelldon a=Zelldon ## Description Backports #8508 problems with cherry-pick, because of the import order. > In order to prevent for flakiness the time needs to be increased everytime so we can retrigger the position distribution. <!-- Please explain the changes you made here. --> ## Related issues <!-- Which issues are closed by this PR or are related --> closes #8475 Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
Description
In order to prevent for flakiness the time needs to be increased
everytime so we can retrigger the position distribution.
Related issues
closes #8475
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
backport stable/0.25
) to the PR, in case that fails you need to create backports manually.Testing:
Documentation: