-
Notifications
You must be signed in to change notification settings - Fork 595
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
http-tests: allow to compile with Scala 3 with 3.0-migration option #4107
Conversation
complete { | ||
measurementsSubmitted.map(n => Map("msg" -> s"""Total metrics received: $n""")) | ||
implicit val preciseFormat: RootJsonFormat[Map[String, String]] = mapFormat // workaround for Scala 3 | ||
ToResponseMarshallable(measurementsSubmitted.map((n: Int) => Map[String, String]("msg" -> s"""Total metrics received: $n"""))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is interesting I think - without the additional implicit brought closer in scope the compiler would claim to have found conflicting RootJsonFormats in CollectionConverters
- they were iterableFormat
and immIterableFormat
instead of mapFormat. Not sure why that is yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think we can live with the few warts.
@@ -230,7 +230,7 @@ class SizeLimitSpec extends AnyWordSpec with Matchers with RequestBuilding with | |||
|
|||
private def chunkedEntityOfSize(size: Int) = HttpEntity.Chunked(ContentTypes.`text/plain(UTF-8)`, byteSource(size).map(Chunk(_))) | |||
private def nonChunkedEntityOfSize(size: Int): MessageEntity = HttpEntity.Default(ContentTypes.`text/plain(UTF-8)`, size, byteSource(size)) | |||
private def entityOfSize(size: Int) = HttpEntity(ContentTypes.`text/plain(UTF-8)`, "0" * size) | |||
private def entityOfSize(size: Int) = HttpEntity(ContentTypes.`text/plain(UTF-8)`, "0" * (size)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, what's the error message otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry! This is a leftover I missed when cleaning up commits. This is one of the places that error out when running without 3.0-migration option and I was trying to figure out what was going on. I'll go through the PR once again to see if there are more of those. Thank you for catching that.
akka-http-tests/src/test/scala/akka/http/scaladsl/server/util/TupleOpsSpec.scala
Show resolved
Hide resolved
akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/RouteDirectivesSpec.scala
Outdated
Show resolved
Hide resolved
Let's see what CI says about this... |
akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/RouteDirectivesSpec.scala
Show resolved
Hide resolved
983d026
to
c4e2c49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrudolph Thank you for catching the Scala 2 issues, I have updated the PR hopefully making it work on both as well as removing the some previous spurious changes.
akka-http-tests/src/test/scala/akka/http/scaladsl/server/EntityStreamingSpec.scala
Outdated
Show resolved
Hide resolved
akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/RouteDirectivesSpec.scala
Outdated
Show resolved
Hide resolved
…tives/RouteDirectivesSpec.scala Try to fix SprayJsonSupport problems for both Scala 2 and 3
Thanks a lot @jchyb! |
This also includes
akka-http-spray-json
andakka-http-scala-xml
, on which the tests depend.Because of changes to type inference, some tests had to be slightly adjusted (beyond defining types explicitly). They all compile, though running tests locally concludes with a somewhat confusing message:
3.0-migration
compiler option was used - there are still some errors when compiling without it that I was not able to iron out yet.References #4079, tasks
akka-http-tests
(with 3.0-migration option),akka-http-spray-json
,akka-http-scala-xml