CloudMigrations: Query Grafana Migration Status for status while the snapshot is in the cloud (#90314)
* implement querying gms for snapshot status * add some documentation * provide snapshot resources after snapshot is created * add rate limiting to backend * fix compilation error * fix typo * add unit tests * finish merge * lint * swagger gen * more testing * remove duplicate test * address a couple PR comments * update switch statement to a map * add timeouts to gms client through the http client * remove extra whitespace * put method back where it was so the PR is less confusing * fix tests * add todo * fix final unit test
This commit is contained in:
@@ -3,12 +3,31 @@ package gmsclient
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_buildBasePath(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Domain is required
|
||||
_, err := NewGMSClient(&setting.Cfg{
|
||||
CloudMigration: setting.CloudMigrationSettings{
|
||||
GMSDomain: "",
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
|
||||
// Domain is required
|
||||
c, err := NewGMSClient(&setting.Cfg{
|
||||
CloudMigration: setting.CloudMigrationSettings{
|
||||
GMSDomain: "non-empty",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
client := c.(*gmsClientImpl)
|
||||
|
||||
tests := []struct {
|
||||
description string
|
||||
domain string
|
||||
@@ -30,7 +49,8 @@ func Test_buildBasePath(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.description, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, buildBasePath(tt.domain, tt.clusterSlug))
|
||||
client.cfg.CloudMigration.GMSDomain = tt.domain
|
||||
assert.Equal(t, tt.expected, client.buildBasePath(tt.clusterSlug))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user