From f0612e57c26da15e3875c6d1b81234be5f6f5455 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 5 Jun 2014 11:48:22 +0200 Subject: [PATCH] Integration tests with API key --- integration/folders.sh | 6 ++-- integration/h1/config.xml | 55 +++++++++++++++++++----------------- integration/h2/config.xml | 59 +++++++++++++++++++-------------------- integration/h3/config.xml | 48 ++++++++++++++++--------------- integration/test.sh | 13 ++++++--- 5 files changed, 95 insertions(+), 86 deletions(-) diff --git a/integration/folders.sh b/integration/folders.sh index 8afec542..b9b11db4 100755 --- a/integration/folders.sh +++ b/integration/folders.sh @@ -20,7 +20,7 @@ start() { stop() { echo "Stopping..." for i in 1 2 ; do - curl -X POST "http://localhost:808$i/rest/shutdown" + curl -HX-API-Key:abc123 -X POST "http://localhost:808$i/rest/shutdown" done } @@ -39,8 +39,8 @@ setup() { testConvergence() { while true ; do sleep 5 - s1comp=$(curl -s "http://localhost:8082/rest/connections" | ./json "$id1/Completion") - s2comp=$(curl -s "http://localhost:8081/rest/connections" | ./json "$id2/Completion") + s1comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8082/rest/connections" | ./json "$id1/Completion") + s2comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8081/rest/connections" | ./json "$id2/Completion") s1comp=${s1comp:-0} s2comp=${s2comp:-0} tot=$(($s1comp + $s2comp)) diff --git a/integration/h1/config.xml b/integration/h1/config.xml index 556d0774..f82830ac 100644 --- a/integration/h1/config.xml +++ b/integration/h1/config.xml @@ -1,41 +1,44 @@ - - - -
127.0.0.1:22001
-
- -
127.0.0.1:22002
-
- -
127.0.0.1:22003
-
- -
127.0.0.1:22004
-
+ + + + + + + - - -
127.0.0.1:22001
-
- -
127.0.0.1:22002
-
+ + + + + +
127.0.0.1:22001
+
+ +
127.0.0.1:22002
+
+ +
127.0.0.1:22003
+
+ +
127.0.0.1:22004
+
+ +
127.0.0.1:8081
+ abc123 +
127.0.0.1:22001 - false - true - true - true - 127.0.0.1:8081 announce.syncthing.net:22025 false true + 21025 16 0 10 5 10000 false + true
diff --git a/integration/h2/config.xml b/integration/h2/config.xml index 8901c4ef..cc747530 100644 --- a/integration/h2/config.xml +++ b/integration/h2/config.xml @@ -1,46 +1,45 @@ - - - -
127.0.0.1:22001
-
- -
127.0.0.1:22002
-
- -
127.0.0.1:22003
-
+ + + + + + - - -
127.0.0.1:22001
-
- -
127.0.0.1:22002
-
+ + + + - - -
127.0.0.1:22002
-
- -
127.0.0.1:22003
-
+ + + + + +
127.0.0.1:22001
+
+ +
127.0.0.1:22002
+
+ +
127.0.0.1:22003
+
+ +
127.0.0.1:8082
+ abc123 +
127.0.0.1:22002 - false - true - true - true - 127.0.0.1:8082 announce.syncthing.net:22025 false true + 21025 16 0 15 5 10000 false + true
diff --git a/integration/h3/config.xml b/integration/h3/config.xml index ceb7dd19..07719990 100644 --- a/integration/h3/config.xml +++ b/integration/h3/config.xml @@ -1,38 +1,40 @@ - - - -
127.0.0.1:22001
-
- -
127.0.0.1:22002
-
- -
127.0.0.1:22003
-
+ + + + + + - - -
127.0.0.1:22002
-
- -
127.0.0.1:22003
-
+ + + + + +
127.0.0.1:22001
+
+ +
127.0.0.1:22002
+
+ +
127.0.0.1:22003
+
+ +
127.0.0.1:8083
+ abc123 +
127.0.0.1:22003 - false - true - true - true - 127.0.0.1:8083 announce.syncthing.net:22025 false true + 21025 16 0 20 5 10000 false + true
diff --git a/integration/test.sh b/integration/test.sh index b2634ecc..4c5db153 100755 --- a/integration/test.sh +++ b/integration/test.sh @@ -24,9 +24,9 @@ start() { testConvergence() { while true ; do sleep 5 - s1comp=$(curl -s "http://localhost:8082/rest/connections" | ./json "$id1/Completion") - s2comp=$(curl -s "http://localhost:8083/rest/connections" | ./json "$id2/Completion") - s3comp=$(curl -s "http://localhost:8081/rest/connections" | ./json "$id3/Completion") + s1comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8082/rest/connections" | ./json "$id1/Completion") + s2comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8083/rest/connections" | ./json "$id2/Completion") + s3comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8081/rest/connections" | ./json "$id3/Completion") s1comp=${s1comp:-0} s2comp=${s2comp:-0} s3comp=${s3comp:-0} @@ -117,6 +117,11 @@ for i in 1 2 3 12-1 12-2 23-2 23-3; do touch "empty-$i" echo " $i: large file" dd if=/dev/urandom of=large-$i bs=1024k count=55 2>/dev/null + echo " $i: weird encodings" + echo somedata > "$(echo -e utf8-nfc-\\xc3\\xad)-$i" + echo somedata > "$(echo -e utf8-nfd-i\\xcc\\x81)-$i" + echo somedata > "$(echo -e cp850-\\xa1)-$i" + touch "empty-$i" popd >/dev/null done @@ -140,5 +145,5 @@ for ((t = 1; t <= $iterations; t++)) ; do done for i in 1 2 3 4 ; do - curl -X POST "http://localhost:808$i/rest/shutdown" + curl -HX-API-Key:abc123 -X POST "http://localhost:808$i/rest/shutdown" done