From e0cd38d93d5ca28207540dbdf70151010ed35c47 Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Tue, 11 May 2021 17:52:02 -0400 Subject: [PATCH] fix(test): update NIOTest to ensure LocalStorageHelper is used (#552) When starting a test, there is a `gs://` uri which is referenced before any unit test level configuration of CloudStorageFileSystemProvider. If NIOTest runs as the first test in the JVM, CloudStorageFileSystemProvider will initialize internally using all default options (which are production endpoints). This fix ensures that before the `gs://` uri is resolved in the NIOTests that LocalStorageHelper is configured rather than defaults. --- .../test/java/com/google/cloud/storage/contrib/nio/NIOTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/NIOTest.java b/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/NIOTest.java index c1e9ba77..fdab9d7b 100644 --- a/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/NIOTest.java +++ b/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/NIOTest.java @@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat; +import com.google.cloud.storage.contrib.nio.testing.LocalStorageHelper; import com.google.cloud.testing.junit4.MultipleAttemptsRule; import java.net.URI; import java.nio.file.Path; @@ -40,6 +41,7 @@ public class NIOTest { @Before public void setUp() { + CloudStorageFileSystemProvider.setStorageOptions(LocalStorageHelper.getOptions()); uriToCloudStorage = URI.create("gs://bucket/file.txt"); }