|
29 | 29 | import org.junit.jupiter.api.Assertions; |
30 | 30 | import org.junit.jupiter.api.BeforeEach; |
31 | 31 | import org.junit.jupiter.api.Test; |
| 32 | +import org.mockito.MockedStatic; |
32 | 33 | import org.mockito.Mockito; |
33 | 34 |
|
34 | 35 | import java.io.File; |
@@ -227,6 +228,19 @@ public void testS3FileSystemCache() throws StarRocksException, IOException { |
227 | 228 |
|
228 | 229 | @Test |
229 | 230 | public void testAzureFileSystemCache() throws StarRocksException, IOException { |
| 231 | + // The cache-key behavior does not require a live Azure client. Constructing the real |
| 232 | + // ABFS/WASB implementations with fake endpoints can block on external network activity, |
| 233 | + // making this unit test hit the suite's five-minute timeout. Return a fresh mock for every |
| 234 | + // actual FileSystem.get() call: cache hits still return the same HdfsFs, while distinct |
| 235 | + // authorities still cause separate calls and therefore receive distinct FileSystem mocks. |
| 236 | + try (MockedStatic<FileSystem> fileSystemMock = Mockito.mockStatic(FileSystem.class)) { |
| 237 | + fileSystemMock.when(() -> FileSystem.get(Mockito.any(), Mockito.any())) |
| 238 | + .thenAnswer(invocation -> Mockito.mock(FileSystem.class)); |
| 239 | + verifyAzureFileSystemCacheKeys(); |
| 240 | + } |
| 241 | + } |
| 242 | + |
| 243 | + private void verifyAzureFileSystemCacheKeys() throws StarRocksException, IOException { |
230 | 244 | // Test ADLS Gen2 schemes (abfs/abfss) with ADLS2 credentials |
231 | 245 | Map<String, String> adlsProperties = new HashMap<>(); |
232 | 246 | adlsProperties.put(CloudConfigurationConstants.AZURE_ADLS2_SHARED_KEY, "c2hhcmVkS2V5"); // base64 encoded |
|
0 commit comments