Skip to content

Commit

Permalink
Test the result of the write command
Browse files Browse the repository at this point in the history
  • Loading branch information
stggn committed Oct 5, 2022
1 parent 68e053c commit eaf3dbb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

set -eu

#CMD=docker run -d -p 8080:8080 -p 8081:8081 ${{ secrets.DOCKER_USERNAME }}/warp10:${TAG}-test
CMD=$1

Expand All @@ -29,7 +31,11 @@ READ_TOKEN=$(docker exec -i "${id}" tail -n 1 /opt/warp10/etc/initial.tokens | s
WRITE_TOKEN=$(docker exec -i "${id}" tail -n 1 /opt/warp10/etc/initial.tokens | sed -e 's/.*,"write":{"token":"//' -e 's/".*//')

echo "Write data"
curl -s -H "X-Warp10-Token: ${WRITE_TOKEN}" http://127.0.0.1:8080/api/v0/update --data-binary '// test{} 42'
if ! curl -s -H "X-Warp10-Token: ${WRITE_TOKEN}" http://127.0.0.1:8080/api/v0/update --data-binary '// test{} 42'; then
echo "Failed to write data"
docker stop "${id}"
exit 1
fi

echo "Read data"
res=$(curl -s "http://127.0.0.1:8080/api/v0/fetch?token=${READ_TOKEN}&selector=~.*\{\}&now=now&timespan=-1" | cut -d ' ' -f3)
Expand Down

0 comments on commit eaf3dbb

Please sign in to comment.