@@ -662,12 +662,18 @@ private static final class HelloNote extends ConsoleNote<Run<?, ?>> {
662
662
@ Test public void deadStep () throws Exception {
663
663
logging .record (DurableTaskStep .class , Level .INFO ).record (CpsStepContext .class , Level .INFO ).capture (100 );
664
664
WorkflowJob p = j .jenkins .createProject (WorkflowJob .class , "p" );
665
- p .setDefinition (new CpsFlowDefinition ("try {node {isUnix() ? sh('sleep 1000000') : bat('ping -t 127.0.0.1 > nul')}} catch (e) {sleep 1; throw e}" , true ));
665
+ // Test fails on ci.jenkins.io with timeout == 1 on Windows
666
+ int sleepTime = Functions .isWindows () ? 13 : 1 ;
667
+ p .setDefinition (new CpsFlowDefinition ("try {node {isUnix() ? sh('sleep 1000000') : bat('ping -t 127.0.0.1 > nul')}} catch (e) {sleep " + sleepTime + "; throw e}" , true ));
666
668
WorkflowRun b = p .scheduleBuild2 (0 ).waitForStart ();
667
669
j .waitForMessage (Functions .isWindows () ? ">ping" : "+ sleep" , b );
668
670
b .doTerm ();
669
671
j .waitForCompletion (b );
670
672
j .assertBuildStatus (Result .ABORTED , b );
673
+ // Test fails on ci.jenkins.io with timeout == 1 on Windows
674
+ if (Functions .isWindows ()) {
675
+ Thread .sleep (sleepTime * 1000L );
676
+ }
671
677
for (LogRecord record : logging .getRecords ()) {
672
678
assertNull (record .getThrown ());
673
679
}
@@ -701,10 +707,11 @@ private static final class HelloNote extends ConsoleNote<Run<?, ?>> {
701
707
@ Issue ("JENKINS-28822" )
702
708
@ Test public void interruptingAbortsBuild () throws Exception {
703
709
WorkflowJob p = j .jenkins .createProject (WorkflowJob .class , "p" );
710
+ // Test fails unexpectedly on ci.jenkins.io Windows agents with fewer pings
704
711
p .setDefinition (new CpsFlowDefinition ("node {\n " +
705
712
" timeout(time: 1, unit: 'SECONDS') {" +
706
713
(Functions .isWindows ()
707
- ? "bat 'ping -n 6 127.0.0.1 >nul'\n "
714
+ ? "bat 'ping -n 19 127.0.0.1 >nul'\n "
708
715
: "sh 'sleep 5'\n " ) +
709
716
" }" +
710
717
"}" , true ));
@@ -718,10 +725,11 @@ private static final class HelloNote extends ConsoleNote<Run<?, ?>> {
718
725
@ Issue ("JENKINS-28822" )
719
726
@ Test public void interruptingAbortsBuildEvenWithReturnStatus () throws Exception {
720
727
WorkflowJob p = j .jenkins .createProject (WorkflowJob .class , "p" );
728
+ // Test fails unexpectedly on ci.jenkins.io Windows agents with fewer pings
721
729
p .setDefinition (new CpsFlowDefinition ("node() {\n " +
722
730
" timeout(time: 1, unit: 'SECONDS') {\n " +
723
731
(Functions .isWindows ()
724
- ? "bat(returnStatus: true, script: 'ping -n 6 127.0.0.1 >nul')\n "
732
+ ? "bat(returnStatus: true, script: 'ping -n 19 127.0.0.1 >nul')\n "
725
733
: "sh(returnStatus: true, script: 'sleep 5')\n " ) +
726
734
" }\n " +
727
735
"}" , true ));
0 commit comments