Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-30735] Expand environment variabes in file pattern.
  • Loading branch information
uhafner committed May 25, 2016
1 parent 11b0e68 commit 8a41d9c
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/test/java/plugins/CheckStylePluginTest.java
Expand Up @@ -12,6 +12,7 @@
import org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleMavenSettings;
import org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStylePortlet;
import org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView;
import org.jenkinsci.test.acceptance.plugins.envinject.EnvInjectConfig;
import org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet;
import org.jenkinsci.test.acceptance.plugins.parameterized_trigger.BuildTriggerConfig;
import org.jenkinsci.test.acceptance.plugins.parameterized_trigger.TriggerCallBuildStep;
Expand All @@ -22,7 +23,6 @@
import org.jenkinsci.test.acceptance.po.ListView;
import org.jenkinsci.test.acceptance.po.Node;
import org.jenkinsci.test.acceptance.po.PageObject;
import org.junit.Assume;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.jvnet.hudson.test.Issue;
Expand All @@ -32,8 +32,7 @@
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
import static org.jenkinsci.test.acceptance.Matchers.*;

import static org.junit.Assume.assumeTrue;
import static org.junit.Assume.*;

/**
* Acceptance tests for the CheckStyle plugin.
Expand Down Expand Up @@ -76,6 +75,32 @@ protected int getNumberOfWarnings() {
return TOTAL_NUMBER_OF_WARNINGS;
}

/**
* Verifies that environment variables are expanded in the file name pattern.
*/
@Test @Issue("JENKINS-30735") @WithPlugins("envinject")
public void should_resolve_environment_variables() {
FreeStyleJob job = createFreeStyleJob(new AnalysisConfigurator<CheckStyleFreestyleSettings>() {
@Override
public void configure(CheckStyleFreestyleSettings settings) {
settings.pattern.set("checkstyle${ENV_DASH}result.xml");
}
});

job.configure();
new EnvInjectConfig.Environment(job).properties.sendKeys("ENV_DASH=-");
job.save();

Build build = buildSuccessfulJob(job);
assertThatCheckStyleResultExists(job, build);

CheckStyleAction action = new CheckStyleAction(job);
assertThatWarningsCountInSummaryIs(action, TOTAL_NUMBER_OF_WARNINGS);
assertThatNewWarningsCountInSummaryIs(action, TOTAL_NUMBER_OF_WARNINGS);

assertThat(build.getConsole(), containsString("[CHECKSTYLE] Finding all files that match the pattern checkstyle-result.xml"));
}

@Test @WithPlugins("parameterized-trigger") @Issue("JENKINS-33162")
public void should_return_from_triggered_subjob() {
FreeStyleJob checkstyleJob = createFreeStyleJob(new AnalysisConfigurator<CheckStyleFreestyleSettings>() {
Expand Down

0 comments on commit 8a41d9c

Please sign in to comment.