@@ -184,14 +184,14 @@ func TestGoCollectorMemStats(t *testing.T) {
184
184
}
185
185
}
186
186
187
- // Speed up the timing to make the tast faster.
188
- c .msMaxWait = time .Millisecond
189
- c .msMaxAge = 10 * time .Millisecond
187
+ // Speed up the timing to make the test faster.
188
+ c .msMaxWait = 5 * time .Millisecond
189
+ c .msMaxAge = 50 * time .Millisecond
190
190
191
191
// Scenario 1: msRead responds slowly, no previous memstats available,
192
192
// msRead is executed anyway.
193
193
c .msRead = func (ms * runtime.MemStats ) {
194
- time .Sleep (3 * time .Millisecond )
194
+ time .Sleep (20 * time .Millisecond )
195
195
ms .Alloc = 1
196
196
}
197
197
checkCollect (1 )
@@ -218,12 +218,12 @@ func TestGoCollectorMemStats(t *testing.T) {
218
218
// Scenario 3: msRead responds slowly, previous memstats available, old
219
219
// value collected.
220
220
c .msRead = func (ms * runtime.MemStats ) {
221
- time .Sleep (3 * time .Millisecond )
221
+ time .Sleep (20 * time .Millisecond )
222
222
ms .Alloc = 3
223
223
}
224
224
checkCollect (2 )
225
225
// After waiting, new value is still set in msLast.
226
- time .Sleep (12 * time .Millisecond )
226
+ time .Sleep (80 * time .Millisecond )
227
227
c .msMtx .Lock ()
228
228
if want , got := uint64 (3 ), c .msLast .Alloc ; want != got {
229
229
t .Errorf ("unexpected of msLast.Alloc, want %d, got %d" , want , got )
@@ -233,7 +233,7 @@ func TestGoCollectorMemStats(t *testing.T) {
233
233
// Scenario 4: msRead responds slowly, previous memstats is too old, new
234
234
// value collected.
235
235
c .msRead = func (ms * runtime.MemStats ) {
236
- time .Sleep (3 * time .Millisecond )
236
+ time .Sleep (20 * time .Millisecond )
237
237
ms .Alloc = 4
238
238
}
239
239
checkCollect (4 )
0 commit comments