2727import hudson .console .AnnotatedLargeText ;
2828import hudson .console .HyperlinkNote ;
2929import hudson .model .TaskListener ;
30+ import hudson .remoting .Channel ;
3031import hudson .remoting .VirtualChannel ;
3132import java .io .EOFException ;
3233import java .io .PrintWriter ;
3738import java .util .Random ;
3839import java .util .concurrent .Callable ;
3940import java .util .function .BiFunction ;
41+ import java .util .logging .Level ;
4042import jenkins .security .MasterToSlaveCallable ;
4143import org .apache .commons .io .FileUtils ;
4244import org .apache .commons .io .output .NullOutputStream ;
4345import org .apache .commons .io .output .NullWriter ;
4446import org .apache .commons .io .output .WriterOutputStream ;
47+ import static org .hamcrest .Matchers .*;
4548import org .jenkinsci .plugins .workflow .cps .CpsFlowDefinition ;
4649import org .jenkinsci .plugins .workflow .graph .FlowNode ;
4750import org .jenkinsci .plugins .workflow .job .WorkflowJob ;
5154import org .junit .ClassRule ;
5255import org .junit .Test ;
5356import org .jvnet .hudson .test .JenkinsRule ;
57+ import org .jvnet .hudson .test .LoggerRule ;
5458
5559/**
5660 * Foundation for compliance tests of {@link LogStorage} implementations.
@@ -63,6 +67,8 @@ public abstract class LogStorageTestBase {
6367
6468 @ ClassRule public static JenkinsRule r = new JenkinsRule ();
6569
70+ @ ClassRule public static LoggerRule logging = new LoggerRule ();
71+
6672 /** Create a new storage implementation, but potentially reusing any data initialized in the last {@link Before} setup. */
6773 protected abstract LogStorage createStorage () throws Exception ;
6874
@@ -142,6 +148,7 @@ protected static void close(TaskListener listener) throws Exception {
142148 }
143149
144150 @ Test public void remoting () throws Exception {
151+ logging .capture (100 ).record (Channel .class , Level .WARNING );
145152 LogStorage ls = createStorage ();
146153 TaskListener overall = ls .overallListener ();
147154 overall .getLogger ().println ("overall from master" );
@@ -157,6 +164,7 @@ protected static void close(TaskListener listener) throws Exception {
157164 stepPos = assertStepLog ("1" , stepPos , "step from agent\n " , true );
158165 assertEquals (overallPos , assertOverallLog (overallPos , "" , true ));
159166 assertEquals (stepPos , assertStepLog ("1" , stepPos , "" , true ));
167+ assertThat (logging .getMessages (), empty ());
160168 }
161169 private static final class RemotePrint extends MasterToSlaveCallable <Void , Exception > {
162170 static {
0 commit comments