From deb5472954859f17cddf3d0c14b036070d07c390 Mon Sep 17 00:00:00 2001 From: Lucas Hinderberger Date: Thu, 6 Jun 2024 16:39:54 +0200 Subject: [PATCH] Re-introducing tests for parallel execution, modified for new requirements This partially reverts commit 0a7debf08ed06c2206ca27e61dff80bb0702976a. --- test/parallel/check_collected_responses.json | 26 ++++++++++++++++++++ test/parallel/manifest.json | 21 ++++++++++++++++ test/parallel/parallel.json | 24 ++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 test/parallel/check_collected_responses.json create mode 100644 test/parallel/manifest.json create mode 100644 test/parallel/parallel.json diff --git a/test/parallel/check_collected_responses.json b/test/parallel/check_collected_responses.json new file mode 100644 index 00000000..564d76a6 --- /dev/null +++ b/test/parallel/check_collected_responses.json @@ -0,0 +1,26 @@ +[ + { + "name": "bounce-json: bounce collected responses from N={{datastore "n_parallel"}} parallel runs: {{ datastore "responses" }}", + "request": { + "server_url": "http://localhost{{ datastore "local_port" }}", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "responses": {{ datastore "responses" | marshal }} + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "responses": [ + {{ range $idx, $n := N (datastore "n_parallel") }} + {{ if gt $idx 0 }}, {{ end }} + 1 + {{ end }} + ] + } + } + } + } +] \ No newline at end of file diff --git a/test/parallel/manifest.json b/test/parallel/manifest.json new file mode 100644 index 00000000..6c7cfab0 --- /dev/null +++ b/test/parallel/manifest.json @@ -0,0 +1,21 @@ +{{ $local_port := ":9999" }} +{{ $n_parallel := 5 }} +{ + "http_server": { + "addr": "{{ $local_port }}", + "dir": "../_res", + "testmode": false + }, + "name": "parallel run of N={{ $n_parallel }} repetitions", + "tests": [ + { + "name": "port {{ $local_port }}", + "store": { + "n_parallel": {{ $n_parallel }}, + "local_port": {{ $local_port | marshal }} + } + } + , "{{ $n_parallel }}@parallel.json" + , "@check_collected_responses.json" + ] +} diff --git a/test/parallel/parallel.json b/test/parallel/parallel.json new file mode 100644 index 00000000..75b9d71d --- /dev/null +++ b/test/parallel/parallel.json @@ -0,0 +1,24 @@ +[ + { + "name": "bounce-json: bounce n=1", + "request": { + "server_url": "http://localhost{{ datastore "local_port" }}", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "n": 1 + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "n": 1 + } + } + }, + "store_response_qjson": { + "responses[]": "body.body.n" + } + } +] \ No newline at end of file