Sfoglia il codice sorgente

Integration tests should use v4 localhost

Jakob Borg 11 anni fa
parent
commit
1a6ac4aeb1

+ 1 - 1
integration/common_test.go

@@ -59,7 +59,7 @@ func (p *syncthingProcess) stop() {
 }
 
 func (p *syncthingProcess) peerCompletion() (map[string]int, error) {
-	resp, err := http.Get(fmt.Sprintf("http://localhost:%d/rest/debug/peerCompletion", p.port))
+	resp, err := http.Get(fmt.Sprintf("http://127.0.0.1:%d/rest/debug/peerCompletion", p.port))
 	if err != nil {
 		return nil, err
 	}

+ 5 - 5
integration/test-delupd.sh

@@ -23,7 +23,7 @@ start() {
 
 stop() {
 	for i in 1 2 3 ; do
-		curl -HX-API-Key:abc123 -X POST "http://localhost:808$i/rest/shutdown"
+		curl -HX-API-Key:abc123 -X POST "http://127.0.0.1:808$i/rest/shutdown"
 	done
 	exit $1
 }
@@ -31,9 +31,9 @@ stop() {
 testConvergence() {
 	while true ; do
 		sleep 5
-		s1comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8082/rest/debug/peerCompletion" | ./json "$id1")
-		s2comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8083/rest/debug/peerCompletion" | ./json "$id2")
-		s3comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8081/rest/debug/peerCompletion" | ./json "$id3")
+		s1comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8082/rest/debug/peerCompletion" | ./json "$id1")
+		s2comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8083/rest/debug/peerCompletion" | ./json "$id2")
+		s3comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8081/rest/debug/peerCompletion" | ./json "$id3")
 		s1comp=${s1comp:-0}
 		s2comp=${s2comp:-0}
 		s3comp=${s3comp:-0}
@@ -119,7 +119,7 @@ alterFiles() {
 	pkill -CONT syncthing
 
 	echo "Restarting instance 2"
-	curl -HX-API-Key:abc123 -X POST "http://localhost:8082/rest/restart"
+	curl -HX-API-Key:abc123 -X POST "http://127.0.0.1:8082/rest/restart"
 }
 
 rm -rf h?/*.idx.gz h?/index

+ 3 - 3
integration/test-folders.sh

@@ -21,7 +21,7 @@ start() {
 stop() {
 	echo "Stopping..."
 	for i in 1 2 ; do
-		curl -HX-API-Key:abc123 -X POST "http://localhost:808$i/rest/shutdown"
+		curl -HX-API-Key:abc123 -X POST "http://127.0.0.1:808$i/rest/shutdown"
 	done
 }
 
@@ -46,8 +46,8 @@ setup() {
 testConvergence() {
 	while true ; do
 		sleep 5
-		s1comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8082/rest/debug/peerCompletion" | ./json "$id1")
-		s2comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8081/rest/debug/peerCompletion" | ./json "$id2")
+		s1comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8082/rest/debug/peerCompletion" | ./json "$id1")
+		s2comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8081/rest/debug/peerCompletion" | ./json "$id2")
 		s1comp=${s1comp:-0}
 		s2comp=${s2comp:-0}
 		tot=$(($s1comp + $s2comp))

+ 8 - 8
integration/test-http.sh

@@ -10,8 +10,8 @@ id3=373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU
 
 stop() {
 	echo Stopping
-	curl -s -o/dev/null -HX-API-Key:abc123 -X POST http://localhost:8081/rest/shutdown
-	curl -s -o/dev/null -HX-API-Key:abc123 -X POST http://localhost:8082/rest/shutdown
+	curl -s -o/dev/null -HX-API-Key:abc123 -X POST http://127.0.0.1:8081/rest/shutdown
+	curl -s -o/dev/null -HX-API-Key:abc123 -X POST http://127.0.0.1:8082/rest/shutdown
 	exit $1
 }
 
@@ -26,14 +26,14 @@ syncthing -home h2 > 2.out 2>&1 &
 sleep 1
 
 echo Fetching CSRF tokens
-curl -s -o /dev/null http://testuser:testpass@localhost:8081/index.html
-curl -s -o /dev/null http://localhost:8082/index.html
+curl -s -o /dev/null http://testuser:testpass@127.0.0.1:8081/index.html
+curl -s -o /dev/null http://127.0.0.1:8082/index.html
 sleep 1
 
 echo Testing
-./http -target localhost:8081 -user testuser -pass testpass -csrf h1/csrftokens.txt || stop 1
-./http -target localhost:8081 -api abc123 || stop 1
-./http -target localhost:8082 -csrf h2/csrftokens.txt || stop 1
-./http -target localhost:8082 -api abc123 || stop 1
+./http -target 127.0.0.1:8081 -user testuser -pass testpass -csrf h1/csrftokens.txt || stop 1
+./http -target 127.0.0.1:8081 -api abc123 || stop 1
+./http -target 127.0.0.1:8082 -csrf h2/csrftokens.txt || stop 1
+./http -target 127.0.0.1:8082 -api abc123 || stop 1
 
 stop 0

+ 4 - 4
integration/test-merge.sh

@@ -23,7 +23,7 @@ start() {
 
 stop() {
 	for i in 1 2 3 4 ; do
-		curl -HX-API-Key:abc123 -X POST "http://localhost:808$i/rest/shutdown"
+		curl -HX-API-Key:abc123 -X POST "http://127.0.0.1:808$i/rest/shutdown"
 	done
 	exit $1
 }
@@ -40,9 +40,9 @@ clean() {
 testConvergence() {
 	while true ; do
 		sleep 5
-		s1comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8082/rest/debug/peerCompletion" | ./json "$id1")
-		s2comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8083/rest/debug/peerCompletion" | ./json "$id2")
-		s3comp=$(curl -HX-API-Key:abc123 -s "http://localhost:8081/rest/debug/peerCompletion" | ./json "$id3")
+		s1comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8082/rest/debug/peerCompletion" | ./json "$id1")
+		s2comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8083/rest/debug/peerCompletion" | ./json "$id2")
+		s3comp=$(curl -HX-API-Key:abc123 -s "http://127.0.0.1:8081/rest/debug/peerCompletion" | ./json "$id3")
 		s1comp=${s1comp:-0}
 		s2comp=${s2comp:-0}
 		s3comp=${s3comp:-0}