Set environment variables once
@@ -26,14 +26,15 @@ func Test_GCSStorage_StoreSnapshot(t *testing.T) {
testdataMainDir := "./testData"
testDir := makeTestDir(t, testdataMainDir)
defer removeDir(t, testdataMainDir)
- t.Run("store snapshot in gcs", func(t *testing.T) {
- snapshot := createSnapshotInstance(t, testDir)
- ctxSnapshot := context.Background()
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", "")
os.Setenv("GOOGLE_CLOUD_PROJECT", "project-id")
os.Setenv("STORAGE_EMULATOR_HOST", os.Getenv(gcsEndpoint))
+ t.Run("store snapshot in gcs", func(t *testing.T) {
+ snapshot := createSnapshotInstance(t, testDir)
+ ctxSnapshot := context.Background()
+
gcsConfig := gcs.NewConfig("")
path, _ := os.Getwd()
@@ -47,10 +48,6 @@ func Test_GCSStorage_StoreSnapshot(t *testing.T) {
t.Run("restore snapshot in gcs", func(t *testing.T) {
ctxSnapshot := context.Background()
- os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", "")
- os.Setenv("GOOGLE_CLOUD_PROJECT", "project-id")
- os.Setenv("STORAGE_EMULATOR_HOST", os.Getenv(gcsEndpoint))
-
gcsConfig := gcs.NewConfig("")
gcs, err := gcs.New(context.Background(), gcsConfig)
require.Nil(t, err)
