[
https://issues.apache.org/jira/browse/HIVE-25330?focusedWorklogId=653940&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-653940
]
ASF GitHub Bot logged work on HIVE-25330:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 22/Sep/21 07:38
Start Date: 22/Sep/21 07:38
Worklog Time Spent: 10m
Work Description: ayushtkn commented on a change in pull request #2516:
URL: https://github.com/apache/hive/pull/2516#discussion_r713671862
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/parse/repl/TestCopyUtils.java
##########
@@ -110,6 +112,100 @@ public void shouldThrowExceptionOnDistcpFailure() throws
Exception {
copyUtils.doCopy(destination, srcPaths);
}
+ @Test
+ public void testFSCallsFailOnParentExceptions() throws Exception {
+ mockStatic(UserGroupInformation.class);
+ mockStatic(ReplChangeManager.class);
+
when(UserGroupInformation.getCurrentUser()).thenReturn(mock(UserGroupInformation.class));
+ HiveConf conf = mock(HiveConf.class);
+ conf.set(HiveConf.ConfVars.REPL_RETRY_INTIAL_DELAY.varname, "1s");
+ FileSystem fs = mock(FileSystem.class);
+ Path source = mock(Path.class);
+ Path destination = mock(Path.class);
+ ContentSummary cs = mock(ContentSummary.class);
+
+ Exception exception = new
org.apache.hadoop.fs.PathPermissionException("Failed");
+ when(ReplChangeManager.checksumFor(source,
fs)).thenThrow(exception).thenReturn("dummy");
+ when(fs.exists(same(source))).thenThrow(exception).thenReturn(true);
+ when(fs.delete(same(source),
anyBoolean())).thenThrow(exception).thenReturn(true);
+ when(fs.mkdirs(same(source))).thenThrow(exception).thenReturn(true);
+ when(fs.rename(same(source),
same(destination))).thenThrow(exception).thenReturn(true);
+
when(fs.getContentSummary(same(source))).thenThrow(exception).thenReturn(cs);
+
+ CopyUtils copyUtils = new
CopyUtils(UserGroupInformation.getCurrentUser().getUserName(), conf, fs);
+ CopyUtils copyUtilsSpy = Mockito.spy(copyUtils);
+ try {
+ copyUtilsSpy.exists(fs, source);
+ } catch (Exception e) {
+ assertEquals(exception.getClass(), e.getCause().getClass());
+ }
+ Mockito.verify(fs, Mockito.times(1)).exists(source);
+ try {
Review comment:
Check if you can use
``LambdaTestUtils.intercept`` instead of try-catch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 653940)
Time Spent: 1h 10m (was: 1h)
> Make FS calls in CopyUtils retryable
> ------------------------------------
>
> Key: HIVE-25330
> URL: https://issues.apache.org/jira/browse/HIVE-25330
> Project: Hive
> Issue Type: Improvement
> Reporter: Pravin Sinha
> Assignee: Haymant Mangla
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)