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(bakery/test): wiremock cleanup #4527

Merged

Conversation

dbyron-sf
Copy link
Contributor

@dbyron-sf dbyron-sf commented Sep 16, 2023

A bit of cleanup inspired by some flaky tests.

instead of wiremock to reduce dependencies

snippets of ./gradlew orca-bakery:dependencies

before:

+--- com.github.tomakehurst:wiremock:2.15.0
|    +--- org.eclipse.jetty:jetty-server:9.2.22.v20170606 -> 9.4.46.v20220331
|    |    +--- javax.servlet:javax.servlet-api:3.1.0 -> 4.0.1
|    |    +--- org.eclipse.jetty:jetty-http:9.4.46.v20220331
|    |    |    +--- org.eclipse.jetty:jetty-util:9.4.46.v20220331
|    |    |    \--- org.eclipse.jetty:jetty-io:9.4.46.v20220331
|    |    |         \--- org.eclipse.jetty:jetty-util:9.4.46.v20220331
|    |    \--- org.eclipse.jetty:jetty-io:9.4.46.v20220331 (*)
|    +--- org.eclipse.jetty:jetty-servlet:9.2.22.v20170606 -> 9.4.46.v20220331
|    |    +--- org.eclipse.jetty:jetty-security:9.4.46.v20220331
|    |    |    \--- org.eclipse.jetty:jetty-server:9.4.46.v20220331 (*)
|    |    \--- org.eclipse.jetty:jetty-util-ajax:9.4.46.v20220331
|    |         \--- org.eclipse.jetty:jetty-util:9.4.46.v20220331
|    +--- org.eclipse.jetty:jetty-servlets:9.2.22.v20170606 -> 9.4.46.v20220331
|    |    +--- org.eclipse.jetty:jetty-continuation:9.4.46.v20220331
|    |    +--- org.eclipse.jetty:jetty-http:9.4.46.v20220331 (*)
|    |    +--- org.eclipse.jetty:jetty-util:9.4.46.v20220331
|    |    \--- org.eclipse.jetty:jetty-io:9.4.46.v20220331 (*)
|    +--- org.eclipse.jetty:jetty-webapp:9.2.22.v20170606 -> 9.4.46.v20220331
|    |    +--- org.eclipse.jetty:jetty-xml:9.4.46.v20220331
|    |    |    \--- org.eclipse.jetty:jetty-util:9.4.46.v20220331
|    |    \--- org.eclipse.jetty:jetty-servlet:9.4.46.v20220331 (*)
|    +--- com.google.guava:guava:20.0 -> 30.0-jre (*)
|    +--- com.fasterxml.jackson.core:jackson-core:2.8.9 -> 2.12.7 (*)
|    +--- com.fasterxml.jackson.core:jackson-annotations:2.8.9 -> 2.12.7 (*)
|    +--- com.fasterxml.jackson.core:jackson-databind:2.8.9 -> 2.12.7.1 (*)
|    +--- org.apache.httpcomponents:httpclient:4.5.3 -> 4.5.13 (*)
|    +--- org.xmlunit:xmlunit-core:2.3.0 -> 2.8.4
|    +--- org.xmlunit:xmlunit-legacy:2.3.0 -> 2.8.4
|    |    +--- org.xmlunit:xmlunit-core:2.8.4
|    |    \--- junit:junit:3.8.1 -> 4.13.1 (*)
|    +--- com.jayway.jsonpath:json-path:2.4.0 -> 2.5.0 (*)
|    +--- org.slf4j:slf4j-api:1.7.12 -> 1.7.36
|    +--- net.sf.jopt-simple:jopt-simple:5.0.3
|    +--- junit:junit:4.12 -> 4.13.1 (*)
|    +--- org.apache.commons:commons-lang3:3.6 -> 3.12.0
|    +--- com.flipkart.zjsonpatch:zjsonpatch:0.3.0
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.8.5 -> 2.12.7.1 (*)
|    |    +--- com.fasterxml.jackson.core:jackson-core:2.8.5 -> 2.12.7 (*)
|    |    +--- com.google.guava:guava:18.0 -> 30.0-jre (*)
|    |    \--- org.apache.commons:commons-collections4:4.1 -> 4.4
|    \--- com.github.jknack:handlebars:4.0.6
|         +--- org.apache.commons:commons-lang3:3.1 -> 3.12.0
|         +--- org.antlr:antlr4-runtime:4.5.1-1
|         \--- org.slf4j:slf4j-api:1.6.4 -> 1.7.36

after:

+--- com.github.tomakehurst:wiremock-jre8-standalone -> 2.31.0
as they're not used.  This is a spock test
…ryServiceSpec

since the tests only need one.  It's faster, and it prevents errors like:

com.github.tomakehurst.wiremock.common.FatalStartupException: java.lang.RuntimeException: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at app//com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:146)
	at app//com.netflix.spinnaker.orca.bakery.api.BakeryServiceSpec.setup(BakeryServiceSpec.groovy:55)
Caused by: java.lang.RuntimeException: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at com.github.tomakehurst.wiremock.jetty9.JettyHttpServer.start(JettyHttpServer.java:137)
	at com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:144)
	... 1 more
Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	at org.eclipse.jetty.server.Server.doStart(Server.java:401)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	at com.github.tomakehurst.wiremock.jetty9.JettyHttpServer.start(JettyHttpServer.java:135)
	... 2 more
Caused by: java.net.BindException: Address already in use
	at java.base/sun.nio.ch.Net.bind(Net.java:455)
	at java.base/sun.nio.ch.Net.bind(Net.java:447)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
	at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
	... 9 more
@dbyron-sf dbyron-sf changed the title chore(bakery/test): use wiremock-jre8-standalone refactor(bakery/test): wiremock cleanup Sep 16, 2023
@jasonmcintosh jasonmcintosh merged commit 4666ce0 into spinnaker:master Sep 16, 2023
2 checks passed
@dbyron-sf dbyron-sf deleted the orca-bakery-wiremock-cleanup branch September 16, 2023 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants