Cloud migration: upload snapshot files using presigned url (#90273)

* Cloud migration: upload snapshot files using presigned url

* log error if index file cannot be closed

* log error if file cannot be closed in uploadUsingPresignedURL
This commit is contained in:
Bruno
2024-07-11 09:32:02 -03:00
committed by GitHub
parent 69c5fa8361
commit 420ff1d07b
11 changed files with 289 additions and 78 deletions
@@ -0,0 +1,36 @@
package gmsclient
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_buildBasePath(t *testing.T) {
t.Parallel()
tests := []struct {
description string
domain string
clusterSlug string
expected string
}{
{
description: "domain starts with http://localhost, should return domain",
domain: "http://localhost:8080",
clusterSlug: "anything",
expected: "http://localhost:8080",
},
{
description: "domain doesn't start with http://localhost, should build a string using the domain and clusterSlug",
domain: "gms-dev",
clusterSlug: "us-east-1",
expected: "https://cms-us-east-1.gms-dev/cloud-migrations",
},
}
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
assert.Equal(t, tt.expected, buildBasePath(tt.domain, tt.clusterSlug))
})
}
}