commercetest / pepper-box

Pepper-Box is kafka load generator plugin for jmeter. It produces kafka messages of type plain text (JSON, XML, CSV or any other custom format) as well as java serialized objects.
http://pepperbox.gslab.com/
Apache License 2.0
2 stars 3 forks source link

Add a test to determine that jmeter can preserve user-added parameters #4

Open julianharty opened 6 years ago

julianharty commented 6 years ago

The documentation for pepper-box describes a novel feature where users can add custom parameters using a prefix of _ e.g. _ssl.key.password (see https://github.com/GSLabDev/pepper-box/blob/4233f8383f6a8a238c1764e3b779aa8312795757/README.md for more info). However, as https://github.com/GSLabDev/pepper-box/issues/6 describes, I discovered these user-added parameters seem to disappear whenever the contents of the Sampler's GUI Form are saved.

I ended up hard coding additional support for various kafka parameters I need rather than using this clever feature. If we're to rely on this capability to pass custom parameters it'd be great to have some tests that confirm the behaviour (together with trying to identify any limitations or reasons why the values aren't being preserved for various users).

I don't know enough of pepper-box's codebase to determine whether there's an elegant way to write suitable tests or whether we're more likely to need full GUI tests. Also, perhaps the tests are more relevant in core jmeter? Anyway, at least we can track the issue and a willingness to seek a solution here. Help would be most welcome.

itsdeepakk commented 6 years ago

Hi Julian, did you get a solution for this issue? When you say you had to hard code additional support, what did you do exactly? I am stuck at the same step and looking for least time consuming way around of this issue. thanks

julianharty commented 6 years ago

@itsdeepakk I didn't find a solution for this issue for a couple of reasons:

As you requested, here's are 2 extracts from that code: 1) where I knew I needed the field to be populated for our testing we simply added code such as:

brokerProps.put(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, 1);

2) when we wanted to add parameters only in certain circumstances e.g. when testing in an environment with additional security settings, we used one of the parameters as a trigger to then include additional parameters we'd need for that environment

if (security_protocol.equals(SecurityProtocol.SASL_SSL.name)) {
            LOGGER.info("Adding SASL_SSL parameters for Kafka to use.");
            brokerProps.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, security_protocol);
            String sasl_jaas_config = "org.apache.kafka.common.security.plain.PlainLoginModule required" +
                    " username=\"" + inputProps.getProperty("sasl.jaas.username") +
                    "\" password=\"" + inputProps.getProperty("sasl.jaas.password") + "\";";
   // other lines skipped here
}

You're most welcome to suggest improvements e.g. by forking this project and sending pull requests.

itsdeepakk commented 6 years ago

Thanks Julian for your reply. I am thinking I should attempt the same approach as I also need to pass SSL parameters for keystore and truststore to the sampler. I would definitely like to fix this if I would need flexibility in test for complex test requirements but may be for later.

On Tue, Jul 10, 2018 at 8:40 PM, Julian Harty notifications@github.com wrote:

@itsdeepakk https://github.com/itsdeepakk I didn't find a solution for this issue for a couple of reasons:

As you requested, here's are 2 extracts from that code:

  1. where I knew I needed the field to be populated for our testing we simply added code such as:

brokerProps.put(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, 1);

  1. when we wanted to add parameters only in certain circumstances e.g. when testing in an environment with additional security settings, we used one of the parameters as a trigger to then include additional parameters we'd need for that environment

if (security_protocol.equals(SecurityProtocol.SASL_SSL.name)) { LOGGER.info("Adding SASL_SSL parameters for Kafka to use."); brokerProps.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, security_protocol); String sasl_jaas_config = "org.apache.kafka.common.security.plain.PlainLoginModule required" + " username=\"" + inputProps.getProperty("sasl.jaas.username") + "\" password=\"" + inputProps.getProperty("sasl.jaas.password") + "\";"; // other lines skipped here }

You're most welcome to suggest improvements e.g. by forking this project and sending pull requests.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/commercetest/pepper-box/issues/4#issuecomment-403858210, or mute the thread https://github.com/notifications/unsubscribe-auth/ATzvFSkFaoBvmteexRub92CsgM8JhTAQks5uFMP6gaJpZM4Rfrc1 .