Skip to content

Commit 51c6171

Browse files
committed
Added tests
1 parent bfb603b commit 51c6171

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

common/rpc/outbounds_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@ func TestDirectOutbound(t *testing.T) {
180180
assert.NotNil(t, outbounds["cadence-history"].Unary)
181181
}
182182

183+
func TestSingleGRPCOutbound(t *testing.T) {
184+
grpc := &grpc.Transport{}
185+
tchannel := &tchannel.Transport{}
186+
187+
builder := NewSingleGRPCOutboundBuilder("grpc-only-out", "grpc-service-name", "http://example.com:1234")
188+
189+
outBound, err := builder.Build(grpc, tchannel)
190+
assert.NoError(t, err)
191+
assert.Equal(t, "grpc-service-name", outBound.Outbounds["grpc-only-out"].ServiceName)
192+
assert.NotNil(t, outBound.Outbounds["grpc-only-out"].Unary)
193+
}
194+
183195
func TestIsGRPCOutboud(t *testing.T) {
184196
assert.True(t, IsGRPCOutbound(&transport.OutboundConfig{Outbounds: transport.Outbounds{Unary: (&grpc.Transport{}).NewSingleOutbound("localhost:1234")}}))
185197
assert.False(t, IsGRPCOutbound(&transport.OutboundConfig{Outbounds: transport.Outbounds{Unary: (&tchannel.Transport{}).NewSingleOutbound("localhost:1234")}}))

common/rpc/params_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ func TestNewParams(t *testing.T) {
3838
dc := dynamicconfig.NewNopCollection()
3939
makeConfig := func(svc config.Service) *config.Config {
4040
return &config.Config{
41-
PublicClient: config.PublicClient{HostPort: "localhost:9999"},
42-
Services: map[string]config.Service{"frontend": svc}}
41+
PublicClient: config.PublicClient{HostPort: "localhost:9999"},
42+
ShardDistributorClient: config.ShardDistributorClient{HostPort: "localhost:9998"},
43+
Services: map[string]config.Service{"frontend": svc}}
4344
}
4445
logger := testlogger.New(t)
4546
metricsCl := metrics.NewNoopMetricsClient()

0 commit comments

Comments
 (0)