Skip to content

Commit

Permalink
Merge pull request #140 from jglick/log-quiet-JENKINS-59083
Browse files Browse the repository at this point in the history
[JENKINS-59083] WorkflowRunTest.logAfterBuildComplete
  • Loading branch information
dwnusbaum authored Sep 3, 2019
2 parents d00a645 + 54a239f commit 49b5268
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<java.level>8</java.level>
<no-test-jar>false</no-test-jar>
<useBeta>true</useBeta>
<workflow-support-plugin.version>3.2</workflow-support-plugin.version>
<workflow-support-plugin.version>3.3</workflow-support-plugin.version>
<scm-api-plugin.version>2.2.6</scm-api-plugin.version>
<git-plugin.version>3.2.0</git-plugin.version>
<jenkins-test-harness.version>2.48</jenkins-test-harness.version>
Expand All @@ -77,7 +77,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.19</version>
<version>2.20</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand All @@ -93,19 +93,19 @@
<!-- Satisfy upper bound dependencies -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.50</version>
<version>1.62</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.63</version>
<version>2.74</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.17</version>
<version>1.20</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import hudson.slaves.NodeProperty;
import hudson.slaves.NodePropertyDescriptor;
import hudson.util.DescribableList;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import jenkins.model.CauseOfInterruption;
import jenkins.model.InterruptedBuildAction;
import jenkins.model.Jenkins;
Expand Down Expand Up @@ -77,6 +79,7 @@

import javax.annotation.Nonnull;
import org.apache.commons.io.IOUtils;
import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction;

public class WorkflowRunTest {

Expand Down Expand Up @@ -459,4 +462,15 @@ private void assertCulprits(WorkflowRun b, String... expectedIds) throws IOExcep
assertEquals(IOUtils.toString(b.getLogInputStream()), FileUtils.readFileToString(b.getLogFile()));
}

@Issue("JENKINS-59083")
@Test public void logAfterBuildComplete() throws Exception {
logging.record(WorkflowRun.class, Level.WARNING).capture(1);
WorkflowJob p = r.createProject(WorkflowJob.class);
p.setDefinition(new CpsFlowDefinition("env.KEY = 'value'", true));
WorkflowRun b = r.buildAndAssertSuccess(p);
assertEquals("value", b.getAction(EnvironmentAction.class).getEnvironment().get("KEY"));
assertFalse(logging.getRecords().stream().findAny().isPresent());
assertFalse(b.isLogUpdated());
}

}

0 comments on commit 49b5268

Please sign in to comment.