Use specified port for http listener

This commit is contained in:
Bryan Boreham committed 2014-10-10 17:36:46 +01:00
1 parent 03cd04249c
commit 50d343e2fb
3 files changed
+9 -9

No files matched your search

+6 -2
View File
@@ -1,6 +1,8 @@
package weavedns
import (
"fmt"
"math/rand"
"net"
"net/http"
"net/url"
@@ -16,11 +18,13 @@ func TestHttp(t *testing.T) {
)
var zone = new(ZoneDb)
go ListenHttp(zone)
port := rand.Intn(10000) + 32768
fmt.Println("Http test on port", port)
go ListenHttp(zone, port)
time.Sleep(100 * time.Millisecond) // Allow for http server to get going
resp, err := http.PostForm("http://localhost:6785/add",
resp, err := http.PostForm(fmt.Sprintf("http://localhost:%d/add", port),
url.Values{"name": {success_test_name}, "ip": {docker_ip}, "weave_cidr": {test_addr1}})
if err != nil {
t.Fatal(err)