... If you have no idea what nGrinder is, please refer to this page: [Getting Started with nGrinder] You can create a script with OpenWhisk apiHost as a URL to test. ... Move to Performance Test and create a test with the script you've just created. Once you test with 1 action, you may want to test with more number of actions. ...
Code Block |
language |
groovy |
title |
test script |
|
@Test
public void test(){
Random rand = new Random();
int randActionNum = rand.nextInt(100);
HTTPResponse result = request.POST("https://10.10.10.10/api/v1/namespaces/whisk.system/actions/noopThroughput" + randActionNum +"?blocking=true&result=true", params)
assertThat(result.statusCode, is(200));
} |
Surely you can also test with multiple namespaces and actions. ...
Code Block |
language |
groovy |
title |
Test script |
|
@Test
public void test(){
Random rand = new Random();
int randUserNum = rand.nextInt(99); // the user number
int randActionNum = rand.nextInt(2); // the action number
// This UUID and KEY should be same with the one in the bash script.
String uuid = '11112ded-78ab-4cb8-afc7-452cc7d62' + String.format("%03d", randUserNum)
String key = 'AXg2egwVdeAaXKHTErTdBJKbY2jnLJzXWuyrMzw7vDFtbjUOkdhgDVqzWmqlfUIz'
List<NVPair> headerList = new ArrayList<NVPair>()
headerList.add(new NVPair("Content-Type", "application/json"))
headerList.add(HTTPPluginControl.getHTTPUtilities().basicAuthorizationHeader(uuid, key))
NVPair[] headers = headerList.toArray()
// Invoke randomly chosen action in randomly chosen namespace.
HTTPResponse result = request.POST("https://10.10.10.10/api/v1/namespaces/stub_user_" + randUserNum + "/actions/noopThroughput"+randActionNum+"?blocking=true&result=true", params, headers)
assertThat(result.statusCode, is(200));
} |
Similarly you can create actions with multiple runtimes or with different memory setting. ... |