Skip to content

Commit

Permalink
Code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantv committed Sep 21, 2016
1 parent 02a1104 commit faa22fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
5 changes: 0 additions & 5 deletions testutils/mockhyperbahn/hyperbahn.go
Expand Up @@ -128,11 +128,6 @@ func (h *Mock) Channel() *tchannel.Channel {
return h.ch
}

// getSC returns the isolated subchannel for the service.
func (h *Mock) getSC(svc string) *tchannel.SubChannel {
return h.ch.GetSubChannel(svc, tchannel.Isolated)
}

func (h *Mock) adHandler(ctx json.Context, req *hyperbahn.AdRequest) (*hyperbahn.AdResponse, error) {
callerHostPort := tchannel.CurrentCall(ctx).RemotePeer().HostPort
h.Lock()
Expand Down
11 changes: 5 additions & 6 deletions testutils/mockhyperbahn/hyperbahn_test.go
Expand Up @@ -24,7 +24,6 @@ import (
"testing"
"time"

"github.com/uber-go/atomic"
"github.com/uber/tchannel-go"
"github.com/uber/tchannel-go/hyperbahn"
"github.com/uber/tchannel-go/raw"
Expand All @@ -33,6 +32,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/uber-go/atomic"
)

var config = struct {
Expand Down Expand Up @@ -152,12 +152,11 @@ func TestMockIgnoresDown(t *testing.T) {
moe2.Close()

// Wait for the mock HB to have 0 connections to moe
for start := time.Now(); time.Since(start) < time.Second; time.Sleep(time.Millisecond) {
ok := testutils.WaitFor(time.Second, func() bool {
in, out := mockHB.Channel().Peers().GetOrAdd(moe2.PeerInfo().HostPort).NumConnections()
if in+out == 0 {
break
}
}
return in+out == 0
})
require.True(t, ok, "Failed waiting for mock HB to have 0 connections")

// Make sure that all calls succeed (they should all go to moe2)
moe1Called.Store(false)
Expand Down

0 comments on commit faa22fc

Please sign in to comment.