Skip to content

Commit

Permalink
Merge pull request #927 from bosch-io/bugfix/mongo-it-timing
Browse files Browse the repository at this point in the history
Relax timing requirement in MongoEventSourceITAssertions.
  • Loading branch information
jokraehe authored Dec 23, 2020
2 parents b7d5f5b + 0379451 commit 510e3ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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);
}
}

}

0 comments on commit 510e3ae

Please sign in to comment.