Skip to content

Commit

Permalink
wait until processor is up before killing agent
Browse files Browse the repository at this point in the history
  • Loading branch information
black-adder committed Apr 13, 2017
1 parent c5accee commit 58b8114
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PROJECT_ROOT=github.com/uber/jaeger
PACKAGES := $(shell glide novendor | grep -v ./thrift-gen/... | grep -v ./examples/...)
#PACKAGES := $(shell glide novendor | grep -v ./thrift-gen/... | grep -v ./examples/...)
PACKAGES := ./cmd/...

# all .go files that don't exist in hidden directories
ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen \
Expand Down
22 changes: 20 additions & 2 deletions cmd/agent/app/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package app
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"testing"
"time"
Expand All @@ -48,7 +49,7 @@ func TestAgentStartStop(t *testing.T) {
Model: jaegerModel,
Protocol: compactProtocol,
Server: ServerConfiguration{
HostPort: "127.0.0.1:0",
HostPort: "127.0.0.1:5776",
},
},
},
Expand Down Expand Up @@ -88,6 +89,23 @@ func TestAgentStartStop(t *testing.T) {
body, err := ioutil.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, "tcollector error: no peers available\n", string(body))
assert.NoError(t, <-ch)

for i := 0; i < 1000; i++ {
destAddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:5776")
t.Log(destAddr.String())
if err == nil {
_, err = net.DialUDP(destAddr.Network(), nil, destAddr)
if err == nil {
break
} else {
t.Log(err.Error())
}
} else {
t.Log(err.Error())
}
time.Sleep(time.Millisecond)
}

agent.Stop()
assert.NoError(t, <-ch)
}

0 comments on commit 58b8114

Please sign in to comment.