Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit d58d37a

Browse files
committed
Increasing tests timeout value to fix build breaks
1 parent e654aee commit d58d37a

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

test/Microsoft.Framework.Caching.Memory.Tests/GcNotificationTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void CallbackRegisteredAndInvoked()
2121
}, null);
2222

2323
GC.Collect(2, GCCollectionMode.Forced, blocking: true);
24-
Assert.True(callbackInvoked.WaitOne(1000));
24+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)));
2525
}
2626

2727
[Fact]
@@ -41,20 +41,20 @@ public void CallbackInvokedMultipleTimes()
4141
}, null);
4242

4343
GC.Collect(2, GCCollectionMode.Forced, blocking: true);
44-
Assert.True(callbackInvoked.WaitOne(1000));
44+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)));
4545
Assert.Equal(1, callbackCount);
4646

4747
callbackInvoked.Reset();
4848

4949
GC.Collect(2, GCCollectionMode.Forced, blocking: true);
50-
Assert.True(callbackInvoked.WaitOne(1000));
50+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)));
5151
Assert.Equal(2, callbackCount);
5252

5353
callbackInvoked.Reset();
5454

5555
// No callback expected the 3rd time
5656
GC.Collect(2, GCCollectionMode.Forced, blocking: true);
57-
Assert.False(callbackInvoked.WaitOne(1000));
57+
Assert.False(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)));
5858
Assert.Equal(2, callbackCount);
5959
}
6060
}

test/Microsoft.Framework.Caching.Memory.Tests/MemoryCacheSetAndRemoveTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Threading;
56
using Xunit;
67

@@ -120,13 +121,13 @@ public void SetOverwritesAndInvokesCallbacks()
120121
});
121122
result = cache.Set(key, value2, options2);
122123
Assert.Same(value2, result);
123-
Assert.True(callback1Invoked.WaitOne(1000), "Callback1");
124-
Assert.False(callback2Invoked.WaitOne(0), "Callback2");
124+
Assert.True(callback1Invoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback1");
125+
Assert.False(callback2Invoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback2");
125126

126127
result = cache.Get(key);
127128
Assert.Same(value2, result);
128129

129-
Assert.False(callback2Invoked.WaitOne(0), "Callback2");
130+
Assert.False(callback2Invoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback2");
130131
}
131132

132133
[Fact]
@@ -169,7 +170,7 @@ public void RemoveRemovesAndInvokesCallback()
169170
Assert.Same(value, result);
170171

171172
cache.Remove(key);
172-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
173+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
173174

174175
result = cache.Get(key);
175176
Assert.Null(result);
@@ -203,7 +204,7 @@ public void RemoveAndReAddFromCallbackWorks()
203204
Assert.Same(value, result);
204205

205206
cache.Remove(key);
206-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
207+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
207208

208209
result = cache.Get(key);
209210
Assert.Same(obj2, result);

test/Microsoft.Framework.Caching.Memory.Tests/TimeExpirationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void AbsoluteExpirationExpiresInBackground()
9090
clock.Add(TimeSpan.FromMinutes(2));
9191
var ignored = cache.Get("otherKey"); // Background expiration checks are triggered by misc cache activity.
9292

93-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
93+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
9494

9595
found = cache.TryGetValue(key, out result);
9696
Assert.False(found);

test/Microsoft.Framework.Caching.Memory.Tests/TriggeredExpirationTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void FireTriggerRemovesItem()
7878
var found = cache.TryGetValue(key, out value);
7979
Assert.False(found);
8080

81-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
81+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
8282
}
8383

8484
[Fact]
@@ -106,7 +106,7 @@ public void ExpiredLazyTriggerRemovesItemOnNextAccess()
106106
found = cache.TryGetValue(key, out value);
107107
Assert.False(found);
108108

109-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
109+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
110110
}
111111

112112
[Fact]
@@ -132,7 +132,7 @@ public void ExpiredLazyTriggerRemovesItemInBackground()
132132
clock.Add(TimeSpan.FromMinutes(2));
133133
trigger.IsExpired = true;
134134
var ignored = cache.Get("otherKey"); // Background expiration checks are triggered by misc cache activity.
135-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
135+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
136136

137137
found = cache.TryGetValue(key, out value);
138138
Assert.False(found);
@@ -158,7 +158,7 @@ public void RemoveItemDisposesTriggerRegistration()
158158

159159
Assert.NotNull(trigger.Registration);
160160
Assert.True(trigger.Registration.Disposed);
161-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
161+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
162162
}
163163

164164
[Fact]
@@ -182,7 +182,7 @@ public void AddExpiredTriggerPreventsCaching()
182182
Assert.True(trigger.IsExpiredWasCalled);
183183
Assert.False(trigger.ActiveExpirationCallbacksWasCalled);
184184
Assert.Null(trigger.Registration);
185-
Assert.True(callbackInvoked.WaitOne(1000), "Callback");
185+
Assert.True(callbackInvoked.WaitOne(TimeSpan.FromSeconds(30)), "Callback");
186186

187187
result = cache.Get(key);
188188
Assert.Null(result); // It wasn't cached

0 commit comments

Comments
 (0)