pmalhaire / xk6-mqtt

k6 mqtt extension
Apache License 2.0
47 stars 37 forks source link

load certificate and key from PEM string value instead from file #32

Open ezeeb opened 2 months ago

ezeeb commented 2 months ago

Hi everybody,

i want to write a load test where i have to connect to an mqtt server as several devices with different identities - i load this list if device identities with SharedArray from an CSV file. The file contains device id, device certificate and device key.

Current implementation of client only allows loading certificate and key from file. Handling files in k6 is quite complicated, so i would like to implement an client api to load them from a PEM string value.

Any suggestions how to add this functionality to the existing api?

ezeeb commented 1 month ago

created a PR, is this a good approach?

pmalhaire commented 1 month ago

Hello It makes more sense to change the JS frontend to handle strings as files, most people use files for cert.

pmalhaire commented 1 month ago

On the tls part I can makes this configurable.

ezeeb commented 1 month ago

Hello It makes more sense to change the JS frontend to handle strings as files, most people use files for cert.

Hi, sorry, wasn't specific here. I ask for an additional way to pass cert and key data without breaking the existing API. That's also what my PR tries to implement.

In my case each device has two files (key and cert) and when i test one hundred or one thousand devices i have to create 2 files for each device and the client loads the PEM file content on connect. So at least for me - it would be easier to skip these store to file and load from file steps and simply pass the PEM file content.

What do do you think?

ezeeb commented 1 month ago

On the tls part I can makes this configurable.

That would be great. I guess this is another issue.

ezeeb commented 1 month ago

Hey @pmalhaire, i removed the tls min version from this PR and created a separate issue and pr