forked from kailask/sharded-kvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.sh
executable file
·47 lines (36 loc) · 1.4 KB
/
test1.sh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# ------------------------------
# Run Docker containers
# convenience variables
addr1="10.10.1.0:13800"
addr2="10.10.2.0:13800"
addr3="10.10.3.0:13800"
full_view="${addr1},${addr2},${addr3}"
# create 3 nodes with 2 in initial view
source ./create.sh 3 2
docker start node1 node2 node3 > /dev/null
# ------------------------------
# add a key
curl --request PUT \
--header "Content-Type: application/json" \
--data '{"value": "sampleValue"}' \
--write-out "%{http_code}\n" \
http://localhost:13802/kvs/keys/sampleKey
# get a key
curl --request GET \
--header "Content-Type: application/json" \
--write-out "%{http_code}\n" \
http://localhost:13801/kvs/keys/sampleKey
# ------------------------------
# Add 3rd node into view
curl --request PUT \
--header "Content-Type: application/json" \
--data "{\"view\":\"${full_view}\"}" \
--write-out "%{http_code}\n" \
http://localhost:13802/kvs/view-change
# get same key from new node
curl --request GET \
--header "Content-Type: application/json" \
--write-out "%{http_code}\n" \
http://localhost:13803/kvs/keys/sampleKey
source ./stop.sh