(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestRegisterSessionRateLimit(t *testing.T) { |
| 105 | log := zerolog.Nop() |
| 106 | originDialerService := ingress.NewOriginDialer(ingress.OriginConfig{ |
| 107 | DefaultDialer: testDefaultDialer, |
| 108 | TCPWriteTimeout: 0, |
| 109 | }, &log) |
| 110 | ctrl := gomock.NewController(t) |
| 111 | |
| 112 | flowLimiterMock := mocks.NewMockLimiter(ctrl) |
| 113 | |
| 114 | flowLimiterMock.EXPECT().Acquire("udp").Return(cfdflow.ErrTooManyActiveFlows) |
| 115 | flowLimiterMock.EXPECT().Release().Times(0) |
| 116 | |
| 117 | manager := v3.NewSessionManager(&noopMetrics{}, &log, originDialerService, flowLimiterMock) |
| 118 | |
| 119 | request := v3.UDPSessionRegistrationDatagram{ |
| 120 | RequestID: testRequestID, |
| 121 | Dest: netip.MustParseAddrPort("127.0.0.1:5000"), |
| 122 | Traced: false, |
| 123 | IdleDurationHint: 5 * time.Second, |
| 124 | Payload: nil, |
| 125 | } |
| 126 | _, err := manager.RegisterSession(&request, &noopEyeball{}) |
| 127 | require.ErrorIs(t, err, v3.ErrSessionRegistrationRateLimited) |
| 128 | } |
nothing calls this directly
no test coverage detected