File tree 2 files changed +14
-6
lines changed
src/test/java/org/jenkinsci/plugins/workflow/support/steps/input
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 52
52
<type >pom</type >
53
53
<scope >import</scope >
54
54
</dependency >
55
+ <dependency >
56
+ <groupId >org.awaitility</groupId >
57
+ <artifactId >awaitility</artifactId >
58
+ <version >4.3.0</version >
59
+ </dependency >
55
60
</dependencies >
56
61
</dependencyManagement >
57
62
<dependencies >
116
121
<artifactId >credentials-binding</artifactId >
117
122
<scope >test</scope >
118
123
</dependency >
124
+ <dependency >
125
+ <groupId >org.awaitility</groupId >
126
+ <artifactId >awaitility</artifactId >
127
+ <scope >test</scope >
128
+ </dependency >
119
129
</dependencies >
120
130
</project >
Original file line number Diff line number Diff line change 36
36
import org .jenkinsci .plugins .workflow .job .WorkflowJob ;
37
37
import org .jenkinsci .plugins .workflow .job .WorkflowRun ;
38
38
import org .jenkinsci .plugins .workflow .support .actions .PauseAction ;
39
+
40
+ import static org .awaitility .Awaitility .await ;
41
+ import static org .hamcrest .Matchers .notNullValue ;
39
42
import static org .junit .Assert .*;
40
43
import org .junit .ClassRule ;
41
44
import org .junit .Rule ;
42
45
import org .junit .Test ;
43
- import org .junit .runners .model .Statement ;
44
46
import org .jvnet .hudson .test .BuildWatcher ;
45
47
import org .jvnet .hudson .test .Issue ;
46
48
import org .jvnet .hudson .test .JenkinsRule ;
@@ -97,11 +99,7 @@ private void sanity(WorkflowRun b) throws Exception {
97
99
WorkflowRun b = j .jenkins .getItemByFullName ("p" , WorkflowJob .class ).getBuildByNumber (1 );
98
100
assertNotNull (b );
99
101
assertTrue (b .isBuilding ());
100
- Executor executor ;
101
- while ((executor = b .getExecutor ()) == null ) {
102
- Thread .sleep (100 ); // probably a race condition: AfterRestartTask could take a moment to be registered
103
- }
104
- assertNotNull (executor );
102
+ Executor executor = await ().until (b ::getExecutor , notNullValue ());
105
103
executor .interrupt ();
106
104
j .assertBuildStatus (Result .ABORTED , j .waitForCompletion (b ));
107
105
sanity (b );
You can’t perform that action at this time.
0 commit comments