Skip to content

Commit f263b2d

Browse files
authored
Skip timing dependent test on Windows CI agents (#227)
* Allow more time to expire Windows test events on ci.jenkins.io Diagnostic output inserted into the test shows that ci.jenkins.io Linux agents expire test events from the queue after roughly 3 seconds when the expire time is set to 3 seconds. Those same diagnostic statements show that the test events do not expire on the ci.jenkins.io Windows agents in the first 10 seconds even when the expire time is set to 3 seconds. I assume that is somehow due to differences in the file systems on ci.jenkins.io Windows agents compared to ci.jenkins.io Linux agents. Extend the wait time for ci.jenkins.io Windows tests to expire all the test events. Same problem is not visible on my Windows desktop computer. Only extend the time for Windows tests on CI. * Skip test_autoDeleteOnExpire on ci.jenkins.io Windows * Skip another timing dependent test on Windows CI
1 parent dad27b8 commit f263b2d

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/test/java/org/jenkinsci/plugins/ssegateway/EventHistoryStoreTest.java

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package org.jenkinsci.plugins.ssegateway;
22

3+
import hudson.Functions;
34
import net.sf.json.JSONObject;
45
import org.jenkinsci.plugins.pubsub.EventProps;
56
import org.jenkinsci.plugins.pubsub.SimpleMessage;
67
import org.junit.Assert;
8+
import org.junit.Assume;
79
import org.junit.Before;
810
import org.junit.Test;
911

@@ -44,6 +46,12 @@ public void test_store_count_delete() throws Exception {
4446

4547
@Test
4648
public void test_delete_stale_events() throws Exception {
49+
// SKip the test on Windows ci.jenkins.io agents because it
50+
// requires very different timing constraints. Assumed to be
51+
// an issue with different file system performance in that
52+
// environment. Does not fail tests on a Windows machine used
53+
// for development.
54+
Assume.assumeFalse(Functions.isWindows() && System.getenv("CI") != null);
4755
EventHistoryStore.deleteAllHistory();
4856
Assert.assertEquals(0, EventHistoryStore.getChannelEventCount("job"));
4957

@@ -92,6 +100,12 @@ public void test_get_event() throws Exception {
92100

93101
@Test
94102
public void test_autoDeleteOnExpire() throws Exception {
103+
// SKip the test on Windows ci.jenkins.io agents because it
104+
// requires very different timing constraints. Assumed to be
105+
// an issue with different file system performance in that
106+
// environment. Does not fail tests on a Windows machine used
107+
// for development.
108+
Assume.assumeFalse(Functions.isWindows() && System.getenv("CI") != null);
95109
EventHistoryStore.enableAutoDeleteOnExpire();
96110

97111
// In this test, we go through a few "phases" of adding messages to the
@@ -121,9 +135,11 @@ public void test_autoDeleteOnExpire() throws Exception {
121135

122136
// sleep 'til 4.5 seconds on the clock
123137
waitTimer.waitUntil(4500);
124-
// we are about 4 seconds in now and there are 100 messages
125-
// in the store.
126-
138+
// we are about 4 seconds in now and there should be less than 100 messages
139+
// in the store because the 3 second expiration has completed for the first 50.
140+
// Windows tests on ci.jenkins.io show that the message store is not reduced at this
141+
// point, even though the Linux message store is reduced as expected.
142+
127143
// BATCH 3: Store some messages
128144
// These should expire a little after the 7.5 second mark (4.5 + 3).
129145
storeMessages(50);
@@ -139,7 +155,7 @@ public void test_autoDeleteOnExpire() throws Exception {
139155
Assert.assertTrue("count is " + count, count < 150);
140156

141157
// Now lets wait until after all of the messages would be expired
142-
// The should all expire after about 7.5 seconds (see above), but lets
158+
// They should all expire after about 7.5 seconds (see above), but lets
143159
// wait for a bit after that just to make sure that the test is not flaky.
144160
waitTimer.waitUntil(10000); // 10 seconds
145161
Assert.assertEquals(0, EventHistoryStore.getChannelEventCount("job"));

0 commit comments

Comments
 (0)