-
Notifications
You must be signed in to change notification settings - Fork 41
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
Parse instance scenarios into a flat WS URL list #888
Comments
Now we are reading the WS URL in the A possible solution to this could be:
|
Hey, @ankur22! Thanks for tackling this 🙇 At this point, our primary goal is to ensure everything works smoothly with the BE data. To do this, we can easily transform the instance scenario JSON data into a more straightforward list of WS URLs. Simple as that! I really like the solution you proposed! 😊 However, I think it might be a good idea to tackle them separately, perhaps in a different issue. |
This new method parses K6_BROWSER_WS_URL differently. Instead of a list of ws urls, it is a scenarios object, which needs to be unmarshalled and all ws urls extracted. The end result is the same -- a list of ws urls. This is a step closer to being able to work with a set of chrome browsers each with different characteristics that are set in the scenario. This commit contains the addition of this new method. Eventually this method will be used instead of the existing newRemoteRegistry method. Closes: #888
This new method parses K6_BROWSER_WS_URL differently. Instead of a list of ws urls, it is a scenarios object, which needs to be unmarshalled and all ws urls extracted. The end result is the same -- a list of ws urls. This is a step closer to being able to work with a set of chrome browsers each with different characteristics that are set in the scenario. This commit contains the addition of this new method. Eventually this method will be used instead of the existing newRemoteRegistry method. Closes: #888
This new method parses K6_BROWSER_WS_URL differently. Instead of a list of ws urls, it is a scenarios object, which needs to be unmarshalled and all ws urls extracted. The end result is the same -- a list of ws urls. This is a step closer to being able to work with a set of chrome browsers each with different characteristics that are set in the scenario. This commit contains the addition of this new method. Eventually this method will be used instead of the existing newRemoteRegistry method. Closes: #888
This new method parses K6_BROWSER_WS_URL differently. Instead of a list of ws urls, it is a scenarios object, which needs to be unmarshalled and all ws urls extracted. The end result is the same -- a list of ws urls. This is a step closer to being able to work with a set of chrome browsers each with different characteristics that are set in the scenario. This commit contains the addition of this new method. Eventually this method will be used instead of the existing newRemoteRegistry method. Closes: #888
This new method parses K6_BROWSER_WS_URL differently. Instead of a list of ws urls, it is a scenarios object, which needs to be unmarshalled and all ws urls extracted. The end result is the same -- a list of ws urls. This is a step closer to being able to work with a set of chrome browsers each with different characteristics that are set in the scenario. This commit contains the addition of this new method. Eventually this method will be used instead of the existing newRemoteRegistry method. Closes: #888
The k6-browser can connect to browsers in a round-robin fashion by retrieving data from the
K6_INSTANCE_SCENARIOS
environment variable.Problem
Currently, we consider a list of WS URLs.
However, instead of receiving a flat list of WS URLs, we will receive the following minified JSON via the
K6_INSTANCE_SCENARIOS
environment variable:K6_INSTANCE_SCENARIOS="[{\"id\":\"one\",\"browsers\":[{\"handle\":\"ws://1...\"},{\"handle\":\"ws://2...\"}]},{\"id\":\"two\",\"browsers\":[{\"handle\":\"ws://3...\"}]}]"
The pre-minified JSON looks like the following (where
id
is a scenario ID/name):Solution
Currently, we don't support other browsers than Chromium. And we don't need to respect the scenario details to pool WS URLs in each scenario. So we can parse the source JSON into the following, a flat list of WS URLs by joining all scenarios into one as follows:
With this, we can still use the same feature set in the k6-browser without changing anything else. And we can be ready when we support other browsers (since we'll be getting WS URLs in scenarios based on environmental details like browser types).
Suggestion
Change the
IsRemoteBrowser
function to parse the scenario-based JSON data into a flat list of WS URLs.The text was updated successfully, but these errors were encountered: