From 8391bb5405622c6205c142c47f8aa1c67bd38580 Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Thu, 12 Oct 2023 06:56:23 -0700 Subject: [PATCH 1/6] enable test --- zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala index 6172b35a3b..5e0e140a6a 100644 --- a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala +++ b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala @@ -291,7 +291,7 @@ object RoundtripSpec extends ZIOHttpSpec { ("name", 10, Post(1, "title", "body", 111)), "name: name, value: 10, post: Post(1,title,body,111)", ) - } @@ ifEnvNotSet("CI"), + }, test("endpoint error returned") { val api = Endpoint(POST / "test") .outError[String](Status.Custom(999)) From 93df31ae0a5b520276535cdc74737feb493737cc Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Thu, 12 Oct 2023 07:22:55 -0700 Subject: [PATCH 2/6] enable test --- zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala index 5e0e140a6a..eff5ce37ab 100644 --- a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala +++ b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala @@ -460,7 +460,7 @@ object RoundtripSpec extends ZIOHttpSpec { s"name: xyz, value: 100, count: ${1024 * 1024}", ) } - } @@ ifEnvNotSet("CI"), + }, ).provide( Server.live, ZLayer.succeed(Server.Config.default.onAnyOpenPort.enableRequestStreaming), From 7190a6fdbea6363fc9ad053d45ab99b16121f179 Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Thu, 12 Oct 2023 07:43:46 -0700 Subject: [PATCH 3/6] revert --- zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala index eff5ce37ab..5e0e140a6a 100644 --- a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala +++ b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala @@ -460,7 +460,7 @@ object RoundtripSpec extends ZIOHttpSpec { s"name: xyz, value: 100, count: ${1024 * 1024}", ) } - }, + } @@ ifEnvNotSet("CI"), ).provide( Server.live, ZLayer.succeed(Server.Config.default.onAnyOpenPort.enableRequestStreaming), From ef2346597690680f35c860efab11f6abd8cf5cc1 Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Thu, 12 Oct 2023 17:53:03 -0700 Subject: [PATCH 4/6] fix test --- .../main/scala/zio/http/netty/NettyBody.scala | 30 ++++++++++--------- .../zio/http/endpoint/RoundtripSpec.scala | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/zio-http/src/main/scala/zio/http/netty/NettyBody.scala b/zio-http/src/main/scala/zio/http/netty/NettyBody.scala index efa698ce52..cac6af0a5c 100644 --- a/zio-http/src/main/scala/zio/http/netty/NettyBody.scala +++ b/zio-http/src/main/scala/zio/http/netty/NettyBody.scala @@ -123,21 +123,23 @@ object NettyBody extends BodyEncoding { override def asStream(implicit trace: Trace): ZStream[Any, Throwable, Byte] = ZStream - .async[Any, Throwable, Byte](emit => - try { - unsafeAsync(new UnsafeAsync { - override def apply(message: Chunk[Byte], isLast: Boolean): Unit = { - emit(ZIO.succeed(message)) - if (isLast) { - emit(ZIO.fail(None)) + .async[Any, Throwable, Byte]( + emit => + try { + unsafeAsync(new UnsafeAsync { + override def apply(message: Chunk[Byte], isLast: Boolean): Unit = { + emit(ZIO.succeed(message)) + if (isLast) { + emit(ZIO.fail(None)) + } } - } - override def fail(cause: Throwable): Unit = - emit(ZIO.fail(Some(cause))) - }) - } catch { - case e: Throwable => emit(ZIO.fail(Option(e))) - }, + override def fail(cause: Throwable): Unit = + emit(ZIO.fail(Some(cause))) + }) + } catch { + case e: Throwable => emit(ZIO.fail(Option(e))) + }, + 4096, ) override def isComplete: Boolean = false diff --git a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala index 5e0e140a6a..eff5ce37ab 100644 --- a/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala +++ b/zio-http/src/test/scala/zio/http/endpoint/RoundtripSpec.scala @@ -460,7 +460,7 @@ object RoundtripSpec extends ZIOHttpSpec { s"name: xyz, value: 100, count: ${1024 * 1024}", ) } - } @@ ifEnvNotSet("CI"), + }, ).provide( Server.live, ZLayer.succeed(Server.Config.default.onAnyOpenPort.enableRequestStreaming), From 2c29c63eec670b24b253b34c0b2c340c011ff48f Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Thu, 12 Oct 2023 18:26:34 -0700 Subject: [PATCH 5/6] try to enable some more tests --- zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala b/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala index a8b3b78004..58226f4369 100644 --- a/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala +++ b/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala @@ -166,7 +166,7 @@ object ClientStreamingSpec extends HttpRunnableSpec { ) } } yield result - } @@ samples(50) @@ TestAspect.ifEnvNotSet("CI"), + } @@ samples(50), test("decoding random pre-encoded form") { for { port <- server(streamingServer) @@ -199,7 +199,7 @@ object ClientStreamingSpec extends HttpRunnableSpec { ) } } yield result - } @@ samples(50) @@ TestAspect.ifEnvNotSet("CI"), + } @@ samples(50), test("decoding large form with random chunk and buffer sizes") { val N = 1024 * 1024 for { @@ -234,7 +234,7 @@ object ClientStreamingSpec extends HttpRunnableSpec { )).tapErrorCause(cause => ZIO.debug(cause.prettyPrint)) } } yield result - } @@ samples(20) @@ TestAspect.ifEnvNotSet("CI"), + } @@ samples(20), test("failed stream") { for { port <- server(streamingServer) From 119910f79a9ec0b698669fd747dbf87ba5578855 Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Thu, 12 Oct 2023 18:45:37 -0700 Subject: [PATCH 6/6] revert --- zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala b/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala index 58226f4369..a8b3b78004 100644 --- a/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala +++ b/zio-http/src/test/scala/zio/http/ClientStreamingSpec.scala @@ -166,7 +166,7 @@ object ClientStreamingSpec extends HttpRunnableSpec { ) } } yield result - } @@ samples(50), + } @@ samples(50) @@ TestAspect.ifEnvNotSet("CI"), test("decoding random pre-encoded form") { for { port <- server(streamingServer) @@ -199,7 +199,7 @@ object ClientStreamingSpec extends HttpRunnableSpec { ) } } yield result - } @@ samples(50), + } @@ samples(50) @@ TestAspect.ifEnvNotSet("CI"), test("decoding large form with random chunk and buffer sizes") { val N = 1024 * 1024 for { @@ -234,7 +234,7 @@ object ClientStreamingSpec extends HttpRunnableSpec { )).tapErrorCause(cause => ZIO.debug(cause.prettyPrint)) } } yield result - } @@ samples(20), + } @@ samples(20) @@ TestAspect.ifEnvNotSet("CI"), test("failed stream") { for { port <- server(streamingServer)