Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Frail implementation of WireMock commandline parameters #32

Open
JoakimJohesan opened this issue Feb 21, 2022 · 0 comments
Open

Frail implementation of WireMock commandline parameters #32

JoakimJohesan opened this issue Feb 21, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@JoakimJohesan
Copy link

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:

  1. Set up grpc-wiremock to run in kuberenetes, create a kubernetes service with name wiremock-x-y in the same namespace.
  2. Run kubernetes deployment of grpc-wiremock
  3. 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.

@JoakimJohesan JoakimJohesan added the bug Something isn't working label Feb 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants