From 08a17ec376429e19096a7e2c08a9ec5177fb29e0 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 29 May 2015 14:17:03 +0100 Subject: [PATCH] no need for sleeps to wait for http server Since we start the tcp listener in the main thread now, connections can be made immediately; they will just queue up until there is a handler. --- ipam/http_test.go | 4 ---- nameserver/http_test.go | 3 --- 2 files changed, 7 deletions(-) diff --git a/ipam/http_test.go b/ipam/http_test.go index 911f3ef0..b8c972f0 100644 --- a/ipam/http_test.go +++ b/ipam/http_test.go @@ -68,8 +68,6 @@ func TestHttp(t *testing.T) { alloc := makeAllocatorWithMockGossip(t, "08:00:27:01:c3:9a", testCIDR1, 1) port := listenHTTP(alloc) - time.Sleep(100 * time.Millisecond) // Allow for http server to get going - alloc.claimRingForTesting() // Ask the http server for a new address cidr1 := HTTPPost(t, allocURL(port, containerID)) @@ -139,8 +137,6 @@ func impTestHTTPCancel(t *testing.T) { alloc.claimRingForTesting() port := listenHTTP(alloc) - time.Sleep(100 * time.Millisecond) // Allow for http server to get going - // Stop the alloc so nothing actually works unpause := alloc.pause() diff --git a/nameserver/http_test.go b/nameserver/http_test.go index 805624c5..44e5bfc0 100644 --- a/nameserver/http_test.go +++ b/nameserver/http_test.go @@ -7,7 +7,6 @@ import ( "net/url" "strings" "testing" - "time" wt "github.com/weaveworks/weave/testing" ) @@ -42,8 +41,6 @@ func TestHttp(t *testing.T) { port := httpListener.Addr().(*net.TCPAddr).Port go ServeHTTP(httpListener, "", nil, testDomain, zone) - time.Sleep(100 * time.Millisecond) // Allow for http server to get going - // Ask the http server to add our test address into the database addrParts := strings.Split(testAddr1, "/") addrURL := fmt.Sprintf("http://localhost:%d/name/%s/%s", port, containerID, addrParts[0])