When I start in a Docker environment with Jenkins a JMeter test using a jmeter-maven-plugin, then the HttpRequests will always fail with a 403. It doesn't matter whether the receiving SpringBootApplication runs within a Docker environment or just on my PC (host). The Docker environment is 'Docker for Windows'.
Running the jmeter-maven-script within a Maven on Windows (no Docker), then everything runs smoothly. Also running within the JMeter GUI works fine.
Updates:
- When I change the URL to an invalid one, the 403 http status remains. Changing the path to an invalid server keeps giving the 403 http status.
- When I start the JMeter run (1 thread, 2 times) on http://example.com it works.
- Starting the SpringBootApplication on the same Docker network on port 80 is also not working. Both using http://localhost and http://dockercontainername fail with "Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused)"
I prepare the JMeter script file on Windows. I copy the file to my Spring Maven project.
I prefer NOT to install the JMeter stuff in all my environments, so working with the jmeter-maven-plugin is a good solution.
Can you help me solving this very annoying issue?
My Maven plugin description is:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
<configuration>
<skipTests>${skipPerformanceTests}</skipTests>
<testFilesDirectory>${project.basedir}/src/main/resources/jmeter</testFilesDirectory>
<resultsDirectory>${project.basedir}/target/jmeter/testFiles</resultsDirectory>
<resultsFileFormat>csv</resultsFileFormat>
</configuration>
</plugin>
My JMeter script:
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value"></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">http://127.0.0.1:8080/indexRoleA.html</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</HTTPSamplerProxy>
My JMeter HttpRequets are as simple as going to /indexRole.html.