Skip to content

cURL Examples

Warning

Some of the examples use the JQ JSON command line processor. You may need to install it.

Runtime API

Info

You may replace the kraken-runtime hostname with the current IP of hostname of your Analysis backend.

Start a Task

RUN Test

The following cURL command starts a new load test.

curl -d '{"description": "description", "taskType": "GATLING_RUN", "hostIds": ["local"], "entries": [{"scope": "", "from": "USER", "key": "KRAKEN_GATLING_SIMULATION", "value": "computerdatabase.BasicSimulation"}, {"scope": "", "from": "USER", "key": "FOO", "value": "BAR"}]}' -H "ApplicationId: shell" -H "Content-Type: application/json" -X POST http://kraken-runtime/task
K8S specifics

Warning

On Kubernetes you need to specify at least one host !

For example:

    "hosts": {"kraken-1": {}}

List hosts with the following command:

curl http://kraken-runtime/host/list

You can extract the host ids from the response:

[{"id":"kraken-1","name":"kind-worker","capacity":{"cpu":"8","ephemeral-storage":"289613092Ki","hugepages-1Gi":"0","hugepages-2Mi":"0","memory":"16135292Ki","pods":"110"},"addresses":[{"address":"172.17.0.6","type":"InternalIP"},{"address":"kind-worker","type":"Hostname"}]},{"id":"kraken-2","name":"kind-worker2","capacity":{"cpu":"8","ephemeral-storage":"289613092Ki","hugepages-1Gi":"0","hugepages-2Mi":"0","memory":"16135292Ki","pods":"110"},"addresses":[{"address":"172.17.0.3","type":"InternalIP"},{"address":"kind-worker2","type":"Hostname"}]},{"id":"kraken-3","name":"kind-worker3","capacity":{"cpu":"8","ephemeral-storage":"289613092Ki","hugepages-1Gi":"0","hugepages-2Mi":"0","memory":"16135292Ki","pods":"110"},"addresses":[{"address":"172.17.0.4","type":"InternalIP"},{"address":"kind-worker3","type":"Hostname"}]}]

Start task:

curl -d '{"description": "description", "taskType": "GATLING_RUN", "hostIds": ["afmf3oajpd", "pp7m8vimjd"], "entries": [{"scope": "", "from": "USER", "key": "KRAKEN_GATLING_SIMULATION", "value": "computerdatabase.BasicSimulation"}, {"scope": "", "from": "USER", "key": "FOO", "value": "BAR"}]}' -H "ApplicationId: shell" -H "Content-Type: application/json" -X POST http://kraken-runtime/task

DEBUG Test

The following cURL command debugs a Gatling simulation.

curl -d '{"KRAKEN_DESCRIPTION": "description", "KRAKEN_GATLING_SIMULATION": "computerdatabase.BasicSimulation"}' -H "ApplicationId: shell" -H "Content-Type: application/json" -X POST http://kraken-runtime/task/DEBUG

RECORD HAR

The following cURL command converts an existing HAR file into a Gatling simulation.

curl -d '{"KRAKEN_DESCRIPTION": "description", "KRAKEN_GATLING_SIMULATION_PACKAGE": "com.test", "KRAKEN_GATLING_SIMULATION_CLASS": "TestHar", "KRAKEN_GATLING_HAR_PATH_REMOTE": "hars/app.octoperf.com.har"}' -H "ApplicationId: shell" -H "Content-Type: application/json" -X POST http://kraken-runtime/task/RECORD

List Tasks

The following cURL command lists all Tasks.

curl http://kraken-runtime/task/list | jq '.'
[
  {
    "id": "e4aff6e2-a3ff-483a-9e47-55febe2fd51d",
    "startDate": 0,
    "status": "CREATING",
    "type": "DEBUG",
    "containers": [],
    "description": "description"
  }
]

Note

The test result ID is the same as the task ID.

You can use to to get the created result content

Watch logs

Open http://kraken-runtime/runtime/watch/shell in a web browser.

Attach container logs

The following cURL command attach the container logs to the watch stream.

curl -H "ApplicationId: shell" -H "Content-Type: application/json" -X POST "http://kraken-runtime/container/logs/attach?taskId=ncqyfq2fbh&hostname=2558bbde3f93&containerId=ncqyfq2fbh-gatling-runner"

Cancel a task

The following cURL command cancels a running task.

curl -H "ApplicationId: shell" -H "Content-Type: application/json" -X POST "http://kraken-runtime/task/cancel/RUN?taskId=ncqyfq2fbh"

Analysis API

Info

You may replace the kraken-analysis hostname with the current IP of hostname of your Analysis backend.

Create Test Result

The following cURL command creates a new test Result.

curl -d '{"id":"resultId", "startDate":42, "endDate":42, "status":"STARTING", "description": "description", "type": "DEBUG"}' -H "Content-Type: application/json" -X POST http://kraken-analysis/result | jq '.'
{
  "path": "gatling/results/resultId/result.json",
  "type": "FILE",
  "depth": 3,
  "length": 108,
  "lastModified": 1568186290386
}

Set Result Status

The following cURL command set the status of an existing test Result.

curl -X POST http://kraken-analysis/result/status/RUNNING?resultId=resultId | jq '.'
{
  "path": "gatling/results/resultId/result.json",
  "type": "FILE",
  "depth": 3,
  "length": 106,
  "lastModified": 1568187054353
}

Add Debug Entry

The following cURL command adds a new DebugEntry.

curl -d @debug-entry.json -H "Content-Type: application/json" -X POST http://kraken-analysis/result/debug | jq '.'

Note

A sample debug-entry.json file is available here.

{
  "id": "debugId",
  "resultId": "resultId",
  "date": 42,
  "requestName": "request_1",
  "requestStatus": "OK",
  "session": "session",
  "requestUrl": "GET http://kraken.octoperf.com/",
  "requestHeaders": [
    {
      "key": "Accept",
      "value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    },
    {
      "key": "DNT",
      "value": "1"
    },
    {
      "key": "Accept-Language",
      "value": "en-US,en;q=0.5"
    }
  ],
  "requestCookies": [
    "Cookie"
  ],
  "requestBodyFile": "debugId-request.txt",
  "responseStatus": "303 See Other",
  "responseHeaders": [
    {
      "key": "Server",
      "value": "nginx/1.12.2"
    },
    {
      "key": "Date",
      "value": "Fri, 05 Apr 2019 11:52:04 GMT"
    },
    {
      "key": "Content-Length",
      "value": "0"
    }
  ],
  "responseBodyFile": "debugId-response.txt"
}

Delete a Result

The following cURL command deletes a test Result.

curl -X DELETE http://kraken-analysis/result?resultId=resultId
resultId

Storage API

Info

You may replace the kraken-storage hostname with the current IP of hostname of your Storage backend.

List Files

The following cURL command list all files managed by the Kraken Storage backend.

curl http://kraken-storage/files/list | jq '.'
[
  {
    "path": "README.md",
    "type": "FILE",
    "depth": 0,
    "length": 815,
    "lastModified": 1568184229192
  },
  {
    "path": "kraken.svg",
    "type": "FILE",
    "depth": 0,
    "length": 3383,
    "lastModified": 1568184229196
  }
]

Get Result JSON

The following cURL command return an existing test Result.

curl http://kraken-storage/files/get/json?path=gatling/results/resultId/result.json | jq '.'
{
  "id": "resultId",
  "startDate": 42,
  "endDate": 42,
  "status": "STARTING",
  "description": "description",
  "type": "DEBUG"
}

List Debug Entries

The following cURL command list existing debug entries.

curl "http://kraken-storage/files/find?rootPath=gatling/results/resultId/&matcher=debugId.*" | jq '.'
[
  {
    "path": "gatling/results/resultId/debugId-response.txt",
    "type": "FILE",
    "depth": 3,
    "length": 25,
    "lastModified": 1568190870533
  },
  {
    "path": "gatling/results/resultId/debugId.debug",
    "type": "FILE",
    "depth": 3,
    "length": 644,
    "lastModified": 1568190870541
  },
  {
    "path": "gatling/results/resultId/debugId-request.txt",
    "type": "FILE",
    "depth": 3,
    "length": 24,
    "lastModified": 1568190870501
  }
]

Get the Content of a DebugEntry's Request Body

The following cURL command return the content of a text file.

curl http://kraken-storage/files/get/content?path=gatling/results/resultId/debugId-request.txt
requestBodyFile Content!