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

fix: avoid failing when running with testOnly mode #492

Conversation

sebastian-alfers
Copy link
Contributor

Before this pr, this test failed when running sbt 'testOnly *.CurrentPersistenceIdsQuerySpec' as it causes a false negative for wrongly sorted set cased by single / multi digits edge case for generated ids.

@@ -65,7 +65,7 @@ class CurrentPersistenceIdsQuerySpec
"Event Sourced currentPersistenceIds" should {
"retrieve all ids" in {
val result = query.currentPersistenceIds().runWith(Sink.seq).futureValue
result shouldBe pids.map(_.id)
result shouldBe pids.map(_.id).sorted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same problem for the other tests in this Spec? I think you can add a sort at the val pids instead

val pids .... .sortBy(_.id)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I though the same initially (val pids = ... .sortBy(_.id)). But when doing that, another spec fails in that file (retrieve ids for entity type after id) so I kept it in this single place where all seems to pass fine 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, the problem is the usage of nextEntityType, since for example EntityType-9 is sorted after Entitytype-10, so it depends on where the counter starts at. I think that since this test depends on sorting being the same as in the db it's best to not use that nextEntityType here. Instead, create them as:

private val entityTypes = (1 to numberOfEntityTypes).map(n => "Entity" + zeros.drop(n.toString.length) + n)

Then no further sorting should be needed.

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johanandren johanandren merged commit 46adcc6 into akka:main Dec 18, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants