Skip to content

Commit b546a01

Browse files
committed
log it another way, add start and end of the log
1 parent 5fd9a6d commit b546a01

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/test/java/org/jenkinsci/plugins/workflow/cps/FlowDurabilityTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,24 @@ public void evaluate() throws Throwable {
589589
story.addStep(new Statement() {
590590
@Override
591591
public void evaluate() throws Throwable {
592+
if (logging.getMessages().stream().anyMatch(msg -> msg.contains("could not load") && msg.contains("jobs/durableAgainstClean/builds/1"))){
593+
log.warning("Found a message in LoggerRule - trying to log the build.xml");
594+
File buildXml = new File (story.j.jenkins.getRootDir() + "/jobs/durableAgainstClean/builds/1/build.xml");
595+
BufferedReader in = new BufferedReader(new FileReader(buildXml));
596+
String line = in.readLine();
597+
while(line != null)
598+
{
599+
log.warning(line);
600+
line = in.readLine();
601+
}
602+
in.close();
603+
log.warning("Done logging the build.xml");
604+
}
592605
WorkflowRun run = story.j.jenkins.getItemByFullName("durableAgainstClean", WorkflowJob.class).getLastBuild();
593606
try {
594607
verifyFailedCleanly(story.j.jenkins, run);
595608
} catch (NullPointerException e) {
609+
log.warning("Caught NPE - trying to log the build.xml");
596610
File buildXml = new File (story.j.jenkins.getRootDir() + "/jobs/durableAgainstClean/builds/1/build.xml");
597611
BufferedReader in = new BufferedReader(new FileReader(buildXml));
598612
String line = in.readLine();
@@ -602,6 +616,7 @@ public void evaluate() throws Throwable {
602616
line = in.readLine();
603617
}
604618
in.close();
619+
log.warning("Done logging the build.xml");
605620
throw e;
606621
}
607622
story.j.assertLogContains(logStart[0], run);

0 commit comments

Comments
 (0)