anujmodi2021 commented on code in PR #7364: URL: https://github.com/apache/hadoop/pull/7364#discussion_r1967110580
########## hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java: ########## @@ -733,4 +737,53 @@ protected void checkFuturesForExceptions(List<Future<?>> futures, int exceptionV } assertEquals(exceptionCaught, exceptionVal); } + + /** + * Assumes that recovery through client transaction ID is enabled. + * Namespace is enabled for the given AzureBlobFileSystem. + * Service type is DFS. + * Assumes that the client transaction ID is enabled in the configuration. + * + * @param fs the AzureBlobFileSystem instance to check + * @throws AzureBlobFileSystemException in case of an error + */ + protected void assumeRecoveryThroughClientTransactionID( + AzureBlobFileSystem fs, boolean isCreate) + throws AzureBlobFileSystemException { + // Assumes that recovery through client transaction ID is enabled. + Assume.assumeTrue(getConfiguration().getIsClientTransactionIdEnabled()); + // Assumes that service type is DFS. + assumeDfsServiceType(); + // Assumes that namespace is enabled for the given AzureBlobFileSystem. + Assume.assumeTrue( + fs.getIsNamespaceEnabled(getTestTracingContext(fs, true))); + if (isCreate) { + // Assume that create client is DFS client. + Assume.assumeTrue( + AbfsServiceType.DFS.equals( + fs.getAbfsStore().getAbfsConfiguration().getIngressServiceType())); + // Assume that append blob is not enabled in DFS client. + Assume.assumeFalse(isAppendBlobEnabled()); + } + } + + /** + * Mocks the behavior of adding a client transaction ID to the request headers + * for the given AzureBlobFileSystem. This method generates a random transaction ID + * and adds it to the headers of the {@link AbfsDfsClient}. + * + * @param abfsDfsClient The {@link AbfsDfsClient} mocked AbfsDfsClient. + * @param clientTransactionId An array to hold the generated transaction ID. + */ + protected void mockAddClientTransactionIdToHeader(AbfsDfsClient abfsDfsClient, + String[] clientTransactionId) { + Mockito.doAnswer(addClientTransactionId -> { + clientTransactionId[0] = UUID.randomUUID().toString(); + List<AbfsHttpHeader> headers = addClientTransactionId.getArgument(0); + headers.add( + new AbfsHttpHeader(X_MS_CLIENT_TRANSACTION_ID, + clientTransactionId[0])); + return clientTransactionId[0]; + }).when(abfsDfsClient).addClientTransactionIdToHeader(Mockito.anyList()); + } } Review Comment: So currently there are no integration tests running for thi feature that means. Can you create a separate work item to make sure integration tests also run with this change post server deoployements completes?? -- 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: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org