Skip to content

Commit

Permalink
Updates based on comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Sullivan committed Mar 2, 2017
1 parent 3f8a0d8 commit efbd423
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions server/sublist.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ func (s *Sublist) Stats() *SublistStats {
st := &SublistStats{}
st.NumSubs = s.count
st.NumCache = uint32(len(s.cache))
st.NumInserts = atomic.LoadUint64(&s.inserts)
st.NumRemoves = atomic.LoadUint64(&s.removes)
st.NumInserts = s.inserts
st.NumRemoves = s.removes
st.NumMatches = atomic.LoadUint64(&s.matches)
if st.NumMatches > 0 {
st.CacheHitRate = float64(atomic.LoadUint64(&s.cacheHits)) / float64(st.NumMatches)
Expand Down
9 changes: 4 additions & 5 deletions test/monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func runMonitorServer() *server.Server {
}

// Runs a clustered pair of monitor servers for testing the /routez endpoint
func runMonitorServerClusteredPair() (*server.Server, *server.Server) {
func runMonitorServerClusteredPair(t *testing.T) (*server.Server, *server.Server) {
resetPreviousHTTPConnections()
opts := DefaultTestOptions
opts.Port = CLIENT_PORT
Expand All @@ -56,6 +56,8 @@ func runMonitorServerClusteredPair() (*server.Server, *server.Server) {

s2 := RunServer(&opts2)

checkClusterFormed(t, s1, s2)

return s1, s2
}

Expand Down Expand Up @@ -139,13 +141,10 @@ func testEndpointDataRace(endpoint string, t *testing.T) {

func TestEndpointDataRaces(t *testing.T) {
// setup a small cluster to test /routez
s1, s2 := runMonitorServerClusteredPair()
s1, s2 := runMonitorServerClusteredPair(t)
defer s1.Shutdown()
defer s2.Shutdown()

// give some time for a route to form
time.Sleep(2 * time.Second)

// test all of our endpoints
testEndpointDataRace("varz", t)
testEndpointDataRace("connz", t)
Expand Down

0 comments on commit efbd423

Please sign in to comment.