diff --git a/s3/upload_test.go b/s3/upload_test.go index 79c5f36..7321825 100644 --- a/s3/upload_test.go +++ b/s3/upload_test.go @@ -34,13 +34,16 @@ import ( func TestUploadFile(t *testing.T) { if os.Getenv("GOTEST_AWS_BUCKET") == "" { - t.Fatal("GOTEST_AWS_BUCKET env variable is not set.") + fmt.Println("Skipping Test") + return } if os.Getenv("AWS_ACCESS_KEY") == "" { - t.Fatal("AWS_ACCESS_KEY env variable is not set.") + fmt.Println("Skipping Test") + return } if os.Getenv("AWS_SECRET_ACCESS_KEY") == "" { - t.Fatal("AWS_SECRET_ACCESS_KEY env variable is not set.") + fmt.Println("Skipping Test") + return } file, err := os.Create("samplefile.txt") if err != nil { @@ -70,26 +73,28 @@ func TestUploadAssets(t *testing.T) { {"upload ios assets", "ios_test", "../parser/testdata/sample.ipa"}, {"upload android assets", "android_test", "../parser/testdata/sample.apk"}, } - for _, tc := range tt { - t.Run(tc.name, func(t *testing.T) { - appInfo, err := ipapk.NewAppParser(tc.file) - if err != nil { - t.Fatal(err) - } - var app parser.MobileApp - app.UploadDate = time.Now().Format(time.RFC1123) - app.AppInfo = appInfo - app.File = tc.file - if err := app.GenerateAssets(); err != nil { - t.Fatal(err) - } - assets, err := UploadAssets(&app, os.Getenv("GOTEST_AWS_BUCKET"), tc.destDir) - if err != nil { - t.Fatal(err) - } - for _, v := range assets { - fmt.Println("s3 url:", v) - } - }) + if os.Getenv("GOTEST_AWS_BUCKET") != "" { + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + appInfo, err := ipapk.NewAppParser(tc.file) + if err != nil { + t.Fatal(err) + } + var app parser.MobileApp + app.UploadDate = time.Now().Format(time.RFC1123) + app.AppInfo = appInfo + app.File = tc.file + if err := app.GenerateAssets(); err != nil { + t.Fatal(err) + } + assets, err := UploadAssets(&app, os.Getenv("GOTEST_AWS_BUCKET"), tc.destDir) + if err != nil { + t.Fatal(err) + } + for _, v := range assets { + fmt.Println("s3 url:", v) + } + }) + } } }