Skip to content

Commit

Permalink
Revert "Better log output to console (#17)"
Browse files Browse the repository at this point in the history
This reverts commit 16a05c9.
  • Loading branch information
basil committed Jul 4, 2018
1 parent 16a05c9 commit 7401d9d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ private void findText(Run<?, ?> run, FilePath workspace, TaskListener listener)
boolean foundText = false;

if (alsoCheckConsoleOutput) {
logger.println("Looking for pattern " + "'" + regexp + "'" + " in the console output");
logger.println("Checking console output");
foundText |=
checkFile(run.getLogFile(), compilePattern(logger, regexp), logger, true);
} else {
// printing this when checking console output will cause the plugin
// to find this line, which would be pointless.
// doing this only when fileSet!=null to avoid
logger.println("Looking for pattern " + "'" + regexp + "'" + " in the file " + "'" + build.getLogFile() + "'");
logger.println("Checking " + regexp);
}

final RemoteOutputStream ros = new RemoteOutputStream(logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void failureIfFoundInFileOnAgent() throws Exception {
agent.getNodeName(), agent.getNodeName())));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains("Checking foobar", build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -79,7 +79,7 @@ public void failureIfFoundInConsoleOnAgent() throws Exception {
agent.getNodeName(), agent.getNodeName())));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + ECHO_UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void successIfFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.SUCCESS, build);
}
Expand All @@ -66,7 +66,7 @@ public void failureIfFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -85,7 +85,7 @@ public void unstableIfFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.UNSTABLE, build);
}
Expand All @@ -98,7 +98,7 @@ public void notFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains("Checking console output", build);
rule.assertBuildStatus(Result.SUCCESS, build);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void successIfFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt', succeedIfFound: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains("Checking foobar", build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.SUCCESS, build);
}
Expand All @@ -72,7 +72,7 @@ public void failureIfFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt'}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains("Checking foobar", build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -86,7 +86,7 @@ public void unstableIfFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt', unstableIfFound: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains("Checking foobar", build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.UNSTABLE, build);
}
Expand Down Expand Up @@ -114,7 +114,7 @@ public void notFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt'}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains("Checking foobar", build);
rule.assertBuildStatus(Result.SUCCESS, build);
}

Expand All @@ -127,7 +127,7 @@ public void successIfFoundInConsole() throws Exception {
+ "node {findText regexp: 'foobar', succeedIfFound: true, alsoCheckConsoleOutput: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.SUCCESS, build);
}
Expand All @@ -141,7 +141,7 @@ public void failureIfFoundInConsole() throws Exception {
+ "node {findText regexp: 'foobar', alsoCheckConsoleOutput: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -155,7 +155,7 @@ public void unstableIfFoundInConsole() throws Exception {
+ "node {findText regexp: 'foobar', unstableIfFound: true, alsoCheckConsoleOutput: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the console output", build);
rule.assertLogContains("Checking console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.UNSTABLE, build);
}
Expand All @@ -182,7 +182,7 @@ public void notFoundInConsole() throws Exception {
"node {findText regexp: 'foobar', alsoCheckConsoleOutput: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the console output", build);
rule.assertLogContains("Checking console output", build);
rule.assertBuildStatus(Result.SUCCESS, build);
}
}

0 comments on commit 7401d9d

Please sign in to comment.