mockserver icon indicating copy to clipboard operation
mockserver copied to clipboard

Unable to use initializeJson with helm deployment on kubernetes

Open FrankOwen opened this issue 5 years ago • 2 comments

Describe the issue An error is thrown by mockserver when trying to load initializerJson.json file

What you are trying to do Deployed mockserver-config configmap, with initializerJson.json into my cluster, when mockserver starts, it throws file not found error.. Looks like there are extra quotes inserted.

MockServer version 5.11.1

To Reproduce Steps to reproduce the issue:

  1. Deploy mockserver with mockserver-config in kubernetes cluster
  2. expectations included in initializerJson.json file
  3. Expectations are NOT loaded. mockserver throws exception. See log below. Notice the extra quotes in the following:java.lang.RuntimeException: Exception while loading ""/config/initializerJson.json""

Expected behaviour initial expectations get loaded

MockServer Log 2021-01-06 21:20:56 5.11.1 INFO loading JSON initialization file:

"/config/initializerJson.json"

2021-01-06 21:20:56 5.11.1 WARNING exception while loading JSON initialization file, ignoring file java.lang.RuntimeException: Exception while loading ""/config/initializerJson.json"" at org.mockserver.file.FileReader.readFileFromClassPathOrPath(FileReader.java:24) at org.mockserver.server.initialize.ExpectationInitializerLoader.retrieveExpectationsFromJson(ExpectationInitializerLoader.java:83) at org.mockserver.server.initialize.ExpectationInitializerLoader.loadExpectations(ExpectationInitializerLoader.java:115) at org.mockserver.server.initialize.ExpectationInitializerLoader.addExpectationsFromInitializer(ExpectationInitializerLoader.java:37) at org.mockserver.server.initialize.ExpectationInitializerLoader.(ExpectationInitializerLoader.java:33) at org.mockserver.mock.HttpState.(HttpState.java:119) at org.mockserver.lifecycle.LifeCycle.(LifeCycle.java:48) at org.mockserver.netty.MockServer.(MockServer.java:50) at org.mockserver.netty.MockServer.(MockServer.java:41) at org.mockserver.cli.Main.main(Main.java:100) Caused by: java.io.FileNotFoundException: "/config/initializerJson.json" (No such file or directory) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.(FileInputStream.java:157) at java.base/java.io.FileInputStream.(FileInputStream.java:112) at org.mockserver.file.FileReader.openStreamToFileFromClassPathOrPath(FileReader.java:32) at org.mockserver.file.FileReader.readFileFromClassPathOrPath(FileReader.java:21) ... 9 more

2021-01-06 21:20:56 5.11.1 INFO 1080 started on port: 1080 2021-01-06 21:20:56 5.11.1 INFO logger level is INFO, change using:

  • 'ConfigurationProperties.logLevel(String level)' in Java code,
  • '-logLevel' command line argument,
  • 'mockserver.logLevel' JVM system property or,
  • 'mockserver.logLevel' property value in 'mockserver.properties'

FrankOwen avatar Jan 06 '21 21:01 FrankOwen

Update: This seems to be resolved if I use the 5.11.2 docker image. There is no 5.11.2 helm chart yet, so I am using the updated image with the (old) 5.11.1 chart. So far seems to be working fine, but it would be good if a corresponding 5.11.2 helm chart were made available, to capture any possible chart adjustments.

FrankOwen avatar Jan 07 '21 00:01 FrankOwen

A helm chart has been release for all thee latest versions so closing this issue

jamesdbloom avatar Mar 22 '22 02:03 jamesdbloom