* from the logs we can see that an ActorRef from previous test is still active * probably counted in the TopicStats
This commit is contained in:
parent
b859d9fc48
commit
9b50b03001
1 changed files with 12 additions and 13 deletions
|
|
@ -8,7 +8,6 @@ import scala.concurrent.duration._
|
||||||
|
|
||||||
import org.scalatest.wordspec.AnyWordSpecLike
|
import org.scalatest.wordspec.AnyWordSpecLike
|
||||||
|
|
||||||
import akka.testkit.GHExcludeTest
|
|
||||||
import akka.actor.testkit.typed.scaladsl.LogCapturing
|
import akka.actor.testkit.typed.scaladsl.LogCapturing
|
||||||
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
|
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
|
||||||
import akka.actor.typed.internal.pubsub.TopicImpl
|
import akka.actor.typed.internal.pubsub.TopicImpl
|
||||||
|
|
@ -17,9 +16,8 @@ class LocalPubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wit
|
||||||
|
|
||||||
"A pub-sub topic running locally" must {
|
"A pub-sub topic running locally" must {
|
||||||
|
|
||||||
// Excluded in GH Actions: https://github.com/akka/akka/issues/30466
|
"publish to all local subscriber actors of a topic" in {
|
||||||
"publish to all local subscriber actors of a topic" taggedAs GHExcludeTest in {
|
val fruitTopic = testKit.spawn(Topic[String]("fruit1"))
|
||||||
val fruitTopic = testKit.spawn(Topic[String]("fruit"))
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val probe1 = testKit.createTestProbe[String]()
|
val probe1 = testKit.createTestProbe[String]()
|
||||||
|
|
@ -50,8 +48,9 @@ class LocalPubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wit
|
||||||
}
|
}
|
||||||
|
|
||||||
"publish to all subscriber actors across several instances of the same topic" in {
|
"publish to all subscriber actors across several instances of the same topic" in {
|
||||||
val fruitTopic1 = testKit.spawn(Topic[String]("fruit"))
|
// using different topic name than in the previous test to avoid interference
|
||||||
val fruitTopic2 = testKit.spawn(Topic[String]("fruit"))
|
val fruitTopic1 = testKit.spawn(Topic[String]("fruit2"))
|
||||||
|
val fruitTopic2 = testKit.spawn(Topic[String]("fruit2"))
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val probe1 = testKit.createTestProbe[String]()
|
val probe1 = testKit.createTestProbe[String]()
|
||||||
|
|
@ -74,10 +73,10 @@ class LocalPubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wit
|
||||||
statsProbe.expectMessageType[TopicImpl.TopicStats].topicInstanceCount should ===(1)
|
statsProbe.expectMessageType[TopicImpl.TopicStats].topicInstanceCount should ===(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fruitTopic1 ! Topic.Publish("banana")
|
fruitTopic1 ! Topic.Publish("apple")
|
||||||
probe1.expectMessage("banana")
|
probe1.expectMessage("apple")
|
||||||
probe2.expectMessage("banana")
|
probe2.expectMessage("apple")
|
||||||
probe3.expectMessage("banana")
|
probe3.expectMessage("apple")
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
testKit.stop(fruitTopic1)
|
testKit.stop(fruitTopic1)
|
||||||
|
|
@ -87,7 +86,7 @@ class LocalPubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wit
|
||||||
|
|
||||||
"doesn't publish across topics unsubscribe" in {
|
"doesn't publish across topics unsubscribe" in {
|
||||||
val fruitTopic =
|
val fruitTopic =
|
||||||
testKit.spawn(Topic[String]("fruit"))
|
testKit.spawn(Topic[String]("fruit3"))
|
||||||
|
|
||||||
val veggieTopic =
|
val veggieTopic =
|
||||||
testKit.spawn(Topic[String]("veggies"))
|
testKit.spawn(Topic[String]("veggies"))
|
||||||
|
|
@ -118,7 +117,7 @@ class LocalPubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wit
|
||||||
}
|
}
|
||||||
|
|
||||||
"doesn't publish after unsubscribe" in {
|
"doesn't publish after unsubscribe" in {
|
||||||
val fruitTopic = testKit.spawn(Topic[String]("fruit"))
|
val fruitTopic = testKit.spawn(Topic[String]("fruit4"))
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val probe1 = testKit.createTestProbe[String]()
|
val probe1 = testKit.createTestProbe[String]()
|
||||||
|
|
@ -137,7 +136,7 @@ class LocalPubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wit
|
||||||
statsProbe.expectMessageType[TopicImpl.TopicStats].localSubscriberCount should ===(0)
|
statsProbe.expectMessageType[TopicImpl.TopicStats].localSubscriberCount should ===(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fruitTopic ! Topic.Publish("banana")
|
fruitTopic ! Topic.Publish("orange")
|
||||||
probe1.expectNoMessage(200.millis)
|
probe1.expectNoMessage(200.millis)
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue