From 33c7264874ce58d0b8c4381d0e60cae81ab9e246 Mon Sep 17 00:00:00 2001 From: Amit Kumar Singh Date: Thu, 13 Jan 2022 19:55:02 +0530 Subject: [PATCH] Delete commented websocket tests (#826) --- .../zhttp/internal/HttpRunnableSpec.scala | 24 -------------- .../zhttp/service/WebSocketServerSpec.scala | 31 ------------------- 2 files changed, 55 deletions(-) delete mode 100644 zio-http/src/test/scala/zhttp/service/WebSocketServerSpec.scala diff --git a/zio-http/src/test/scala/zhttp/internal/HttpRunnableSpec.scala b/zio-http/src/test/scala/zhttp/internal/HttpRunnableSpec.scala index dd8ab9f2d9..68ee9cf687 100644 --- a/zio-http/src/test/scala/zhttp/internal/HttpRunnableSpec.scala +++ b/zio-http/src/test/scala/zhttp/internal/HttpRunnableSpec.scala @@ -56,22 +56,6 @@ abstract class HttpRunnableSpec extends DefaultRunnableSpec { self => } yield status } - def webSocketRequest( - path: Path = !!, - headers: Headers = Headers.empty, - ) = ??? - // ): HttpIO[SttpClient, SResponse[Either[String, WebSocket[Task]]]] = { - // import zhttp.Client - - // // todo: uri should be created by using URL().asString but currently support for ws Scheme is missing - // for { - // port <- DynamicServer.getPort - // url = s"ws://localhost:$port${path.asString}" - // headerConv: List[SHeader] = headers.toList.map(h => SHeader(h._1, h._2)) - // res <- send(basicRequest.get(uri"$url").copy(headers = headerConv).response(asWebSocketUnsafe)) - // } yield res - // } - implicit class RunnableHttpAppSyntax(app: HttpApp[HttpEnv, Throwable]) { def deploy: ZIO[DynamicServer, Nothing, String] = DynamicServer.deploy(app) @@ -109,14 +93,6 @@ abstract class HttpRunnableSpec extends DefaultRunnableSpec { self => ): HttpIO[Any, Status] = request(path, method, content, headers).map(_.status) - def webSocketStatusCode( - path: Path = !!, - headers: Headers = Headers.empty, - ) = ??? /*: HttpIO[SttpClient, Int] = for { - id <- deploy - res <- self.webSocketRequest(path, Headers(DynamicServer.APP_ID, id) ++ headers) - } yield res.code.code*/ - def requestBody( path: Path = !!, method: Method = Method.GET, diff --git a/zio-http/src/test/scala/zhttp/service/WebSocketServerSpec.scala b/zio-http/src/test/scala/zhttp/service/WebSocketServerSpec.scala deleted file mode 100644 index 758bb3bc0b..0000000000 --- a/zio-http/src/test/scala/zhttp/service/WebSocketServerSpec.scala +++ /dev/null @@ -1,31 +0,0 @@ -package zhttp.service - -// import sttp.client3.asynchttpclient.zio.AsyncHttpClientZioBackend -import zhttp.internal.{DynamicServer, HttpRunnableSpec} -import zhttp.service.server._ -import zio._ -import zio.test.TestAspect.timeout - -object WebSocketServerSpec extends HttpRunnableSpec { - - override def spec = suite("Server") { - serverApp.as(List(websocketSpec)).useNow - }.provideCustomLayerShared(serverEnv) @@ timeout(30.seconds) - - def websocketSpec = suite("WebSocket Server")() /* { - suite("connections") { - testM("Multiple websocket upgrades") { - val response = Socket.succeed(WebSocketFrame.text("BAR")).toResponse - val app = Http.fromEffect(response) - assertM(app.webSocketStatusCode(!! / "subscriptions").repeatN(1024))(equalTo(101)) - } - } - }*/ - - def serverEnv = - EventLoopGroup.nio() ++ ServerChannelFactory.nio ++ /*AsyncHttpClientZioBackend - .layer() - .orDie ++*/ DynamicServer.live ++ ChannelFactory.nio - - def serverApp = serve { DynamicServer.app } -}