From ac375a80fd99f0e82295cd89c569ba91c4f5d395 Mon Sep 17 00:00:00 2001 From: gongdewei Date: Mon, 30 Mar 2020 19:10:21 +0800 Subject: [PATCH] Add http api test scripts --- core/http-api-test.http | 92 +++++++++++++++++++++++++++++++++++++++++ core/pull_results.sh | 20 +++++++++ 2 files changed, 112 insertions(+) create mode 100644 core/http-api-test.http create mode 100755 core/pull_results.sh diff --git a/core/http-api-test.http b/core/http-api-test.http new file mode 100644 index 000000000..18948a8c6 --- /dev/null +++ b/core/http-api-test.http @@ -0,0 +1,92 @@ +### + +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "init_session" +} + +### + +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "join_session", +"sessionId":"c8940459-dacb-4798-b721-7f58728b76c8" +} + +### +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "async_exec", +"command": "watch demo.MathGame primeFactors 'params' -n 3 ", +"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2" +} + +### + +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "async_exec", +"command": "version ", +"sessionId":"c8940459-dacb-4798-b721-7f58728b76c8" +} + +### + +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "async_exec", +"command": "session ", +"sessionId":"c8940459-dacb-4798-b721-7f58728b76c8" +} + +### +### SYNC REST API +### +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "exec", +"command": "watch demo.MathGame primeFactors 'params' -n 3 ", +"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2" +} + +### +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "exec", +"command": "session", +"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2" +} + +### +POST http://localhost:8563/api +Accept: */* +Cache-Control: no-cache + +{ +"action": "exec", +"command": "version", +"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2" +} + +### diff --git a/core/pull_results.sh b/core/pull_results.sh new file mode 100755 index 000000000..98266730f --- /dev/null +++ b/core/pull_results.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +sum=0 +i=1 +while(( i <= 100 )) +do + let "i += 1" + curl -XPOST http://localhost:8563/api -d @<(cat << EOF +{ +"action": "pull_results", +"sessionId":"$1", +"consumerId": "$2" +} +EOF) + +echo "" + +done + +echo "count=$i"