Skip to content

Commit

Permalink
Add more testing for yarpc options
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Feb 23, 2017
1 parent ff59b8e commit c5af058
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions modules/rpc/yarpc_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,30 @@ func TestWithInboundMiddleware_OK(t *testing.T) {
assert.Equal(t, 1, len(inboundMiddlewareFromModuleInfo(mc)))
}

func TestWithInboundMiddleware_Multiple(t *testing.T) {
mc, err := service.NewModuleInfo(
service.NopHost(),
"hello",
WithInboundMiddleware(middleware.NopUnaryInbound),
WithInboundMiddleware(middleware.NopUnaryInbound),
)
require.NoError(t, err)
assert.Equal(t, 2, len(inboundMiddlewareFromModuleInfo(mc)))
}

func TestWithOnewayInboundMiddleware_OK(t *testing.T) {
mc, err := service.NewModuleInfo(service.NopHost(), "hello", WithOnewayInboundMiddleware(middleware.NopOnewayInbound))
require.NoError(t, err)
assert.Equal(t, 1, len(onewayInboundMiddlewareFromModuleInfo(mc)))
}

func TestWithOnewayInboundMiddleware_Multiple(t *testing.T) {
mc, err := service.NewModuleInfo(
service.NopHost(),
"hello",
WithOnewayInboundMiddleware(middleware.NopOnewayInbound),
WithOnewayInboundMiddleware(middleware.NopOnewayInbound),
)
require.NoError(t, err)
assert.Equal(t, 2, len(onewayInboundMiddlewareFromModuleInfo(mc)))
}

0 comments on commit c5af058

Please sign in to comment.