Skip to content

Commit 8b222c6

Browse files
authored
fix: handle duplicate random shards in PendingGetShardHomesSpec (#32798)
1 parent 783d6aa commit 8b222c6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

akka-cluster-sharding/src/test/scala/akka/cluster/sharding/PendingGetShardHomesSpec.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ class PendingGetShardHomesSpec extends AnyWordSpec with BeforeAndAfterAll with M
6666

6767
val (r2s, postRemove) = postAdds2.removeRequestsForShard(shard1)
6868
(r2s should contain).allOf(replyToProbe1.ref, replyToProbe2.ref)
69-
postRemove.requestsByShard.keySet should contain only (shard2)
70-
postRemove.requestsByShard(shard2) shouldBe empty
69+
// if shard1 == shard2, there are no requests by shard, otherwise shard2 remains
70+
postRemove.requestsByShard.keySet should contain theSameElementsAs Set(shard1, shard2).excl(shard1)
71+
if (shard1 != shard2) {
72+
postRemove.requestsByShard(shard2) shouldBe empty
73+
}
7174
}
7275

7376
"should remove a request for the shard with the most requests" in {

0 commit comments

Comments
 (0)