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

Relax timing requirement in MongoEventSourceITAssertions. #927

Merged
merged 3 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- uses: actions/checkout@v2
- uses: jitterbit/get-changed-files@v1
id: the-files
continue-on-error: true
- name: Printing added files
run: |
echo "Added:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeUnit;

import org.eclipse.ditto.model.base.entity.id.DefaultEntityId;
import org.eclipse.ditto.model.base.entity.id.EntityId;
Expand Down Expand Up @@ -293,10 +295,12 @@ private void purgeEntities(final Config config, final boolean prependNamespace)
underTest.tell(purgeEntities, getRef());
expectMsg(Duration.ofSeconds(8), PurgeEntitiesResponse.successful(entityType, dittoHeaders));

sleep(Duration.ofSeconds(5L));

// restart the actors for the purged entities - they should work as if its entity never existed
final ActorRef purgedActor1 = watch(startEntityActor(actorSystem, pubSubMediator, purgedId1));
purgedActor1.tell(getRetrieveEntityCommand(purgedId1), getRef());
expectMsgClass(getEntityNotAccessibleClass());
expectMsgClass(Duration.ofSeconds(10L), getEntityNotAccessibleClass());

final ActorRef purgedActor2 = watch(startEntityActor(actorSystem, pubSubMediator, purgedId2));
purgedActor2.tell(getRetrieveEntityCommand(purgedId2), getRef());
Expand Down Expand Up @@ -327,4 +331,12 @@ private static String prependNamespace(final String id, final String ns, final b
}
}

private static void sleep(final Duration duration) {
try {
TimeUnit.MILLISECONDS.sleep(duration.toMillis());
} catch (final Exception e) {
throw new CompletionException(e);
}
}

}