Demonstration release of the principles underpinning krsd.
[krsd] / scripts / run-requests.sh
1 #!/bin/bash
2
3 ## run various requests against running test server.
4 ## this script is pretty useless on it's own, but used by leakcheck.sh/limitcheck.sh
5
6 get() {
7   echo -n "GET $1"
8   curl -H "Authorization: Bearer static-token-for-now" $1 >/dev/null 2>&1
9   echo " -> $?"
10 }
11
12 put() {
13   echo -n "PUT $1"
14   curl -X PUT -H "Authorization: Bearer static-token-for-now" $1 --data "$2" >/dev/null 2>&1
15   echo " -> $?"
16 }
17
18 delete() {
19   echo -n "DELETE $1"
20   curl -X DELETE -H "Authorization: Bearer static-token-for-now" $1 --data "$2" >/dev/null 2>&1
21   echo " -> $?"
22 }
23
24 # retrieve some directories
25 get http://localhost:8181/nil/src/rs-serve/ 
26 get http://localhost:8181/nil/src/rs-serve/src/
27 get http://localhost:8181/nil/src/rs-serve/scripts/
28 # retrieve some files
29 get http://localhost:8181/nil/src/rs-serve/Makefile
30 get http://localhost:8181/nil/src/rs-serve/rs-serve
31 get http://localhost:8181/nil/src/rs-serve/LICENSE
32 get http://localhost:8181/nil/src/rs-serve/src/main.c
33 get http://localhost:8181/nil/src/rs-serve/src/config.h
34 get http://localhost:8181/nil/src/rs-serve/src/rs-serve.h
35 get http://localhost:8181/nil/src/rs-serve/src/storage.c
36 # create some stuff
37 put http://localhost:8181/nil/src/rs-serve/foo/bar/a "File A"
38 put http://localhost:8181/nil/src/rs-serve/foo/bar/b "File B"
39 put http://localhost:8181/nil/src/rs-serve/foo/bar/c "File C"
40 put http://localhost:8181/nil/src/rs-serve/foo/bar/baz/d "File D"
41 put http://localhost:8181/nil/src/rs-serve/foo/bar/baz/e "File E"
42 put http://localhost:8181/nil/src/rs-serve/foo/bar/baz/f "File F"
43 # retrieve just created files & folders
44 get http://localhost:8181/nil/src/rs-serve/foo/
45 get http://localhost:8181/nil/src/rs-serve/foo/bar/
46 get http://localhost:8181/nil/src/rs-serve/foo/bar/a
47 get http://localhost:8181/nil/src/rs-serve/foo/bar/b
48 get http://localhost:8181/nil/src/rs-serve/foo/bar/c
49 get http://localhost:8181/nil/src/rs-serve/foo/bar/baz/
50 get http://localhost:8181/nil/src/rs-serve/foo/bar/baz/d
51 get http://localhost:8181/nil/src/rs-serve/foo/bar/baz/e
52 get http://localhost:8181/nil/src/rs-serve/foo/bar/baz/f
53 # delete some files
54 delete http://localhost:8181/nil/src/rs-serve/foo/bar/a
55 delete http://localhost:8181/nil/src/rs-serve/foo/bar/b
56 delete http://localhost:8181/nil/src/rs-serve/foo/bar/c
57 # attempt to get deleted files & dir
58 get http://localhost:8181/nil/src/rs-serve/foo/bar/
59 get http://localhost:8181/nil/src/rs-serve/foo/bar/a
60 get http://localhost:8181/nil/src/rs-serve/foo/bar/b
61 get http://localhost:8181/nil/src/rs-serve/foo/bar/c
62 # delete the rest
63 delete http://localhost:8181/nil/src/rs-serve/foo/bar/baz/d
64 delete http://localhost:8181/nil/src/rs-serve/foo/bar/baz/e
65 delete http://localhost:8181/nil/src/rs-serve/foo/bar/baz/f
66