@@ -43,7 +43,7 @@ func TestSimpleQueue(t *testing.T) {
43
43
44
44
fakeClock .Step (60 * time .Millisecond )
45
45
46
- if err := waitForAdded (q , 1 ); err != nil {
46
+ if err := waitForAdded (t , q , 1 ); err != nil {
47
47
t .Errorf ("should have added" )
48
48
}
49
49
item , _ := q .Get ()
@@ -88,7 +88,7 @@ func TestAddTwoFireEarly(t *testing.T) {
88
88
89
89
fakeClock .Step (60 * time .Millisecond )
90
90
91
- if err := waitForAdded (q , 1 ); err != nil {
91
+ if err := waitForAdded (t , q , 1 ); err != nil {
92
92
t .Fatalf ("unexpected err: %v" , err )
93
93
}
94
94
item , _ := q .Get ()
@@ -99,7 +99,7 @@ func TestAddTwoFireEarly(t *testing.T) {
99
99
q .AddAfter (third , 2 * time .Second )
100
100
101
101
fakeClock .Step (1 * time .Second )
102
- if err := waitForAdded (q , 1 ); err != nil {
102
+ if err := waitForAdded (t , q , 1 ); err != nil {
103
103
t .Fatalf ("unexpected err: %v" , err )
104
104
}
105
105
item , _ = q .Get ()
@@ -108,7 +108,7 @@ func TestAddTwoFireEarly(t *testing.T) {
108
108
}
109
109
110
110
fakeClock .Step (2 * time .Second )
111
- if err := waitForAdded (q , 1 ); err != nil {
111
+ if err := waitForAdded (t , q , 1 ); err != nil {
112
112
t .Fatalf ("unexpected err: %v" , err )
113
113
}
114
114
item , _ = q .Get ()
@@ -139,7 +139,7 @@ func TestCopyShifting(t *testing.T) {
139
139
140
140
fakeClock .Step (2 * time .Second )
141
141
142
- if err := waitForAdded (q , 3 ); err != nil {
142
+ if err := waitForAdded (t , q , 3 ); err != nil {
143
143
t .Fatalf ("unexpected err: %v" , err )
144
144
}
145
145
actualFirst , _ := q .Get ()
@@ -156,14 +156,19 @@ func TestCopyShifting(t *testing.T) {
156
156
}
157
157
}
158
158
159
- func waitForAdded (q DelayingInterface , depth int ) error {
160
- return wait .Poll (1 * time .Millisecond , 10 * time .Second , func () (done bool , err error ) {
159
+ func waitForAdded (t * testing. T , q DelayingInterface , depth int ) error {
160
+ err := wait .Poll (1 * time .Millisecond , 20 * time .Second , func () (done bool , err error ) {
161
161
if q .Len () == depth {
162
162
return true , nil
163
163
}
164
164
165
165
return false , nil
166
166
})
167
+
168
+ if err != nil {
169
+ t .Logf ("failed: len=%v, everything=%#v" , q .Len (), q )
170
+ }
171
+ return err
167
172
}
168
173
169
174
func waitForWaitingQueueToFill (q DelayingInterface ) error {
0 commit comments