Skip to content

Commit

Permalink
Only increase timeout for flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
  • Loading branch information
DerSchwilk committed Oct 13, 2022
1 parent 9e6a527 commit 998336a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ protected void expectAndAnswerSudoRetrieveThing(final Object sudoRetrieveThingRe
thingPersistenceActorProbe.reply(sudoRetrieveThingResponse);
}

protected void expectAndAnswerSudoRetrieveThingWithSpecificTimeout(final Object sudoRetrieveThingResponse,
final FiniteDuration timeout) {

final SudoRetrieveThing sudoRetrieveThing =
thingPersistenceActorProbe.expectMsgClass(timeout, SudoRetrieveThing.class);
assertThat((CharSequence) sudoRetrieveThing.getEntityId()).isEqualTo(THING_ID);
thingPersistenceActorProbe.reply(sudoRetrieveThingResponse);
}


protected void expectAndAnswerRetrievePolicy(final PolicyId policyId, final Object retrievePolicyResponse) {
final var retrievePolicy = policiesShardRegionProbe.expectMsgClass(RetrievePolicy.class);
assertThat((CharSequence) retrievePolicy.getEntityId()).isEqualTo(policyId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

import org.eclipse.ditto.base.model.auth.AuthorizationContext;
import org.eclipse.ditto.base.model.auth.AuthorizationSubject;
Expand Down Expand Up @@ -87,7 +88,8 @@ public void rejectMessageCommandByPolicy() {

new TestKit(system) {{
supervisor.tell(thingMessageCommand("abc"), getRef());
expectAndAnswerSudoRetrieveThing(sudoRetrieveThingResponse);
expectAndAnswerSudoRetrieveThingWithSpecificTimeout(sudoRetrieveThingResponse, FiniteDuration.apply(15,
TimeUnit.SECONDS));
TestSetup.fishForMsgClass(this, MessageSendNotAllowedException.class);
}};
}
Expand Down

0 comments on commit 998336a

Please sign in to comment.