File: dqlite-demo.sh

package info (click to toggle)
golang-github-canonical-go-dqlite 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 712 kB
  • sloc: sh: 380; makefile: 5
file content (33 lines) | stat: -rwxr-xr-x 687 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh -eu
#
# Test the dqlite-demo application.

BASEDIR=$(dirname "$0")
. "$BASEDIR"/dqlite-demo-util.sh

trap tear_down EXIT
trap sig_handler HUP INT TERM

set_up

echo "=> Start test"

echo "=> Put key to node 1"
if [ "$(curl -s -X PUT -d my-key http://127.0.0.1:8001/my-value)" != "done" ]; then
    echo "Error: put key to node 1"
fi

echo "=> Get key from node 1"
if [ "$(curl -s http://127.0.0.1:8001/my-value)" != "my-key" ]; then
    echo "Error: get key from node 1"
fi

echo "=> Kill node 1"
kill_node 1

echo "=> Get key from node 2"
if [ "$(curl -s http://127.0.0.1:8002/my-value)" != "my-key" ]; then
    echo "Error: get key from node 2"
fi

echo "=> Test successful"