anmolanmol1234 commented on code in PR #6022:
URL: https://github.com/apache/hadoop/pull/6022#discussion_r1316949367
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsOutputStream.java:
##########
@@ -148,6 +154,58 @@ public void testAbfsOutputStreamClosingFsBeforeStream()
}
}
+ @Test
+ public void testExpect100ContinueFailureInAppend() throws Exception {
+ Configuration configuration = new Configuration(getRawConfiguration());
+ configuration.set(FS_AZURE_ACCOUNT_IS_EXPECT_HEADER_ENABLED, "true");
+ AzureBlobFileSystem fs = (AzureBlobFileSystem) FileSystem.newInstance(
+ configuration);
+ Path path = new Path("/testFile");
+ AbfsOutputStream os = Mockito.spy(
+ (AbfsOutputStream) fs.create(path).getWrappedStream());
+ AbfsClient spiedClient = Mockito.spy(os.getClient());
+ AbfsHttpOperation[] httpOpForAppendTest = new AbfsHttpOperation[2];
+ readyMocksForAppendTest(httpOpForAppendTest, spiedClient);
+ Mockito.doReturn(spiedClient).when(os).getClient();
+ fs.delete(path, true);
+ os.write(1);
+ LambdaTestUtils.intercept(FileNotFoundException.class, () -> {
+ os.close();
+ });
+ Assertions.assertThat(httpOpForAppendTest[0].getExpect100failureReceived())
+ .isTrue();
+ Mockito.verify(httpOpForAppendTest[0], Mockito.times(0))
+ .processConnHeadersAndInputStreams(Mockito.any(byte[].class),
+ Mockito.anyInt(), Mockito.anyInt());
+
+ Assertions.assertThat(httpOpForAppendTest[1].getExpect100failureReceived())
+ .isFalse();
+ Mockito.verify(httpOpForAppendTest[1], Mockito.times(1))
+ .processConnHeadersAndInputStreams(Mockito.any(byte[].class),
+ Mockito.anyInt(), Mockito.anyInt());
+ }
+
+ private void readyMocksForAppendTest(final AbfsHttpOperation[]
httpOpForAppendTest,
Review Comment:
Name can be changed
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]