Skip to content

Commit 5ce6acd

Browse files
committed
fix incorrect deprecation fix on Dispatcher
1 parent 392556c commit 5ce6acd

7 files changed

Lines changed: 7 additions & 9 deletions

File tree

client/sttp-client/src/test/scalajvm/sttp/tapir/client/sttp/SttpClientTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import sttp.tapir.client.tests.ClientTests
1010
import sttp.tapir.{DecodeResult, Endpoint}
1111

1212
abstract class SttpClientTests[R >: WebSockets with Fs2Streams[IO]] extends ClientTests[R] {
13-
val (dispatcher, closeDispatcher) = Dispatcher[IO].allocated.unsafeRunSync()
13+
val (dispatcher, closeDispatcher) = Dispatcher.parallel[IO].allocated.unsafeRunSync()
1414
val backend: SttpBackend[IO, R] = HttpClientFs2Backend[IO](dispatcher).unsafeRunSync()
1515
def wsToPipe: WebSocketToPipe[R]
1616

server/netty-server/cats/src/test/scala/sttp/tapir/server/netty/cats/NettyCatsServerStubTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import scala.concurrent.duration.Duration
1212
import scala.concurrent.{Await, Future}
1313

1414
class NettyCatsCreateServerStubTest extends CreateServerStubTest[IO, NettyCatsServerOptions[IO]] {
15-
val (dispatcher, shutdownDispatcher) = Dispatcher[IO].allocated.unsafeRunSync()
15+
val (dispatcher, shutdownDispatcher) = Dispatcher.parallel[IO].allocated.unsafeRunSync()
1616

1717
override def customiseInterceptors: CustomiseInterceptors[IO, NettyCatsServerOptions[IO]] =
1818
NettyCatsServerOptions.customiseInterceptors[IO](dispatcher)

server/tests/src/main/scala/sttp/tapir/server/tests/ServerCancellationTests.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ class ServerCancellationTests[F[_], OPTIONS, ROUTE](createServerTest: CreateServ
3535
val resp: IO[_] = basicRequest.get(uri"$baseUri").readTimeout(300.millis).send(backend)
3636

3737
resp
38-
.map { case result =>
39-
fail(s"Expected cancellation, but received a result: $result")
40-
}
38+
.map(result => fail(s"Expected cancellation, but received a result: $result"))
4139
.handleErrorWith {
4240
case _: SttpClientException.TimeoutException => // expected, this is how we trigged client-side cancellation
4341
IO(

server/tests/src/main/scala/sttp/tapir/server/tests/TestServerInterpreter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ trait TestServerInterpreter[F[_], +R, OPTIONS, ROUTE] {
2424
): Resource[IO, (Port, KillSwitch)] = for {
2525
stopSignal <- Resource.eval(Deferred[IO, Unit])
2626
portValue <- Resource.eval(Deferred[IO, Port])
27-
_ <- server(routes, gracefulShutdownTimeout).evalTap(portValue.complete).use(_ => stopSignal.get).background
27+
_ <- server(routes, gracefulShutdownTimeout).evalTap(portValue.complete).surround(stopSignal.get).background
2828
port <- Resource.eval(portValue.get)
2929
} yield (port, stopSignal.complete(()).void)
3030

server/vertx-server/cats/src/test/scala/sttp/tapir/server/vertx/cats/VertxStubServerTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import sttp.tapir.server.tests.{CreateServerStubTest, ServerStubStreamingTest, S
1212
import scala.concurrent.Future
1313

1414
class VertxCatsCreateServerStubTest extends CreateServerStubTest[IO, VertxCatsServerOptions[IO]] {
15-
private val (dispatcher, shutdownDispatcher) = Dispatcher.sequential[IO].allocated.unsafeRunSync()
15+
private val (dispatcher, shutdownDispatcher) = Dispatcher.parallel[IO].allocated.unsafeRunSync()
1616

1717
override def customiseInterceptors: CustomiseInterceptors[IO, VertxCatsServerOptions[IO]] =
1818
VertxCatsServerOptions.customiseInterceptors(dispatcher)

server/vertx-server/cats/src/test/scala/sttp/tapir/server/vertx/cats/streams/Fs2StreamTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import scala.concurrent.duration._
1818

1919
class Fs2StreamTest extends AsyncFlatSpec with Matchers with BeforeAndAfterAll {
2020

21-
private val (dispatcher, shutdownDispatcher) = Dispatcher.sequential[IO].allocated.unsafeRunSync()
21+
private val (dispatcher, shutdownDispatcher) = Dispatcher.parallel[IO].allocated.unsafeRunSync()
2222

2323
override protected def afterAll(): Unit = {
2424
shutdownDispatcher.unsafeRunSync()

tests/src/main/scalajvm/sttp/tapir/tests/TestSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait TestSuite extends AsyncFunSuite with BeforeAndAfterAll {
1111
def tests: Resource[IO, List[Test]]
1212
def testNameFilter: Option[String] = None // define to run a single test (temporarily for debugging)
1313

14-
protected val (dispatcher, shutdownDispatcher) = Dispatcher.sequential[IO].allocated.unsafeRunSync()
14+
protected val (dispatcher, shutdownDispatcher) = Dispatcher.parallel[IO].allocated.unsafeRunSync()
1515

1616
// we need to register the tests when the class is constructed, as otherwise scalatest skips it
1717
val (allTests, doRelease) = tests.allocated.unsafeRunSync()

0 commit comments

Comments
 (0)