Skip to content
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

refactor(web/test): remove hard-coded port numbers from EchoServiceTest #1828

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

dbyron-sf
Copy link
Contributor

so the test can pass when these ports are in-use:

EchoServiceTest > initializationError FAILED
    java.net.BindException: Address already in use
        at java.base/sun.nio.ch.Net.bind0(Native Method)
        at java.base/sun.nio.ch.Net.bind(Net.java:555)
        at java.base/sun.nio.ch.Net.bind(Net.java:544)
        at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:648)
        at java.base/java.net.ServerSocket.bind(ServerSocket.java:393)
        at com.squareup.okhttp.mockwebserver.MockWebServer.start(MockWebServer.java:354)
        at com.squareup.okhttp.mockwebserver.MockWebServer.start(MockWebServer.java:337)
        at com.squareup.okhttp.mockwebserver.MockWebServer.start(MockWebServer.java:324)
        at com.netflix.spinnaker.gate.service.EchoServiceTest.setUp(EchoServiceTest.java:57)

While we're at it, also convert from
junit4 which com.squareup.okhttp.mockwebserver.MockWebServer uses, to junit5, which wiremock uses.

so the test can pass when these ports are in-use:

EchoServiceTest > initializationError FAILED
    java.net.BindException: Address already in use
        at java.base/sun.nio.ch.Net.bind0(Native Method)
        at java.base/sun.nio.ch.Net.bind(Net.java:555)
        at java.base/sun.nio.ch.Net.bind(Net.java:544)
        at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:648)
        at java.base/java.net.ServerSocket.bind(ServerSocket.java:393)
        at com.squareup.okhttp.mockwebserver.MockWebServer.start(MockWebServer.java:354)
        at com.squareup.okhttp.mockwebserver.MockWebServer.start(MockWebServer.java:337)
        at com.squareup.okhttp.mockwebserver.MockWebServer.start(MockWebServer.java:324)
        at com.netflix.spinnaker.gate.service.EchoServiceTest.setUp(EchoServiceTest.java:57)

While we're at it, also convert from
junit4 which com.squareup.okhttp.mockwebserver.MockWebServer uses, to junit5, which
wiremock uses.
to avoid OutOfMemoryErrors
 Please enter the commit message for your changes. Lines starting
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Sep 11, 2024
@mergify mergify bot added the auto merged label Sep 11, 2024
@mergify mergify bot merged commit b787931 into spinnaker:master Sep 11, 2024
4 checks passed
@dbyron-sf dbyron-sf deleted the cleanup-EchoServiceTest branch September 11, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants