From 30fd02cc084d08fdc56acff85b00392d194e78c4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 6 May 2017 17:47:04 +0200 Subject: revamp test client handling --- dat/sample-gram.json | 3 --- dat/sample-pipe.json | 9 ++++++++ dat/sample-pipegram.json | 3 +++ dat/sample-post.json | 9 -------- dat/sample-web-bulk.json | 21 +++++++++++++++++++ dat/sample-web.json | 9 ++++++++ dat/sample.json | 9 -------- src/hub/test-client | 53 ++++++++++++++++++++++++++---------------------- 8 files changed, 71 insertions(+), 45 deletions(-) delete mode 100644 dat/sample-gram.json create mode 100644 dat/sample-pipe.json create mode 100644 dat/sample-pipegram.json delete mode 100644 dat/sample-post.json create mode 100644 dat/sample-web-bulk.json create mode 100644 dat/sample-web.json delete mode 100644 dat/sample.json diff --git a/dat/sample-gram.json b/dat/sample-gram.json deleted file mode 100644 index 09e5943..0000000 --- a/dat/sample-gram.json +++ /dev/null @@ -1,3 +0,0 @@ -{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1, "data": {"bytes-sent": 1519, "client-count": 0}, "start-time": "2013-10-21T12:30:00Z", "duration-ms": 300000} -{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1, "data": {"bytes-sent": 22849, "client-count": 1}, "start-time": "2013-10-21T12:35:00Z", "duration-ms": 300000} -{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1, "data": {"bytes-sent": 33100, "client-count": 1}, "start-time": "2013-10-21T12:40:00Z", "duration-ms": 300000} diff --git a/dat/sample-pipe.json b/dat/sample-pipe.json new file mode 100644 index 0000000..ed327fc --- /dev/null +++ b/dat/sample-pipe.json @@ -0,0 +1,9 @@ +{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1} +{"data": {"bytes-sent": 1519, "client-count": 0}, "start-time": "2013-10-21T12:30:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 22849, "client-count": 1}, "start-time": "2013-10-21T12:35:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 33100, "client-count": 1}, "start-time": "2013-10-21T12:40:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 19957, "client-count": 1}, "start-time": "2013-10-21T14:55:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 6226, "client-count": 1}, "start-time": "2013-10-21T15:00:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 0, "client-count": 0}, "start-time": "2013-10-21T15:10:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 8970, "client-count": 1}, "start-time": "2013-10-21T15:15:00Z", "duration-ms": 300000} +{"data": {"bytes-sent": 413535, "clients": [{"ip": "85.238.166.201", "bytes-sent": 413535, "user-agent": "blah"}], "client-count": 1}, "start-time": "2013-10-24T05:18:28Z", "duration-ms": 5000} diff --git a/dat/sample-pipegram.json b/dat/sample-pipegram.json new file mode 100644 index 0000000..09e5943 --- /dev/null +++ b/dat/sample-pipegram.json @@ -0,0 +1,3 @@ +{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1, "data": {"bytes-sent": 1519, "client-count": 0}, "start-time": "2013-10-21T12:30:00Z", "duration-ms": 300000} +{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1, "data": {"bytes-sent": 22849, "client-count": 1}, "start-time": "2013-10-21T12:35:00Z", "duration-ms": 300000} +{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1, "data": {"bytes-sent": 33100, "client-count": 1}, "start-time": "2013-10-21T12:40:00Z", "duration-ms": 300000} diff --git a/dat/sample-post.json b/dat/sample-post.json deleted file mode 100644 index 35c76e0..0000000 --- a/dat/sample-post.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, - "hostname": "localhost", - "tags": ["suppa", "toll"], - "version": 1, - "data": {"bytes-sent": 1519, "client-count": 0}, - "start-time": "2013-10-21T12:30:00Z", - "duration-ms": 300000 -} diff --git a/dat/sample-web-bulk.json b/dat/sample-web-bulk.json new file mode 100644 index 0000000..31f1f2b --- /dev/null +++ b/dat/sample-web-bulk.json @@ -0,0 +1,21 @@ +{ + "version": 1, + "streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, + "hostname": "localhost", + "tags": ["suppa", "toll"] +} +{ + "start-time": "2013-10-26T12:30:00Z", + "duration-ms": 15000, + "data": {"bytes-sent": 0, "client-count": 0} +} +{ + "start-time": "2013-10-26T12:30:15Z", + "duration-ms": 15000, + "data": {"bytes-sent": 42, "client-count": 1} +} +{ + "start-time": "2013-10-26T12:30:30Z", + "duration-ms": 15000, + "data": {"bytes-sent": 1337, "client-count": 2} +} diff --git a/dat/sample-web.json b/dat/sample-web.json new file mode 100644 index 0000000..35c76e0 --- /dev/null +++ b/dat/sample-web.json @@ -0,0 +1,9 @@ +{ + "streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, + "hostname": "localhost", + "tags": ["suppa", "toll"], + "version": 1, + "data": {"bytes-sent": 1519, "client-count": 0}, + "start-time": "2013-10-21T12:30:00Z", + "duration-ms": 300000 +} diff --git a/dat/sample.json b/dat/sample.json deleted file mode 100644 index ed327fc..0000000 --- a/dat/sample.json +++ /dev/null @@ -1,9 +0,0 @@ -{"streamer-id": {"quality": "high", "content-id": "av", "format": "webm"}, "hostname": "localhost", "tags": ["suppa", "toll"], "version": 1} -{"data": {"bytes-sent": 1519, "client-count": 0}, "start-time": "2013-10-21T12:30:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 22849, "client-count": 1}, "start-time": "2013-10-21T12:35:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 33100, "client-count": 1}, "start-time": "2013-10-21T12:40:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 19957, "client-count": 1}, "start-time": "2013-10-21T14:55:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 6226, "client-count": 1}, "start-time": "2013-10-21T15:00:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 0, "client-count": 0}, "start-time": "2013-10-21T15:10:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 8970, "client-count": 1}, "start-time": "2013-10-21T15:15:00Z", "duration-ms": 300000} -{"data": {"bytes-sent": 413535, "clients": [{"ip": "85.238.166.201", "bytes-sent": 413535, "user-agent": "blah"}], "client-count": 1}, "start-time": "2013-10-24T05:18:28Z", "duration-ms": 5000} diff --git a/src/hub/test-client b/src/hub/test-client index 612e576..5858969 100755 --- a/src/hub/test-client +++ b/src/hub/test-client @@ -2,29 +2,34 @@ TEST_D="./test" -echo "pipe: import sample.json" -echo "------------------------" -socat file:../../dat/sample.json,rdonly "unix-client:$TEST_D/pipe" -echo "" - -echo "pipe-gram: import sample-gram.json" -echo "----------------------------------" -while read x; do echo "$x" | socat stdio "unix-sendto:$TEST_D/pipegram"; done < ../../dat/sample-gram.json -echo "" +case $1 in + pipe) + echo "pipe: send sample-pipe.json" + echo "---------------------------" + time socat file:../../dat/sample-pipe.json,rdonly "unix-client:$TEST_D/pipe" + echo "" + ;; + pipegram) + echo "pipe-gram: send sample-pipegram.json" + echo "------------------------------------" + time $(while read x; do echo "$x" | socat stdio "unix-sendto:$TEST_D/pipegram"; done < ../../dat/sample-pipegram.json) + echo "" + ;; + web) + echo "web: post sample-web.json" + echo "-------------------------" + time curl 'http://localhost:8000/updates' -d @../../dat/sample-web.json + echo "" + ;; + web-bulk) + echo "web: post sample-web-bulk.json" + echo "------------------------------" + time curl 'http://localhost:8000/updates?bulk=1' -d @../../dat/sample-web-bulk.json + echo "" + ;; +esac -echo "post update" -echo "-----------" -curl -i --data @../../dat/sample-post.json 'http://localhost:8000/updates' -echo -e "\n" - -echo "post update (bulk)" -echo "------------------" -curl -i --data @../../dat/sample-post-bulk.json 'http://localhost:8000/updates?bulk=1' -echo -e "\n" - -echo "show query result" -echo "-----------------" -curl -i 'http://localhost:8000/updates' +echo "store contents:" +echo "---------------" +curl 'http://localhost:8000/updates' | jq . echo "" - -echo '\n\ndone' -- cgit v1.2.3