How to set servicePort equal to the randomly generated hostPort? - mesos

I see that setting the boolean requirePorts in the marathon app JSON will set the containerPort equal to the hostPort, but I need the opposite scenario - I set hostPort to 0 and now want the servicePort (I'm using marathon-lb) to be equal to the generated hostPort number.
I tried using the automatic environment variable $HOST0 for example but it would accept this in the servicePort field.
Thanks!

Related

Cannot set property with previously defined property in botbnt framework composer

I am working on a bot build with Microsoft bot framework composer
I have an HTTP request that works and returns an array of programs
Currently, I have a "0" hard set and that works
${dialog.programlistlite.api_response.content.programs[0].name}
what i am trying to do is take property called dialog.resultnumber which is set to 0 and replace static "0" above with property called dialog.resultsnumber
I tried:
${dialog.programlistlite.api_response.content.programs[${dialog.resultsnumber}].name}
${dialog.programlistlite.api_response.content.programs[(dialog.resultsnumber)].name}
${dialog.programlistlite.api_response.content.programs[dialog.resultsnumber].name}
${dialog.programlistlite.api_response.content.programs[getproperty(dialog.resultsnumber)].name}
${dialog.programlistlite.api_response.content.programs[dialog.resultsnumber()].name}
${dialog.programlistlite.api_response.content.programs[${dialog.resultsnumber()}].name}
I cannot find the syntax to use an already defined property to build a new property
what i am trying to do is take property called dialog.resultnumber which is set to 0 and replace static "0" above with property called dialog.resultsnumber I tried:
Are you sure that dialog.resultsnumber is an int?
If you set it in a single set property action, make sure you set it as an int, the default is a string.
This below should be the one. It worked for me (with the above caveat):
${dialog.programlistlite.api_response.content.programs[dialog.resultsnumber].name}
You can also use the isInteger() type checking function to confirm if something is an int, or try and force/convert/coerce using int() if needed as well.

In Heroku, is it possible to assign one env var to another env var?

By using https://github.com/mars/heroku-js-runtime-env-buildpack I'm having my frontend pick up some run-time envvars from the server. The problem I have is that it only picks up environment variables with names starting with JS_RUNTIME_ and I want to pick HEROKU_RELEASE_VERSION.
Is there a way to make Heroku somehow set JS_RUNTIME_HEROKU_RELEASE_VERSION to the same value as HEROKU_RELEASE_VERSION?

Golang Google Admin SDK API Client not setting boolean properties correctly

I am using golang package google.golang.org/api/admin/directory/v1 v0.28.0 to build an administrator CLI for Google G Suite.
The User type (and other types as well) has boolean properties with omitempty json tags. I can set these properties to a value of true, but when I try to set them to false, nothing happens. I believe that this is because the omitempty option means that the value false is ignored when passed.
After a bit of web research, it seems that the answer might be to use pointers and change the type of the boolean properties from bool to *bool. Then set the value by using a bool pointer like this:
user := new(*admin.User)
f := new(bool)
*f = false
user.Suspended = f
I'm not sure why this might work, but it was suggested and confirmed as working in respect of another API.
These API client libraries are auto-generated and I'm not sure how I can test my theory. If anyone has come across this issue in the past, is there a remedy or workaround for it? Could anyone suggest how I can generate my own version of the golang client?

Jmeter $__Random() with user defined variables

I have an issue I have been struggeling with for some time.
In my script I'm calculating a max and min value. I save it using:
int minWaitPregancy_acutall=0.2*maxWaitPregancyWait;
int maxWaitPregancy_acutall=0.8*maxWaitPregancyWait;
vars.putObject("minWaitPregancy_acutall", minWaitPregancy_acutall);
vars.putObject("maxWaitPregancy_acutall", maxWaitPregancy_acutall);
So far so good, it is saved and I can see it using the debugger.
Now I would like to use it in say a "Uniform Random timer".
I set the constant delay to 0 and in the Random Delay Maximum I try thing like:
${__Random(${__eval(vars.getObject("minWaitPregancy_acutall"))},${__eval(vars.get("maxWaitPregancy_acutall"))})}
For some reason that (and other variations, like skipping __eval) doesn't work I get variations of:
"java.lang.NumberFormatException: For input string: "vars.getObject("minWaitPregancy_acutall")""
So I guess I don't understand how to retrieve and use the data from the user defined variables. Any help??
As per Elements of Test Plan -> Execution Order
0. Configuration elements
1. Pre-Processors
2. Timers
3. Sampler
4. Post-Processors (unless SampleResult is null)
5. Assertions (unless SampleResult is null)
6. Listeners (unless SampleResult is null)
As per User Defined Variables documentation:
The User Defined Variables element lets you define an initial set of variables, just as in the Test Plan.
Note that all the UDV elements in a test plan - no matter where they are - are processed at the start.
It looks like you're using the wrong test element, if you want to calculate a random variable and save it you need to use a PreProcessor, for example User Parameters

Is it possible to set rootMetricsPrefix with a command line parameter?

My JMeter test receives a parameter to specify test environment like PROD, DEV.
Results from both test environment will be sent to a certain GraphiteHost. But I need to separate the results of each environment by using rootMetricsPrefix.
For example, results from PROD will use prefix global.myapp.performance.prod. while the results from DEV will use prefix global.myapp.performance.dev..
So I set the rootMetricsPrefix in my Backend Listener as global.myapp.performance.${__groovy($__P(env).toLowerCase())}..
Unfortunately, It doesn't work.
Data in Graphite doesn't contains the environment name.
Can anyone tell me how to solve this?
You can use new changeCase function to lower case your value:
${__changeCase(${__P(env)},LOWER,)}
It will read the property and then execute lower case on value
There is an error in your expression it should be:
global.myapp.performance.${__groovy("${__P(env)}".toLowerCase())}
This will also work:
global.myapp.performance.${__groovy(props.get("env").toLowerCase())}
But for performances, it is better to use the solution provided by #user7294900

Resources