-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test SlackApiClient hangs #3393
Comments
@ekskimn ok, so we'll need some more context/minimization here. BTW when posting the reproduction code, please provide the full example, including dependency directives - it may be important what exactly are you using and with what version. |
I see the same behavior for version My source file //> using dep com.softwaremill.sttp.tapir::tapir-core:1.11.11
//> using dep com.softwaremill.sttp.tapir::tapir-pekko-http-server:1.11.11
//> using dep ch.qos.logback:logback-classic:1.5.15
// TODO replace "dep" with "test.dep" after moving tests to /src/test
//> using dep org.scalatest::scalatest::3.2.19
//> using dep org.apache.pekko::pekko-stream-testkit:1.1.2
//> using dep org.apache.pekko::pekko-http-testkit:1.1.0
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.server.Route
import sttp.tapir._
import sttp.tapir.server.pekkohttp.PekkoHttpServerInterpreter
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
object Service {
implicit val system: ActorSystem = ActorSystem()
import system.dispatcher
val helloWorld =
endpoint.get.in("hello").in(query[String]("name")).out(stringBody)
val routes = PekkoHttpServerInterpreter().toRoute(
helloWorld.serverLogic(name => Future(Right(s"Hello, $name!")))
)
}
import org.apache.pekko.http.scaladsl.model.StatusCodes._
import org.apache.pekko.http.scaladsl.server._
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.testkit.ScalatestRouteTest
import org.apache.pekko.testkit.TestKit
import org.scalatest.BeforeAndAfterAll
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
class ServiceSpec extends AnyFunSpec with Matchers with ScalatestRouteTest {
import Service._
describe("GET /hello") {
val name1 = "Bart"
it("should respond to name query") {
Get(s"/hello?name=$name1") ~> routes ~> check {
status shouldBe OK
responseAs[String] shouldBe s"Hello, $name1!"
}
}
}
} If I run the test with $ scala-cli test Main.scala
Compiling project (Scala 3.5.2, JVM (17))
Compiled project (Scala 3.5.2, JVM (17))
ServiceSpec:
GET /hello
16:36:37.093 [ServiceSpec-pekko.actor.default-dispatcher-6] DEBUG sttp.tapir.server.pekkohttp.PekkoHttpServerInterpreter$ -- Request: GET /helloname=Bart, handled by: GET /hello, took: 92ms; response: 200
- should respond to name query
[INFO] [01/04/2025 16:36:37.141] [main] [CoordinatedShutdown(pekko://ServiceSpec)] Running CoordinatedShutdown with reason [ActorSystemTerminateReason]
Run completed in 830 milliseconds.
Total number of tests run: 1
Suites: completed 1, aborted 0
Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
All tests passed.
# The process doesn't end here
# I have to press <Ctrl+C> to exit |
@lsissoko are you sure the actor system/Pekko is shutdown after the tests are completed? |
Sorry for the late reply, i was occupied with a different fire. I also wanted to tinker a bit more and get you more information. So it wasn't a slack related error after all. It is when I use a future in my test. There are other tests which execute futures and which are successful and properly end. But some reason, this test class and another Here is a more simplified version of the test
But actually when done this way
it works as expected and the tests complete. I think the docs however have it as the former rather than the latter https://scalameta.org/munit/docs/tests.html#declare-async-test Curious to know if others have the same issue? |
@Gedochao actually no that actually did not work...sorry for the false alarm. I will try to get better information soon |
Version(s)
1.5.4
Describe the bug
When running tests with munit or scalatest, the tests execute and complete but the process hangs at the end and never finishes
To Reproduce
this is using slack-scala-client_3-1.0.1
when I run scala-cli test with this i see
but then nothing after it.
Expected behaviour
The cli should end the process and return back
The text was updated successfully, but these errors were encountered: