This repository was archived by the owner on Sep 22, 2022. It is now read-only.
This repository was archived by the owner on Sep 22, 2022. It is now read-only.
Frail implementation of WireMock commandline parameters #32
Open
Description
Describe the bug
When running grpc-wiremock
in kubernetes, certain environment variables will be added to the VM running gprc-wiremock. If a kubernetes service is defined with a name starting with wiremock
, there will be a few env. variables passed through to the Wiremock HttpMock. (link) This results in the Wiremock HttpMock being unable to start - because of these invalid commandline parameters.
Is there a better way to handle the passing of wiremock commandline parameters?
To Reproduce
Steps to reproduce the behavior:
- Set up grpc-wiremock to run in kuberenetes, create a kubernetes service with name
wiremock-x-y
in the same namespace. - Run kubernetes deployment of grpc-wiremock
- See error:
2022-02-21 07:47:14.202 INFO 88 --- [ main] io.adven.grpc.wiremock.HttpMock : Starting WireMock server with options:
--x_y_internal_port_8080_tcp=tcp://127.0.0.1:8080
--x_y_internal_port=tcp://127.0.0.1:8080
--x_y_internal_port_8080_tcp_addr=127.0.0.1
--x_y_internal_port_8080_tcp_port=8080
--x_y_internal_service_host=127.0.0.1
--x_y_internal_port_8080_tcp_proto=tcp
--x_y_internal_service_port=8080
--global-response-templating
--root-dir=/wiremock
--port=8888
2022-02-21 07:47:14.223 INFO 88 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-21 07:47:14.316 ERROR 88 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:770) ~[spring-boot-2.6.2.jar:2.6.2]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:751) ~[spring-boot-2.6.2.jar:2.6.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:309) ~[spring-boot-2.6.2.jar:2.6.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.2.jar:2.6.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.2.jar:2.6.2]
at io.adven.grpc.wiremock.GrpcWiremock.main(GrpcWiremock.java:132) ~[main/:na]
Caused by: joptsimple.UnrecognizedOptionException: psd2_sandbox_internal_port_8080_tcp is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:108) ~[wiremock-jre8-standalone-2.32.0.jar:na]
at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510) ~[wiremock-jre8-standalone-2.32.0.jar:na]
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56) ~[wiremock-jre8-standalone-2.32.0.jar:na]
at joptsimple.OptionParser.parse(OptionParser.java:396) ~[wiremock-jre8-standalone-2.32.0.jar:na]
at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.<init>(CommandLineOptions.java:342) ~[wiremock-jre8-standalone-2.32.0.jar:na]
at io.adven.grpc.wiremock.HttpMock.start(HttpMock.java:44) ~[main/:na]
at io.adven.grpc.wiremock.GrpcWiremock.run(GrpcWiremock.java:39) ~[main/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:767) ~[spring-boot-2.6.2.jar:2.6.2]
... 5 common frames omitted
2022-02-21 07:47:14.318 WARN 88 --- [ main] .s.c.a.CommonAnnotationBeanPostProcessor : Destroy method on bean with name 'httpMock' threw an exception: java.lang.NullPointerException: Cannot invoke "com.github.tomakehurst.wiremock.WireMockServer.stop()" because "this.server" is null
FAILURE: Build failed with an exception.
Expected behavior
grpc-wiremock should run.
Activity