Skip to content

Commit 2a3df99

Browse files
committed
Picking up jenkinsci/durable-task-plugin#81 we need to set HEARTBEAT_CHECK_INTERVAL to a small value for testing
1 parent 00ff590 commit 2a3df99

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/test/java/org/jenkinsci/plugins/docker/workflow/WithContainerStepTest.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import hudson.util.VersionNumber;
4343
import java.io.IOException;
44+
import java.lang.reflect.Field;
4445
import java.util.Set;
4546
import org.apache.commons.fileupload.FileItem;
4647
import org.apache.commons.io.FileUtils;
@@ -180,8 +181,16 @@ public class WithContainerStepTest {
180181
" sh \"sleep 5; ps -e -o pid,command | egrep '${pwd tmp: true}/durable-.+/script.sh' | fgrep -v grep | sort -n | tr -s ' ' | cut -d ' ' -f2 | xargs kill -9\"\n" +
181182
" }\n" +
182183
"}", true));
183-
WorkflowRun b = story.j.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
184-
story.j.assertLogContains("script returned exit code -1", b);
184+
Field hci = BourneShellScript.class.getDeclaredField("HEARTBEAT_CHECK_INTERVAL");
185+
hci.setAccessible(true);
186+
int orig = (int) hci.get(null);
187+
hci.set(null, 5);
188+
try {
189+
WorkflowRun b = story.j.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
190+
story.j.assertLogContains("script returned exit code -1", b);
191+
} finally {
192+
hci.set(null, orig);
193+
}
185194
}
186195
});
187196
}

0 commit comments

Comments
 (0)