1
1
package com .cloudbees .jenkins .support .impl ;
2
2
3
+ import static org .awaitility .Awaitility .await ;
3
4
import static org .hamcrest .MatcherAssert .assertThat ;
4
5
import static org .hamcrest .Matchers .allOf ;
5
6
import static org .hamcrest .Matchers .containsString ;
@@ -80,7 +81,10 @@ public void offlineAgent() throws Exception {
80
81
public void deletedAgent () throws Exception {
81
82
var s = j .createOnlineSlave ();
82
83
s .toComputer ().disconnect (null ).get ();
83
- Thread .sleep (1000 ); // TODO otherwise log is not flushed?
84
+ await ().until (
85
+ () -> SupportTestUtils .invokeComponentToString (
86
+ ExtensionList .lookupSingleton (SlaveLaunchLogs .class )),
87
+ containsString ("Connection terminated" ));
84
88
j .jenkins .removeNode (s );
85
89
assertThat (
86
90
"still includes something" ,
@@ -92,7 +96,10 @@ public void deletedAgent() throws Exception {
92
96
public void multipleLaunchLogs () throws Exception {
93
97
var s = j .createOnlineSlave ();
94
98
s .toComputer ().disconnect (null ).get ();
95
- Thread .sleep (1000 ); // TODO as above
99
+ await ().until (
100
+ () -> SupportTestUtils .invokeComponentToString (
101
+ ExtensionList .lookupSingleton (SlaveLaunchLogs .class )),
102
+ containsString ("Connection terminated" ));
96
103
s .toComputer ().connect (false ).get ();
97
104
assertThat (
98
105
"notes both launch logs" ,
0 commit comments