From f4e1aa0508cadcf9d4ecc4053d8c1cf6ddd6c31b Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 8 Aug 2017 23:37:47 +0100 Subject: [PATCH] HADOOP-14715. TestWasbRemoteCallHelper failing. Contributed by Esfandiar Manii. --- .../hadoop/fs/azure/TestWasbRemoteCallHelper.java | 7 +++++-- .../hadoop-azure/src/test/resources/azure-test.xml | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestWasbRemoteCallHelper.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestWasbRemoteCallHelper.java index 393dcfdd7c..8aad9e9ecf 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestWasbRemoteCallHelper.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestWasbRemoteCallHelper.java @@ -282,6 +282,8 @@ public void testFailureCodeJSONResponse() throws Throwable { @Test public void testWhenOneInstanceIsDown() throws Throwable { + boolean isAuthorizationCachingEnabled = fs.getConf().getBoolean(CachingAuthorizer.KEY_AUTH_SERVICE_CACHING_ENABLE, false); + // set up mocks HttpClient mockHttpClient = Mockito.mock(HttpClient.class); HttpEntity mockHttpEntity = Mockito.mock(HttpEntity.class); @@ -356,8 +358,9 @@ class HttpGetForServiceLocal extends ArgumentMatcher{ performop(mockHttpClient); - Mockito.verify(mockHttpClient, times(2)).execute(Mockito.argThat(new HttpGetForServiceLocal())); - Mockito.verify(mockHttpClient, times(2)).execute(Mockito.argThat(new HttpGetForService2())); + int expectedNumberOfInvocations = isAuthorizationCachingEnabled ? 1 : 2; + Mockito.verify(mockHttpClient, times(expectedNumberOfInvocations)).execute(Mockito.argThat(new HttpGetForServiceLocal())); + Mockito.verify(mockHttpClient, times(expectedNumberOfInvocations)).execute(Mockito.argThat(new HttpGetForService2())); } @Test diff --git a/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml b/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml index 8c88743c33..8cea256de8 100644 --- a/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml +++ b/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml @@ -29,10 +29,13 @@ --> - - fs.azure.secure.mode - true - + + fs.azure.user.agent.prefix