From 7fd6b7354fded9359dcfb340574e72424fc0fe02 Mon Sep 17 00:00:00 2001 From: spbolton Date: Tue, 10 Dec 2024 14:31:21 +0000 Subject: [PATCH] test: Test and configure Jmeter against sandbox environm (#30890) (#30891) ### Proposed Changes * Update jmeter to be able to pass a non default password for testing against remote instances When connecting to an external instance, to prevent the need to add the password to the command line, the password can be added to the environment variable JMETER_ADMIN_PASSWORD. To prevent unexpected use of this you must add the property -Djmeter.env.password=true or set the profile -Pjmeter.env.password ```bash export JMETER_ADMIN_PASSWORD=mysecretpassword ./mvnw verify -Djmeter.test.skip=false -pl :dotcms-test-jmeter -Djmeter.host=myhost -Djmeter.env.password=true ``` --- test-jmeter/README.md | 9 +++++++++ test-jmeter/pom.xml | 21 ++++++++++++++++++++- test-jmeter/src/test/jmeter/sessions.jmx | 7 ++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/test-jmeter/README.md b/test-jmeter/README.md index c78fbe779cf9..f3335ef7a16e 100644 --- a/test-jmeter/README.md +++ b/test-jmeter/README.md @@ -90,6 +90,15 @@ The tests run under the `jmeter-standalone` profile, which is active by default. - Results validation - Report generation + +# env password +When connecting to an external instance, to prevent the need to add the password to the command line, the password can be added to the environment variable JMETER_ADMIN_PASSWORD. +To prevent unexpected use of this you must add the property -Djmeter.env.password=true or set the profile -Pjmeter.env.password +```bash +export JMETER_ADMIN_PASSWORD=mysecretpassword +./mvnw verify -Djmeter.test.skip=false -pl :dotcms-test-jmeter -Djmeter.host=myhost -Djmeter.env.password=true +``` + ## Troubleshooting We have not yet validated the memory requirements. Eventually we should probably be explicit about the JVM memory settings. These can be added into the configuration block diff --git a/test-jmeter/pom.xml b/test-jmeter/pom.xml index 707f360e114f..1be27b30e4f4 100644 --- a/test-jmeter/pom.xml +++ b/test-jmeter/pom.xml @@ -26,6 +26,7 @@ 5 60 2 + admin @@ -41,7 +42,10 @@ jmeter-standalone - true + + jmeter.test.skip + false + @@ -112,6 +116,7 @@ ${jmeter.host} ${jmeter.port} ${jmeter.rampup} + ${jmeter.admin.password} ${jmeter.startup.delay} ${jmeter.test.duration} ${jmeter.thread.number} @@ -128,5 +133,19 @@ + + jmeter.env.password + + + jmeter.env.password + true + + + + ${env.JMETER_ADMIN_PASSWORD} + + + + diff --git a/test-jmeter/src/test/jmeter/sessions.jmx b/test-jmeter/src/test/jmeter/sessions.jmx index 9d8454e3204f..3f83ebd24803 100644 --- a/test-jmeter/src/test/jmeter/sessions.jmx +++ b/test-jmeter/src/test/jmeter/sessions.jmx @@ -57,6 +57,11 @@ ${__P(test.duration,60)} = + + admin.password + ${__P(admin.password,admin)} + = + @@ -227,7 +232,7 @@ false - {"userId":"admin@dotcms.com","password":"admin","rememberMe":false,"language":"en","country":"US","backEndLogin":true} + {"userId":"admin@dotcms.com","password":"${admin.password}","rememberMe":false,"language":"en","country":"US","backEndLogin":true} =