@@ -10,7 +10,6 @@ import (
10
10
"testing"
11
11
"time"
12
12
13
- "github.com/zalando/skipper/logging/loggingtest"
14
13
"github.com/zalando/skipper/metrics/metricstest"
15
14
)
16
15
@@ -21,22 +20,13 @@ type testConnection struct {
21
20
22
21
type testListener struct {
23
22
sync.Mutex
24
- closed bool
25
- failNextTemporary bool
26
- fail bool
27
- connsBeforeFail int
28
- addr net.Addr
29
- conns chan * testConnection
23
+ closed bool
24
+ fail bool
25
+ connsBeforeFail int
26
+ addr net.Addr
27
+ conns chan * testConnection
30
28
}
31
29
32
- type testError struct {}
33
-
34
- var errTemporary testError
35
-
36
- func (err testError ) Error () string { return "test error" }
37
- func (err testError ) Timeout () bool { return false }
38
- func (err testError ) Temporary () bool { return true }
39
-
40
30
func (c * testConnection ) Read ([]byte ) (int , error ) { return 0 , nil }
41
31
func (c * testConnection ) Write ([]byte ) (int , error ) { return 0 , nil }
42
32
func (c * testConnection ) LocalAddr () net.Addr { return nil }
@@ -59,10 +49,6 @@ func (c *testConnection) isClosed() bool {
59
49
}
60
50
61
51
func (l * testListener ) Accept () (net.Conn , error ) {
62
- if l .failNextTemporary {
63
- l .failNextTemporary = false
64
- return nil , errTemporary
65
- }
66
52
67
53
if l .fail {
68
54
return nil , errors .New ("listener error" )
@@ -353,28 +339,6 @@ func TestInterface(t *testing.T) {
353
339
}
354
340
})
355
341
356
- t .Run ("wrapped listener returns temporary error, logs and retries" , func (t * testing.T ) {
357
- log := loggingtest .New ()
358
- l , err := listenWith (& testListener {failNextTemporary : true }, Options {
359
- Log : log ,
360
- })
361
-
362
- if err != nil {
363
- t .Fatal (err )
364
- }
365
-
366
- defer l .Close ()
367
- conn , err := l .Accept ()
368
- if err != nil {
369
- t .Fatal (err )
370
- }
371
-
372
- defer conn .Close ()
373
- if err := log .WaitFor (errTemporary .Error (), 120 * time .Millisecond ); err != nil {
374
- t .Error ("failed to log temporary error" )
375
- }
376
- })
377
-
378
342
t .Run ("wrapped permanently fails, returns queued connections and the error" , func (t * testing.T ) {
379
343
m := & metricstest.MockMetrics {}
380
344
l , err := listenWith (& testListener {connsBeforeFail : 3 }, Options {
@@ -982,27 +946,6 @@ func TestTeardown(t *testing.T) {
982
946
}
983
947
984
948
func TestMonitoring (t * testing.T ) {
985
- t .Run ("logs the temporary errors" , func (t * testing.T ) {
986
- log := loggingtest .New ()
987
- l , err := listenWith (& testListener {failNextTemporary : true }, Options {
988
- Log : log ,
989
- })
990
-
991
- if err != nil {
992
- t .Fatal (err )
993
- }
994
-
995
- defer l .Close ()
996
- conn , err := l .Accept ()
997
- if err != nil {
998
- t .Fatal (err )
999
- }
1000
-
1001
- defer conn .Close ()
1002
- if err := log .WaitFor (errTemporary .Error (), 120 * time .Millisecond ); err != nil {
1003
- t .Error ("failed to log temporary error" )
1004
- }
1005
- })
1006
949
1007
950
t .Run ("updates the gauges for the concurrency and the queue size, measures accept latency" , func (t * testing.T ) {
1008
951
m := & metricstest.MockMetrics {}
0 commit comments