Rbillon59 / jmeter-docker-compose-starterkit

38 stars 27 forks source link

Not able to use our user defined jmeter scripts with the framework #8

Closed sattishv closed 1 year ago

sattishv commented 1 year ago

Hi

Even though we specify our own scripts in the command line arguments to get invoked. The framework picks my-scenario.jmx always.

Command used: source .env && JMX=HH_PTE_AFO_LoginLogout.jmx duration=300 docker-compose -p jmeter up

Logs snippet: jmeter-master | Slaves IP : jmeter-master | 192.168.80.3 jmeter-master | + /opt/jmeter/apache-jmeter/bin/jmeter -LINFO -X -d /opt/jmeter/apache-jmeter -n -j /opt/jmeter/apache-jmeter/logs/my-scenario/jmeter-master-my-scenario.jmx-20231019-103251.log -l /opt/jmeter/apache-jmeter/results/my-scenario/20231019-103251-load-test-my-scenario-result.csv -R 192.168.80.3 -Ghost=10.105.14.102 -Gport=443 -Gprotocol=https -Gthreads=5 -Gduration=100 -Grampup=60 -Gjmx=my-scenario.jmx -t /opt/jmeter/apache-jmeter/bin/my-scenario.jmx -e -o /opt/jmeter/apache-jmeter/results/my-scenario/report-my-scenario-20231019-103251

Thanks sattish.

Rbillon59 commented 1 year ago

Could you please give me the output of the tree command from the repo root ? Thanks

Rbillon59 commented 1 year ago

The command source .env && JMX=HH_PTE_AFO_LoginLogout.jmx duration=300 docker-compose -p jmeter up is not the relevant one now, look at the README in the main branch.

I've refactor the file structure to support shared modules and datasets.

In your case, you should :

source scenario/HH_PTE_AFO_LoginLogout/.env && sudo docker-compose -p jmeter up --scale jmeter-slave=${nbInjector} -d

sattishv commented 1 year ago

Thanks for your inputs. I was able to invoke the test successfully with our test parameters, but the test failed with the below error message from one of the jmeter slave instance. Controller logs showed the opration split was succussful.

2023-10-20 08:40:27,461 INFO o.a.j.t.JMeterThread: Thread started: 172.20.0.3-Concurrent users_50 1-1 2023-10-20 08:40:27,468 INFO o.a.j.s.FileServer: Stored: data/USERS.csv 2023-10-20 08:40:27,470 ERROR o.a.j.t.JMeterThread: Test failed! java.lang.IllegalArgumentException: Could not read file header line for file data/USERS.csv at org.apache.jmeter.services.FileServer.reserveFile(FileServer.java:283) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.config.CSVDataSet.initVars(CSVDataSet.java:216) ~[ApacheJMeter_components.jar:5.4.1] at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:171) ~[ApacheJMeter_components.jar:5.4.1] at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:399) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:391) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.control.GenericController.next(GenericController.java:160) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:91) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254) [ApacheJMeter_core.jar:5.4.1] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.IllegalArgumentException: File USERS.csv must exist and be readable at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:424) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.services.FileServer.readLine(FileServer.java:340) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.services.FileServer.readLine(FileServer.java:324) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.services.FileServer.reserveFile(FileServer.java:272) ~[ApacheJMeter_core.jar:5.4.1] ... 9 more 2023-10-20 08:40:27,491 INFO o.a.j.t.JMeterThread: Thread finished: 172.20.0.3-Concurrent users_50 1-1 2023-10-20 08:40:33,461 INFO o.a.j.t.JMeterThread: Thread started: 172.20.0.3-Concurrent users_50 1-2 2023-10-20 08:40:33,466 ERROR o.a.j.t.JMeterThread: Test failed! java.lang.IllegalArgumentException: Could not read file header line for file data/USERS.csv at org.apache.jmeter.services.FileServer.reserveFile(FileServer.java:283) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.config.CSVDataSet.initVars(CSVDataSet.java:216) ~[ApacheJMeter_components.jar:5.4.1] at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:171) ~[ApacheJMeter_components.jar:5.4.1] at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:399) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:391) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.control.GenericController.next(GenericController.java:160) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:91) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254) [ApacheJMeter_core.jar:5.4.1] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.IllegalArgumentException: File USERS.csv must exist and be readable

Thanks

Rbillon59 commented 1 year ago

Hey,

In the README

File path of the CSV in JMeter should be only the filename, not the actual path. (On test run, every dataset is put in the bin folder of JMeter).

(I know JMeter will complain the CSV is not present on the UI while saving, you can create symlinks to avoid that if you want)

sattishv commented 1 year ago

Hi,

Thanks it worked after following your inputs. But i am not able to execute a test by passing arguments in the command line. source scenario/HH_PTE_AFO_LoginLogout/.env && duration=1200 docker compose -p jmeter up . Here i specified the duration as 1200, but it wasnt honoured it rather it took the value from .env

Another thing on how to use our own grafana dashboard . Would just copying the custom dashboard json file to influx-grafana\dashboards folder will work.

Thanks Sattish.

Rbillon59 commented 1 year ago

You cannot override test params through the command line over there. The .env file is sourced from within the entrypoint.sh and will override any value set through the command line. It's a better approach to always version your changes to make them auditable over time.

For the dashboard, yes the folders are mounted as is. You can paste yours

sattishv commented 1 year ago

Thanks for elucidating the queries and valuable inputs. Appreciate it