abstracta / jmeter-java-dsl

Simple JMeter performance tests API
https://abstracta.github.io/jmeter-java-dsl/
Apache License 2.0
477 stars 59 forks source link

I am trying to run the performance test inside a docker container but getting an error: 2023-10-15 19:00:03 java.nio.file.NoSuchFileException: /bin #231

Closed rajeshi closed 1 year ago

rajeshi commented 1 year ago

I have created a spring boot application which has a controller that runs the JMeter execution:

TestPlanStats stats = testPlan(
        threadGroup(2, 10,
            httpSampler("http://my.service")
        ),
        jtlWriter("target/jtls")
    ).run();

This runs inside a queue and this entire thing is containerized as below:

FROM openjdk:17

# Create the /bin directory in the container

# Copy your JAR file to the container
COPY target/test-performance-api.jar /app/test-performance-api.jar

# Set the working directory to /
WORKDIR /app

# Specify the entry point and command to run your application
ENTRYPOINT ["java", "-jar", "test-performance-api.jar", "--spring.profiles.active=test"]

# Expose the required ports
EXPOSE 8080
EXPOSE 8081

When I run this locally through IDE or running the jar, it works as expected. However, when I add it to the docker container I am running into this issue:

2023-10-15 19:00:03 java.nio.file.NoSuchFileException: /bin
2023-10-15 19:00:03     at jdk.zipfs/jdk.nio.zipfs.ZipPath.readAttributes(ZipPath.java:769)
2023-10-15 19:00:03     at jdk.zipfs/jdk.nio.zipfs.ZipPath.readAttributes(ZipPath.java:777)
2023-10-15 19:00:03     at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.readAttributes(ZipFileSystemProvider.java:276)
2023-10-15 19:00:03     at java.base/java.nio.file.Files.readAttributes(Files.java:1851)
2023-10-15 19:00:03     at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220)
2023-10-15 19:00:03     at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277)
2023-10-15 19:00:03     at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:323)
2023-10-15 19:00:03     at java.base/java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:71)
2023-10-15 19:00:03     at java.base/java.nio.file.Files.walk(Files.java:3918)
2023-10-15 19:00:03     at java.base/java.nio.file.Files.walk(Files.java:3973)
2023-10-15 19:00:03     at us.abstracta.jmeter.javadsl.core.engines.JmeterEnvironment.installConfig(JmeterEnvironment.java:98)
2023-10-15 19:00:03     at us.abstracta.jmeter.javadsl.core.engines.JmeterEnvironment.<init>(JmeterEnvironment.java:41)
2023-10-15 19:00:03     at us.abstracta.jmeter.javadsl.core.engines.EmbeddedJmeterEngine.run(EmbeddedJmeterEngine.java:93)
2023-10-15 19:00:03     at us.abstracta.jmeter.javadsl.core.DslTestPlan.run(DslTestPlan.java:125)
2023-10-15 19:00:03     at com.mtaf.managed_testing_services_core.services.JMeterTestService.runPerformanceTest(JMeterTestService.java:228)

I even tried bind mounting to /tmp directory. Also observed that the directory jmeter-java-dsl is getting created, however, the /bin folder is not getting created.

Appreciate any suggestions.

Thanks in advance.

Regards, Rajesh

rabelenda commented 1 year ago

Hello, thank you for asking about this.

Have you checked the solutions provided here?

Regards

rajeshi commented 1 year ago

Thanks a ton @rabelenda . This solution worked: https://github.com/abstracta/jmeter-java-dsl/issues/174#issuecomment-1448245451. Didn't realize there was a solution already. Thanks for your comment.

Regards, Rajesh Iyer