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

Possibility to change LoadSimulationsSettings within a JSON file with values provided from command line arguments. #672

Open
OlehBabkov opened this issue Mar 12, 2024 · 8 comments
Labels
help wanted Extra attention is needed new feature New feature or request

Comments

@OlehBabkov
Copy link

As part of our system configuration process, we currently manage load simulation settings within a JSON file. However, we often encounter scenarios where we need to dynamically adjust these settings based on specific requirements or test scenarios.

To improve flexibility and efficiency in configuring load simulations, it would be perfect to have the possibility of updating the LoadSimulationsSettings directly from command line arguments.

@AntyaDev
Copy link
Contributor

Hi @OlehBabkov ,
Do you have any example of how you would pass such settings via Console arguments?

@OlehBabkov
Copy link
Author

Hi @AntyaDev!
yes, for example with a help of docker run

dotnet mytests --scenarioName ScenarioName --loadSimulationSettings keepConstant --copies 4 --during 00:00:07 --endpointUri http://someendpoint.com/

just an example, where I can take these args from a console and replace the default values in a config.json file.

While I was investigating this approach I found out that with a help of IOptions pattern I can easily handle GlobalCustomSettings and replace values there, but with a structure of LoadSimulationsSettings it is not working (maybe because of a structure of { "KeepConstant": [ 4, "00:00:07" ] } (for example)

or maybe I'm doing something wrong and there can be a solution how to change exactly LoadSimulationsSettings out of the box, but I didn't found it in a documentation for NBomber.

Ask for your help

@AntyaDev
Copy link
Contributor

AntyaDev commented Mar 12, 2024

@OlehBabkov
The thing is that LoadSimulation is an array, and it can contain several LoadSimulations:
[ "KeepConstant": 4, "00:00:07",
"KeepConstant": 10, "00:00:10" ]

I don't know how we can set it via Console arguments (CLI args).

maybe
--loadSimulationSettings ["KeepConstant": 4, "00:00:07"; "KeepConstant": 10, "00:00:10"]

Also, what if the user wants to run several scenarios? The thing is that NBomber supports many configurations, and we should think how to expose it via CLI args :)

@AntyaDev
Copy link
Contributor

Hi @OlehBabkov can you tell please what are the limitations for you to pass different json files?

dotnet MyLoadTests.dll --config=config-1.json
dotnet MyLoadTests.dll --config=config-2.json

@OlehBabkov
Copy link
Author

Hi @AntyaDev ! Actually, no limitations. I just thought that it would be nice to run each docker container with it's own configurations from cli based on each test (we have different test scenarios) and what we need to change (except of GlobalCustomSettings part) is only duration of a test and LoadSimulationSettings

@AntyaDev
Copy link
Contributor

AntyaDev commented Mar 12, 2024

@OlehBabkov If you have a few predefined variations for LoadSimulations, you could use a different JSON config per variation.
But if your test run very different between each run (I mean dynamic variations) then probably we should think of something different.

I got your point, and I like the proposed options via CLI args. The only thing that is not clear for now is how to expose this functionality via CLI to cover NBomber functionality: multiple scenarios, LoadSimulations array, etc.

@AntyaDev AntyaDev added help wanted Extra attention is needed new feature New feature or request labels Mar 14, 2024
@botondberes
Copy link

We actually have something similar. Instead of passing everything using the command line, we define multiple JSON config files and then use the command line argument to specify which JSON to use.

@AntyaDev
Copy link
Contributor

Hi @OlehBabkov ,
It seems we are a bit stuck on this proposition. I like the idea, but I don't know how to express it using CLI arguments.
We need to think maybe we can accept just JSON strings as arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed new feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants