From eaf3dbbf4a77cc75bd8fb70caa2005c3a60eb0fb Mon Sep 17 00:00:00 2001 From: Steven GUEGUEN Date: Wed, 5 Oct 2022 12:27:00 +0200 Subject: [PATCH] Test the result of the write command --- test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index ecaf959..739f4a9 100755 --- a/test.sh +++ b/test.sh @@ -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 @@ -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×pan=-1" | cut -d ' ' -f3)