Skip to content

[Kaizen] Unflake PeerDiscoveryManagerSpec #1049

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

Merged
merged 1 commit into from
Jul 11, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,11 @@ import org.scalatest.matchers.should.Matchers
import scodec.bits.BitVector

import io.iohk.ethereum.NormalPatience
import io.iohk.ethereum.WithActorSystemShutDown
import io.iohk.ethereum.db.storage.KnownNodesStorage
import io.iohk.ethereum.utils.Config

class PeerDiscoveryManagerSpec
extends TestKit(ActorSystem("PeerDiscoveryManagerSpec_System"))
with AnyFlatSpecLike
with WithActorSystemShutDown
extends AnyFlatSpecLike
with Matchers
with Eventually
with MockFactory
Expand All @@ -64,6 +61,7 @@ class PeerDiscoveryManagerSpec
).map(new java.net.URI(_)).map(Node.fromUri)

trait Fixture {
implicit lazy val system: ActorSystem = ActorSystem("PeerDiscoveryManagerSpec_System")
lazy val discoveryConfig = defaultConfig
lazy val knownNodesStorage: KnownNodesStorage = mock[KnownNodesStorage]
lazy val discoveryService: DiscoveryService = mock[DiscoveryService]
Expand Down Expand Up @@ -93,7 +91,10 @@ class PeerDiscoveryManagerSpec

def test(fixture: Fixture): Unit =
try fixture.test()
finally system.stop(fixture.peerDiscoveryManager)
finally {
fixture.system.stop(fixture.peerDiscoveryManager)
TestKit.shutdownActorSystem(fixture.system, verifySystemShutdown = true)
}

def toENode(node: Node): ENode =
ENode(
Expand Down