Skip to content

Commit

Permalink
fix(test): update NIOTest to ensure LocalStorageHelper is used (#552)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BenWhitehead authored May 11, 2021
1 parent 849c859 commit e0cd38d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +41,7 @@ public class NIOTest {

@Before
public void setUp() {
CloudStorageFileSystemProvider.setStorageOptions(LocalStorageHelper.getOptions());
uriToCloudStorage = URI.create("gs://bucket/file.txt");
}

Expand Down

0 comments on commit e0cd38d

Please sign in to comment.