Skip to content
Permalink
Browse files

[JENKINS-9741] Fixed to pass file permissions with octals.

  • Loading branch information
ikedam committed Sep 23, 2014
1 parent 417cb13 commit 0424d2871e0a3b70afc1db5435e6d47e030f3e3f
Showing with 24 additions and 24 deletions.
  1. +24 −24 src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
@@ -1423,19 +1423,19 @@ public void testFilePermission() throws Exception {
// creates artifacts manually.
FilePath artifactDir = new FilePath(copieeBuild.getArtifactsDir());
artifactDir.child("artifact.txt").write("some content", Charset.defaultCharset().name());
artifactDir.child("artifact.txt").chmod(644);
artifactDir.child("artifact.txt").chmod(0644);
artifactDir.child("artifactWithExecute.txt").write("some content", Charset.defaultCharset().name());
artifactDir.child("artifactWithExecute.txt").chmod(644);
artifactDir.child("artifactWithExecute.txt").chmod(0644);
artifactDir.child("subdir").mkdirs();
artifactDir.child("subdir/artifactInSubdir.txt").write("some content", Charset.defaultCharset().name());
artifactDir.child("subdir/artifactInSubdir.txt").chmod(644);
artifactDir.child("subdir/artifactInSubdir.txt").chmod(0644);
artifactDir.child("subdir/artifactInSubdir.txt").write("some content", Charset.defaultCharset().name());
artifactDir.child("subdir/artifactInSubdir.txt").chmod(644);
artifactDir.child("subdir/artifactInSubdir.txt").chmod(0644);

assertEquals(0644, artifactDir.child("artifact.txt").mode());
assertEquals(0755, artifactDir.child("artifactWithExecute.txt").mode());
assertEquals(0644, artifactDir.child("subdir/artifactInSubdir.txt").mode());
assertEquals(0755, artifactDir.child("subdir/artifactWithExecuteInSubdir.txt").mode());
assertEquals(0644, artifactDir.child("artifact.txt").mode() & 0777);
assertEquals(0755, artifactDir.child("artifactWithExecute.txt").mode() & 0777);
assertEquals(0644, artifactDir.child("subdir/artifactInSubdir.txt").mode() & 0777);
assertEquals(0755, artifactDir.child("subdir/artifactWithExecuteInSubdir.txt").mode() & 0777);

// on master, without flatten
{
@@ -1458,10 +1458,10 @@ public void testFilePermission() throws Exception {
assertEquals(jenkins, b.getBuiltOn());

FilePath w = b.getWorkspace();
assertEquals(0644, w.child("artifact.txt").mode());
assertEquals(0755, w.child("artifactWithExecute.txt").mode());
assertEquals(0644, w.child("subdir/artifactInSubdir.txt").mode());
assertEquals(0755, w.child("subdir/artifactWithExecuteInSubdir.txt").mode());
assertEquals(0644, w.child("artifact.txt").mode() & 0777);
assertEquals(0755, w.child("artifactWithExecute.txt").mode() & 0777);
assertEquals(0644, w.child("subdir/artifactInSubdir.txt").mode() & 0777);
assertEquals(0755, w.child("subdir/artifactWithExecuteInSubdir.txt").mode() & 0777);
}

// on master, with flatten
@@ -1485,10 +1485,10 @@ public void testFilePermission() throws Exception {
assertEquals(jenkins, b.getBuiltOn());

FilePath w = b.getWorkspace();
assertEquals(0644, w.child("artifact.txt").mode());
assertEquals(0755, w.child("artifactWithExecute.txt").mode());
assertEquals(0644, w.child("artifactInSubdir.txt").mode());
assertEquals(0755, w.child("artifactWithExecuteInSubdir.txt").mode());
assertEquals(0644, w.child("artifact.txt").mode() & 0777);
assertEquals(0755, w.child("artifactWithExecute.txt").mode() & 0777);
assertEquals(0644, w.child("artifactInSubdir.txt").mode() & 0777);
assertEquals(0755, w.child("artifactWithExecuteInSubdir.txt").mode() & 0777);
}

DumbSlave node = createOnlineSlave();
@@ -1514,10 +1514,10 @@ public void testFilePermission() throws Exception {
assertEquals(node, b.getBuiltOn());

FilePath w = b.getWorkspace();
assertEquals(0644, w.child("artifact.txt").mode());
assertEquals(0755, w.child("artifactWithExecute.txt").mode());
assertEquals(0644, w.child("subdir/artifactInSubdir.txt").mode());
assertEquals(0755, w.child("subdir/artifactWithExecuteInSubdir.txt").mode());
assertEquals(0644, w.child("artifact.txt").mode() & 0777);
assertEquals(0755, w.child("artifactWithExecute.txt").mode() & 0777);
assertEquals(0644, w.child("subdir/artifactInSubdir.txt").mode() & 0777);
assertEquals(0755, w.child("subdir/artifactWithExecuteInSubdir.txt").mode() & 0777);
}

// on slave, with flatten
@@ -1541,10 +1541,10 @@ public void testFilePermission() throws Exception {
assertEquals(node, b.getBuiltOn());

FilePath w = b.getWorkspace();
assertEquals(0644, w.child("artifact.txt").mode());
assertEquals(0755, w.child("artifactWithExecute.txt").mode());
assertEquals(0644, w.child("artifactInSubdir.txt").mode());
assertEquals(0755, w.child("artifactWithExecuteInSubdir.txt").mode());
assertEquals(0644, w.child("artifact.txt").mode() & 0777);
assertEquals(0755, w.child("artifactWithExecute.txt").mode() & 0777);
assertEquals(0644, w.child("artifactInSubdir.txt").mode() & 0777);
assertEquals(0755, w.child("artifactWithExecuteInSubdir.txt").mode() & 0777);
}
}

0 comments on commit 0424d28

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