Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables in properties files for secrets #367

Open
Harmannz opened this issue Mar 18, 2020 · 0 comments
Open

Variables in properties files for secrets #367

Harmannz opened this issue Mar 18, 2020 · 0 comments

Comments

@Harmannz
Copy link

Harmannz commented Mar 18, 2020

Problem:

I have a scenario where I want to use the jmeter maven plugin to performance test authentications.
I have oauth2 client secrets that I need to pass in via user properties. These will vary per environment.

What happens

From the documentation, I can see that the plugin

merges properties to ensure that all properties are merged into the latest valid versions of the properties files supplied with JMeter

To pass these secrets via maven command line I currently have to:

  1. Define maven properties in my pom xml
<properties>
    <client.username/>
    <client.password/>
</properties>
  1. Use propertiesUser tag to define the additional user properties in pom xml
<propertiesUser>
    <client.username>${client.username}</client.username>
    <client.password>${client.password}</client.password>
</propertiesUser>
  1. Pass the secrets as mvn command line arguments
mvn clean verify -Dclient.username=random-client -Dclient.password=random-password

What should happen ideally

A more developer friendly and possibly a better practice is to use maven resource filtering so that we simply add the variables in the properties file.

In order to utilise the maven resources plugin, you would have to merge the generated properties in the target/classes directory with the supplied JMeter plugin. I see that a similar issue was raised 7 years ago issue#65 However that issue does not explicitly discuss secrets.

Another option may be to specify the propertiesFilesDirectory in the pom xml as target/classes. I have not verified that this works. Will test it asap.

java -version:
openjdk version "1.8.0_222"

mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T08:00:29+13:00)

jmeter maven plugin

<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.0.0</version>

Also, I am happy to help with this issue. :)

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant