diff --git a/README.md b/README.md index 2175852..1f254fd 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ spec: ### Start Test The following request will send two `GET` request per second(`"countPerSec": 2`) to `httpbin.org/get` for 120 -seconds(`"duration": 60`). +seconds(`"duration": 120`). More example can be found in [test cases](https://github.com/eipi1/overload/tree/main/tests/src/resources) ```shell curl --location --request POST '{overload-host}:3030/test' \ --header 'Content-Type: application/json' \ @@ -100,7 +100,7 @@ Sample JSON request body - "name": "demo-test", "qps": { "ConstantRate": { - "countPerSec": 1 + "countPerSec": 2 } }, "req": { diff --git a/docs/src/api/api-test.md b/docs/src/api/api-test.md index 7d26030..bdd09d3 100644 --- a/docs/src/api/api-test.md +++ b/docs/src/api/api-test.md @@ -20,30 +20,70 @@ Sample JSON request body - # use overload_http::Request; # let req = r###" { - "duration": 120, - "name": "demo-test", + "duration": 800, + "name": "test-overload", + "histogram_buckets": [ + 1, + 2, + 5, + 7, + 10, + 15 + ], "qps": { - "ConstantRate": { - "countPerSec": 1 + "Linear": { + "a": 1, + "b": 1, + "max": 100 } }, "req": { "RequestList": { "data": [ { - "body": null, "method": "GET", - "url": "/get" + "url": "/serde", + "headers": { + "Host": "127.0.0.1:2000", + "Connection": "keep-alive" + } } ] } }, "target": { - "host": "httpbin.org", - "port": 80, + "host": "172.17.0.1", + "port": 2000, "protocol": "HTTP" }, - "histogramBuckets": [35,40,45,48,50, 52] + "concurrentConnection": { + "Linear": { + "a": 1, + "b": 1, + "max": 100 + } + }, + "responseAssertion": { + "luaAssertion": [ + "function(method, url, requestBody, responseBody)", + " -- initialize assertion result", + " result = {}", + " -- verify valid json response", + " jsonResp=json.decode(responseBody);", + " if jsonResp == nil then", + " -- create new assertion result", + " local err = {}", + " -- used for metrics, should avoid duplicate values in the same assertion", + " err.id = 1", + " err.success = false", + " err.error = 'Failed to parse to json'", + " -- add to result", + " table.insert(result, err)", + " end", + " return result", + "end" + ] + } } # "###; # let result = serde_json::from_str::(req); diff --git a/docs/src/getting-started.md b/docs/src/getting-started.md index cae57ac..7cd140f 100644 --- a/docs/src/getting-started.md +++ b/docs/src/getting-started.md @@ -1,7 +1,7 @@ # Getting Started ## Start Test The following request will send two `GET` request per second(`"countPerSec": 2`) to `httpbin.org/get` for 120 -seconds(`"duration": 60`). +seconds(`"duration": 120`). More example can be found in [test cases](https://github.com/eipi1/overload/tree/main/tests/src/resources) ```shell curl --location --request POST '{overload_host}:3030/test' \ --header 'Content-Type: application/json' \ @@ -20,7 +20,7 @@ Sample JSON request body - "name": "demo-test", "qps": { "ConstantRate": { - "countPerSec": 1 + "countPerSec": 2 } }, "req": { @@ -45,7 +45,6 @@ Sample JSON request body - # assert!(result.is_ok()); ``` - It'll respond with a job identifier and status. ```json {