-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update zio, zio-streams, zio-test, ... to 1.0.0-RC18 (#53)
* Update zio, zio-streams, zio-test, ... to 1.0.0-RC18 * Update code for ZIO RC18 Co-authored-by: Pierre Ricadat <[email protected]>
- Loading branch information
1 parent
0c00970
commit 4e09c7b
Showing
8 changed files
with
269 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,44 +3,43 @@ package zio.akka.cluster | |
import akka.actor.ActorSystem | ||
import akka.cluster.ClusterEvent.MemberLeft | ||
import com.typesafe.config.{ Config, ConfigFactory } | ||
import zio.{ Managed, Task } | ||
import zio.test._ | ||
import zio.test.Assertion._ | ||
import zio.test._ | ||
import zio.test.environment.TestEnvironment | ||
import zio.{ Managed, Task, ZLayer } | ||
|
||
object ClusterSpec extends DefaultRunnableSpec { | ||
|
||
object ClusterSpec | ||
extends DefaultRunnableSpec( | ||
suite("ClusterSpec")( | ||
testM("receive cluster events") { | ||
val config: Config = ConfigFactory.parseString(s""" | ||
|akka { | ||
| actor { | ||
| provider = "cluster" | ||
| } | ||
| remote { | ||
| netty.tcp { | ||
| hostname = "127.0.0.1" | ||
| port = 2551 | ||
| } | ||
| } | ||
| cluster { | ||
| seed-nodes = ["akka.tcp://[email protected]:2551"] | ||
| } | ||
|} | ||
def spec: ZSpec[TestEnvironment, Any] = | ||
suite("ClusterSpec")( | ||
testM("receive cluster events") { | ||
val config: Config = ConfigFactory.parseString(s""" | ||
|akka { | ||
| actor { | ||
| provider = "cluster" | ||
| } | ||
| remote { | ||
| netty.tcp { | ||
| hostname = "127.0.0.1" | ||
| port = 2551 | ||
| } | ||
| } | ||
| cluster { | ||
| seed-nodes = ["akka.tcp://[email protected]:2551"] | ||
| } | ||
|} | ||
""".stripMargin) | ||
|
||
val actorSystem: Managed[Throwable, ActorSystem] = | ||
Managed.make(Task(ActorSystem("Test", config)))(sys => Task.fromFuture(_ => sys.terminate()).either) | ||
val actorSystem: Managed[Throwable, ActorSystem] = | ||
Managed.make(Task(ActorSystem("Test", config)))(sys => Task.fromFuture(_ => sys.terminate()).either) | ||
|
||
assertM( | ||
actorSystem.use(actorSystem => | ||
(for { | ||
queue <- Cluster.clusterEvents() | ||
_ <- Cluster.leave | ||
item <- queue.take | ||
} yield item).provide(actorSystem) | ||
), | ||
isSubtype[MemberLeft](anything) | ||
) | ||
} | ||
) | ||
assertM( | ||
for { | ||
queue <- Cluster.clusterEvents() | ||
_ <- Cluster.leave | ||
item <- queue.take | ||
} yield item | ||
)(isSubtype[MemberLeft](anything)).provideLayer(ZLayer.fromManaged(actorSystem)) | ||
} | ||
) | ||
} |
Oops, something went wrong.