Wednesday 29 April 2020

load testing orchestration - the cheap way

I have a client with an orch that is sometimes failing, the problem is that the previous order number is not always returning a value, so I'm trying to determine what is going on.  The way I'm going to do this is simulate numerous orchestration calls.

I'm sure there are heaps of ways of getting this done, but I'm going to demo something really simple!

One script with the following contents.

It'll run 10 times, you can just change the number 10 to what ever you want (in the while control)

You can do your own timing changes, and you can also text return codes - just google curl!

This is using basic auth, and yes - I've changed it so it's not going to work for you, haha.

My orchestration is called orch_AddS1WarrantyOrder2

The default payload for the orchestration is in the variable $data

I need to change the PO every time, hence modifying the variable with the PID of the script and also using an index.


Super simple!  paste the contents, chmod it and run it!

data='{ "inputs" : [ {    "name" : "orch_inputShipTo",    "value" : "379015"  }, {    "name" : "orch_inputMCU",    "value" : "MDC"  }, {    "name" : "orch_inputCustomerPO",    "value" : "49354384MK7"  }, {    "name" : "orch_inputQuantityOrdered",    "value" : "1"  }, {    "name" : "orch_inputItemNumber",    "value" : "90110263"  }, {    "name" : "orch_inputSubLedgerType",    "value" : "I"  }, {    "name" : "orch_inputSubLedger",    "value" : "00010155"  }  ]}'authString='Authorization: Basic SkR9889781pbiQ='
i=0
while [ $i -lt 10 ]  do 

  data2=`echo $data | sed "s/49354384MK7/$$384MK7${i}/g"` 

  echo $data2     

  curl -v --request POST  \          --url 'http://10.10.20.24:8081/jderest/orchestrator/orch_AddS1WarrantyOrder2' \          --header 'Accept: */*' \          --header "${authString}" \          --header 'Cache-Control: no-cache' \          --header 'Connection: keep-alive' \          --header 'Content-Type: application/json' \          --header 'accept-encoding: gzip, deflate' \          --header 'cache-control: no-cache' \          --data "${data2}"  i=$(($i+1))
done



No comments: