diff options
-rw-r--r-- | dat/sample-pipe.json (renamed from dat/sample.json) | 0 | ||||
-rw-r--r-- | dat/sample-pipegram.json (renamed from dat/sample-gram.json) | 0 | ||||
-rw-r--r-- | dat/sample-web-bulk.json | 21 | ||||
-rw-r--r-- | dat/sample-web.json (renamed from dat/sample-post.json) | 0 | ||||
-rwxr-xr-x | src/hub/test-client | 53 |
5 files changed, 50 insertions, 24 deletions
diff --git a/dat/sample.json b/dat/sample-pipe.json index ed327fc..ed327fc 100644 --- a/dat/sample.json +++ b/dat/sample-pipe.json diff --git a/dat/sample-gram.json b/dat/sample-pipegram.json index 09e5943..09e5943 100644 --- a/dat/sample-gram.json +++ b/dat/sample-pipegram.json 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-post.json b/dat/sample-web.json index 35c76e0..35c76e0 100644 --- a/dat/sample-post.json +++ b/dat/sample-web.json 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' |