Skip to content

Commit

Permalink
Upgrade to ZIO 2.0.0-RC5 (#1194)
Browse files Browse the repository at this point in the history
* upgrade zio version

* increase timeout
  • Loading branch information
adamgfraser authored Apr 15, 2022
1 parent 6bed62d commit a50397f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Dependencies {
val NettyVersion = "4.1.75.Final"
val NettyIncubatorVersion = "0.0.13.Final"
val ScalaCompactCollectionVersion = "2.7.0"
val ZioVersion = "2.0.0-RC4"
val ZioVersion = "2.0.0-RC5"
val SttpVersion = "3.3.18"

val `jwt-core` = "com.github.jwt-scala" %% "jwt-core" % JwtCoreVersion
Expand Down
10 changes: 5 additions & 5 deletions zio-http/src/main/scala/zhttp/service/ChannelFactory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import io.netty.incubator.channel.uring.IOUringSocketChannel
import zio.{UIO, ZIO, ZLayer}

object ChannelFactory {
def nio: ZLayer[Any, Nothing, ChannelFactory] = Live.nio.toLayer
def epoll: ZLayer[Any, Nothing, ChannelFactory] = Live.epoll.toLayer
def uring: ZLayer[Any, Nothing, ChannelFactory] = Live.uring.toLayer
def embedded: ZLayer[Any, Nothing, ChannelFactory] = Live.embedded.toLayer
def auto: ZLayer[Any, Nothing, ChannelFactory] = Live.auto.toLayer
def nio: ZLayer[Any, Nothing, ChannelFactory] = ZLayer(Live.nio)
def epoll: ZLayer[Any, Nothing, ChannelFactory] = ZLayer(Live.epoll)
def uring: ZLayer[Any, Nothing, ChannelFactory] = ZLayer(Live.uring)
def embedded: ZLayer[Any, Nothing, ChannelFactory] = ZLayer(Live.embedded)
def auto: ZLayer[Any, Nothing, ChannelFactory] = ZLayer(Live.auto)

def make[A <: Channel](fn: () => A): UIO[JChannelFactory[A]] = ZIO.succeed(new JChannelFactory[A] {
override def newChannel(): A = fn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import zhttp.service.{ChannelFactory, ServerChannelFactory}
import zio.{UIO, ZLayer}

object ServerChannelFactory {
def nio: ZLayer[Any, Nothing, ServerChannelFactory] = Live.nio.toLayer
def epoll: ZLayer[Any, Nothing, ServerChannelFactory] = Live.epoll.toLayer
def uring: ZLayer[Any, Nothing, ServerChannelFactory] = Live.uring.toLayer
def auto: ZLayer[Any, Nothing, ServerChannelFactory] = Live.auto.toLayer
def nio: ZLayer[Any, Nothing, ServerChannelFactory] = ZLayer(Live.nio)
def epoll: ZLayer[Any, Nothing, ServerChannelFactory] = ZLayer(Live.epoll)
def uring: ZLayer[Any, Nothing, ServerChannelFactory] = ZLayer(Live.uring)
def auto: ZLayer[Any, Nothing, ServerChannelFactory] = ZLayer(Live.auto)

object Live {
def nio: UIO[JChannelFactory[ServerChannel]] = ChannelFactory.make(() => new NioServerSocketChannel())
Expand Down
2 changes: 1 addition & 1 deletion zio-http/src/test/scala/zhttp/http/HExitSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import zio.test._
import zio.{ZIO, durationInt}

object HExitSpec extends ZIOSpecDefault with HExitAssertion {
def spec: ZSpec[Environment, Failure] = {
def spec: ZSpec[Environment, Any] = {
import HExit._
suite("HExit")(
test("out") {
Expand Down
13 changes: 7 additions & 6 deletions zio-http/src/test/scala/zhttp/internal/DynamicServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ object DynamicServer {

def httpURL: ZIO[DynamicServer, Nothing, String] = baseURL(Scheme.HTTP)

def live: ZLayer[Any, Nothing, DynamicServer] = {
for {
ref <- Ref.make(Map.empty[Id, HttpApp[Any, Throwable]])
pr <- Promise.make[Nothing, Start]
} yield new Live(ref, pr)
}.toLayer
def live: ZLayer[Any, Nothing, DynamicServer] =
ZLayer {
for {
ref <- Ref.make(Map.empty[Id, HttpApp[Any, Throwable]])
pr <- Promise.make[Nothing, Start]
} yield new Live(ref, pr)
}

def port: ZIO[DynamicServer, Nothing, Int] = ZIO.environmentWithZIO[DynamicServer](_.get.port)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object WebSocketServerSpec extends HttpRunnableSpec {

override def spec = suite("Server") {
app.as(List(websocketServerSpec, websocketFrameSpec))
}.provideLayerShared(env) @@ timeout(10 seconds)
}.provideLayerShared(env) @@ timeout(60 seconds) @@ zio.test.TestAspect.withLiveClock

def websocketServerSpec = suite("WebSocketServer") {
suite("connections") {
Expand Down

0 comments on commit a50397f

Please sign in to comment.