This is an automated email from the ASF dual-hosted git repository.

aajisaka pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
     new c40f0f1  MAPREDUCE-7303. Fix TestJobResourceUploader failures after 
HADOOP-16878. Contributed by Peter Bacsko.
c40f0f1 is described below

commit c40f0f1eb34df64449472f698d1d68355f109e9b
Author: Akira Ajisaka <aajis...@apache.org>
AuthorDate: Fri Oct 23 04:34:49 2020 +0900

    MAPREDUCE-7303. Fix TestJobResourceUploader failures after HADOOP-16878. 
Contributed by Peter Bacsko.
    
    (cherry picked from commit 7bc305db5d5a50127dd7780534d6d7d0b7c683d1)
---
 .../org/apache/hadoop/mapreduce/TestJobResourceUploader.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobResourceUploader.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobResourceUploader.java
index bbfe2fb..c49d771 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobResourceUploader.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobResourceUploader.java
@@ -399,6 +399,7 @@ public class TestJobResourceUploader {
       Path expectedRemotePath) throws IOException, URISyntaxException {
     Path dstPath = new Path("hdfs://localhost:1234/home/hadoop/");
     DistributedFileSystem fs = mock(DistributedFileSystem.class);
+    when(fs.makeQualified(any(Path.class))).thenReturn(dstPath);
     // make sure that FileUtils.copy() doesn't try to copy anything
     when(fs.mkdirs(any(Path.class))).thenReturn(false);
     when(fs.getUri()).thenReturn(dstPath.toUri());
@@ -407,6 +408,7 @@ public class TestJobResourceUploader {
     JobConf jConf = new JobConf();
     Path originalPath = spy(path);
     FileSystem localFs = mock(FileSystem.class);
+    when(localFs.makeQualified(any(Path.class))).thenReturn(path);
     FileStatus fileStatus = mock(FileStatus.class);
     when(localFs.getFileStatus(any(Path.class))).thenReturn(fileStatus);
     when(fileStatus.isDirectory()).thenReturn(true);
@@ -420,8 +422,14 @@ public class TestJobResourceUploader {
         originalPath, jConf, (short) 1);
 
     ArgumentCaptor<Path> pathCaptor = ArgumentCaptor.forClass(Path.class);
-    verify(fs).makeQualified(pathCaptor.capture());
-    Assert.assertEquals("Path", expectedRemotePath, pathCaptor.getValue());
+    verify(fs, times(2)).makeQualified(pathCaptor.capture());
+    List<Path> paths = pathCaptor.getAllValues();
+    // first call is invoked on a path which was created by the test,
+    // but the second one is created in copyRemoteFiles()
+    Assert.assertEquals("Expected remote path",
+        expectedRemotePath, paths.get(0));
+    Assert.assertEquals("Expected remote path",
+        expectedRemotePath, paths.get(1));
   }
 
   private void testErasureCodingSetting(boolean defaultBehavior)


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to