Skip to content

Commit

Permalink
Update UDP outbound tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronH88 committed Nov 28, 2024
1 parent ad4fa8f commit fdc7e9e
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions pkg/services/udp_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func TestUDPProxyServiceOutbound(t *testing.T) {
var mockNetceptor *mock_services.MockNetcForUDPProxy
var mockNetter *mock_net_interface.MockNetterUDP
var mockPacketCon *mock_netceptor.MockPacketConner
logger := logger.NewReceptorLogger("test")
type testCase struct {
name string
service string
Expand Down Expand Up @@ -131,21 +130,7 @@ func TestUDPProxyServiceOutbound(t *testing.T) {
calls: func() {
mockNetter.EXPECT().ResolveUDPAddr(gomock.Any(), gomock.Any()).Return(nil, nil)
mockNetceptor.EXPECT().ListenPacketAndAdvertise(gomock.Any(), gomock.Any()).Return(mockPacketCon, nil)
mockPacketCon.EXPECT().ReadFrom(gomock.Any()).Return(0, nil, errors.New("Read From error"))
},
},
{
name: "Fail Dial UDP",
calls: func() {
mockNetter.EXPECT().ResolveUDPAddr(gomock.Any(), gomock.Any()).Return(nil, nil)
mockNetceptor.EXPECT().ListenPacketAndAdvertise(gomock.Any(), gomock.Any()).Return(mockPacketCon, nil)
gomock.InOrder(
mockPacketCon.EXPECT().ReadFrom(gomock.Any()).Return(0, netceptor.Addr{}, nil),
mockPacketCon.EXPECT().ReadFrom(gomock.Any()).Return(0, nil, errors.New("Read From error")).AnyTimes(),
)
mockNetceptor.EXPECT().GetLogger().Return(logger).AnyTimes()
mockNetter.EXPECT().DialUDP(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("Dial UDP error"))

mockPacketCon.EXPECT().ReadFrom(gomock.Any()).Return(0, nil, errors.New("Read From error")).AnyTimes()
},
},
}
Expand Down

0 comments on commit fdc7e9e

Please sign in to comment.