Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobht committed Jan 15, 2025
1 parent 541eca6 commit aee1adf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions common/rpc/outbounds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ func TestDirectOutbound(t *testing.T) {
assert.NotNil(t, outbounds["cadence-history"].Unary)
}

func TestSingleGRPCOutbound(t *testing.T) {
grpc := &grpc.Transport{}
tchannel := &tchannel.Transport{}

builder := NewSingleGRPCOutboundBuilder("grpc-only-out", "grpc-service-name", "http://example.com:1234")

outBound, err := builder.Build(grpc, tchannel)
assert.NoError(t, err)
assert.Equal(t, "grpc-service-name", outBound.Outbounds["grpc-only-out"].ServiceName)
assert.NotNil(t, outBound.Outbounds["grpc-only-out"].Unary)
}

func TestIsGRPCOutboud(t *testing.T) {
assert.True(t, IsGRPCOutbound(&transport.OutboundConfig{Outbounds: transport.Outbounds{Unary: (&grpc.Transport{}).NewSingleOutbound("localhost:1234")}}))
assert.False(t, IsGRPCOutbound(&transport.OutboundConfig{Outbounds: transport.Outbounds{Unary: (&tchannel.Transport{}).NewSingleOutbound("localhost:1234")}}))
Expand Down
5 changes: 3 additions & 2 deletions common/rpc/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ func TestNewParams(t *testing.T) {
dc := dynamicconfig.NewNopCollection()
makeConfig := func(svc config.Service) *config.Config {
return &config.Config{
PublicClient: config.PublicClient{HostPort: "localhost:9999"},
Services: map[string]config.Service{"frontend": svc}}
PublicClient: config.PublicClient{HostPort: "localhost:9999"},
ShardDistributorClient: config.ShardDistributorClient{HostPort: "localhost:9998"},
Services: map[string]config.Service{"frontend": svc}}
}
logger := testlogger.New(t)
metricsCl := metrics.NewNoopMetricsClient()
Expand Down

0 comments on commit aee1adf

Please sign in to comment.