Skip to content

Commit

Permalink
do not create new files for cloud storage transfer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Dec 30, 2024
1 parent 334843c commit 7e8013b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions storage/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import (

func TestSnapshotS3Upload(test *testing.T) {
// test this fails at s3upload
fooFile, err := os.Create("./foo")
fooFile, err := os.Open("../.gitignore")
if err != nil {
test.Error("test short-circuited because file could not be created and opened")
test.Error("test short-circuited because file could not be opened")
}
defer fooFile.Close()
defer os.Remove("./foo")

if err := snapshotS3Upload(util.Container, fooFile, "prefix-foo"); err == nil || !strings.Contains(err.Error(), "get credentials: failed to refresh cached credentials") {
if err := snapshotS3Upload(util.Container, fooFile, ""); err == nil || !strings.Contains(err.Error(), "get credentials: failed to refresh cached credentials") {
test.Errorf("expected error (contains): get credentials: failed to refresh cached credentials, actual: %v", err)
}
}
7 changes: 3 additions & 4 deletions storage/gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (

func TestSnapshotCSUpload(test *testing.T) {
// test this fails at upload transfer
fooFile, err := os.Create("./foo")
fooFile, err := os.Open("../.gitignore")
if err != nil {
test.Error("test short-circuited because file could not be created and opened")
test.Error("test short-circuited because file could not be opened")
}
defer fooFile.Close()
defer os.Remove("./foo")

if err := snapshotCSUpload(util.Container, fooFile, "prefix-foo"); err == nil || err.Error() != "dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information" {
if err := snapshotCSUpload(util.Container, fooFile, ""); err == nil || err.Error() != "dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information" {
test.Errorf("expected error: dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information, actual: %v", err)
}
}

0 comments on commit 7e8013b

Please sign in to comment.