qlik-oss / gopherciser

Gopherciser is used for load testing (that is, stress testing and performance measurement) in Qlik Sense environments.
MIT License
20 stars 3 forks source link

Expose artifact map in session variables #425

Closed atluq closed 1 year ago

atluq commented 1 year ago

Checklist

Squash commit message

Expose artifact map in session variables

This will enable using resource ids in templates, e.g:

{
  "action": "setscriptvar",
  "settings": {
    "name": "MyAppId",
    "type": "string",
    "value": "{{.Artifacts.GetIDByTypeAndName \"app\" (print \"an-app-\" .Session)}}"
  }
}

Info

DnlLrssn commented 1 year ago

not directly related to PR. but isprint actually needed in the golang template?

atluq commented 1 year ago

not directly related to PR. but isprint actually needed in the golang template?

There might be another way to concatenate strings inside of the braces. I wanted to include an example where .Session was used in the name since it is a common practice.

atluq commented 1 year ago

Maybe should add a function to lookup name from ID too? Otherwise, yea think this should work and be a good addition.

Would be a simple addition. Do you have a use case example? Can't come up with any at the top of my head.

DnlLrssn commented 1 year ago

Maybe should add a function to lookup name from ID too? Otherwise, yea think this should work and be a good addition.

Would be a simple addition. Do you have a use case example? Can't come up with any at the top of my head.

E.g. if you want to use the name in a POST request, e.g. a title.

DnlLrssn commented 1 year ago

not directly related to PR. but isprint actually needed in the golang template?

There might be another way to concatenate strings inside of the braces. I wanted to include an example where .Session was used in the name since it is a common practice.

Did a quick check seems it's necessary to do it something like that.