-
Notifications
You must be signed in to change notification settings - Fork 554
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
Pre-scala 2.13: Update scalatest, scalacheck and scalatestplus.play #24927
Conversation
admin/test/package.scala
Outdated
@@ -13,5 +14,7 @@ class AdminTestSuite | |||
new controllers.admin.DeploysControllerTest, | |||
) | |||
with SingleServerSuite { | |||
override lazy val port: Int = 19015 | |||
|
|||
override implicit lazy val portNumber: PortNumber = PortNumber(19015) |
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.
We have to make this change because this test suite implements ServerProvider
(via SingleServerSuite
) and port is final in the new version of scalatestplus-play
so it cannot be overriden: https://github.com/playframework/scalatestplus-play/blob/main/module/src/main/scala/org/scalatestplus/play/ServerProvider.scala#L48.
applications/test/package.scala
Outdated
@@ -45,5 +45,7 @@ class ApplicationsTestSuite | |||
new InteractivePickerTest, | |||
) | |||
with SingleServerSuite { | |||
override lazy val port: Int = 19003 | |||
|
|||
// override implicit lazy val portNumber: PortNumber = PortNumber(19003) |
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.
I was expecting this change to be working like it does for other test suites, e.g. admin/test/package.scala
but all tests are passing only if it's completely removed.
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.
Example of tests failing: https://github.com/guardian/frontend/blob/main/common/test/model/ContentTest.scala. They seem to be Selenium tests
66f4e8e
to
a58c949
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.
Awesome!
a58c949
to
1282d68
Compare
As part of the upgrade to Scala 2.13 these dependecies are now compatible with both
…lus.play versions Remove overriding setting specific portNumber from test suites that implement SingleServerSuite because there seems to be automatic allocation of ports Co-authored-by: Olly Namey <olly.namey@guardian.co.uk> Co-authored-by: Roberto Tyley <roberto.tyley@guardian.co.uk>
1282d68
to
ab1b24b
Compare
Seen on PROD (merged by @ioannakok 13 minutes and 42 seconds ago)
|
Closes #24933
As part of the upgrade to Scala 2.13 these dependencies are now compatible with both 2.12 and 2.13
What does this change?
Dependencies
In
Dependencies.scala
:"org.scalacheck" %% "scalacheck" %
1.13.5
1.16.0
"org.scalatest" %% "scalatest"
3.0.4
3.2.11
"org.scalatestplus.play" %% "scalatestplus-play"
3.1.1
5.1.0
"org.scalatestplus" %% "mockito-3-4"
"3.3.0.0-SNAP3"
"org.scalatestplus" %% "scalacheck-1-15"
"3.2.11.0"
org.scalatestplus.mockito-3-4
had to be added to have access toMockitoSugar
. It is now imported fromorg.scalatestplus.mockito.MockitoSugar
org.scalatestplus.scalacheck-1-15
had to be added because instead of usingGeneratorDrivenPropertyChecks
we are now usingScalaCheckDrivenPropertyChecks
. The first was removed (scalatest
recommendation here: GeneratorDrivenPropertyChecks and PropertyChecks are Gone in 3.1.0 scalatest/scalatest#1735). The second is now imported fromorg.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
(e.g.common/test/layout/slices/DynamicContainerTest.scala
).Renaming / Re-importing
After the above dependencies are upgraded / added, the following changes had to be made in the test files:
because the previous classes were renamed in
scalatest:3.1.0
(https://www.scalatest.org/release_notes/3.1.0) and removed inscalatest:3.2.0
(https://www.scalatest.org/release_notes/3.2.0).Deprecated functions
feature
is deprecated. We're now usingFeature
scenario
is deprecated. We're now usingScenario
Doc here: https://javadoc.io/doc/org.scalatest/scalatest-featurespec_2.12/3.2.11/org/scalatest/featurespec/AnyFeatureSpec.html
In
identity/test/services/MembersDataApiServiceTest.scala
either.right
was replaced byeither.value
because the.right.value
syntax onEither
is deprecated and will be removed. We should use.value
: https://javadoc.io/doc/org.scalatest/scalatest-core_2.12/latest/org/scalatest/EitherValues.htmlRemove overriding the port in test suites that implement
SingleServerSuite
Overriding the port was introduced by this PR: #14736. However, in the new
scalatestplus-play
version it cannot be overriden as it'sfinal
: https://github.com/playframework/scalatestplus-play/blob/main/module/src/main/scala/org/scalatestplus/play/ServerProvider.scala#L48. At the moment, there does not seem to be any other option for configuring the port: playframework/scalatestplus-play#123Test are passing after this bit of code gets removed. There seems to be automatic allocation of ports (in a range of 24000 -2^16) so it seems reasonable to not replace the
port
override with new code that configures it.Does this change need to be reproduced in dotcom-rendering ?
Screenshots
What is the value of this and can you measure success?
Checklist
Does this affect other platforms?
Does this affect GLabs Paid Content Pages? Should it have support for Paid Content?
Does this change break ad-free?
Does this change update the version of CAPI we're using?
Accessibility test checklist
Tested