Skip to content
Permalink
Browse files

[JENKINS-18662] Strengthen test to differentiate between explicit and…

… default excludes.
  • Loading branch information...
jglick committed Feb 20, 2018
1 parent fcdad15 commit 4bb93a11cda9a876d7dec2b064d76b556b38a743
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
@@ -539,7 +539,7 @@ public void testCopyFromWorkspace() throws Exception {
assertFile(false, "c.log", b);
}

/** Test copy from workspace containing default ant excludes */
@Issue("JENKINS-14900")
@Test
public void testCopyFromWorkspaceWithDefaultExcludes() throws Exception {
FreeStyleProject other = rule.createFreeStyleProject(), p = rule.createFreeStyleProject();
@@ -553,20 +553,23 @@ public void testCopyFromWorkspaceWithDefaultExcludes() throws Exception {
assertFile(true, ".hg/defaultexclude.txt", b);
}

@Issue("JENKINS-18662")
@Test
public void testExcludes() throws Exception {
FreeStyleProject other = rule.createFreeStyleProject(), p = rule.createFreeStyleProject();
p.getBuildersList().add(CopyArtifactUtil.createCopyArtifact(other.getName(), "", new WorkspaceSelector(),
"**", ".hg/**", "", false, false, true));
"**", "**/b/,foo*", "", false, false, true));
// Run a build that places a file in the workspace, but does not archive anything
other.getBuildersList().add(new ArtifactBuilder());
rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get());
FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get();
rule.assertBuildStatusSuccess(b);
assertFile(true, "subdir/subfoo.txt", b);
assertFile(false, ".hg/defaultexclude.txt", b);
assertFile(false, "deepfoo/a/b/c.log", b);
assertFile(false, "foo.txt", b);
}

@Issue("JENKINS-14900")
@Test
public void testCopyFromWorkspaceWithDefaultExcludesWithFlatten() throws Exception {
FreeStyleProject other = rule.createFreeStyleProject(), p = rule.createFreeStyleProject();
@@ -580,18 +583,19 @@ public void testCopyFromWorkspaceWithDefaultExcludesWithFlatten() throws Excepti
assertFile(true, "defaultexclude.txt", b);
}

@Issue("JENKINS-18662")
@Test
public void testExcludesWithFlatten() throws Exception {
FreeStyleProject other = rule.createFreeStyleProject(), p = rule.createFreeStyleProject();
p.getBuildersList().add(CopyArtifactUtil.createCopyArtifact(other.getName(), "", new WorkspaceSelector(),
"**", ".hg/**", "", true, false, true));
"**", "**/*.log", "", true, false, true));
// Run a build that places a file in the workspace, but does not archive anything
other.getBuildersList().add(new ArtifactBuilder());
rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get());
FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get();
rule.assertBuildStatusSuccess(b);
assertFile(true, "subfoo.txt", b);
assertFile(false, "defaultexclude.txt", b);
assertFile(false, "c.log", b);
}

/** projectName in CopyArtifact build steps should be updated if a job is renamed */

0 comments on commit 4bb93a1

Please sign in to comment.
You can’t perform that action at this time.