[v11.0.x] Cloudmigration: create migration (#86373)
Cloudmigration: create migration (#85386)
* Cloudmigration: create migration
* fix drone build
* lint fix
* fix unit test
---------
Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
(cherry picked from commit 383ebb2bc4)
Co-authored-by: Leonard Gram <leo@xlson.com>
This commit is contained in:
co-authored by
Leonard Gram
parent
98401be295
commit
f4539f7e9d
@@ -5,6 +5,7 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/bmizerany/assert"
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -26,10 +27,10 @@ func TestGetAllCloudMigrations(t *testing.T) {
|
||||
t.Run("get all cloud_migrations", func(t *testing.T) {
|
||||
// replace this with proper method when created
|
||||
_, err := testDB.GetSqlxSession().Exec(ctx, `
|
||||
INSERT INTO cloud_migration (id, auth_token, stack, created, updated)
|
||||
VALUES (1, '12345', 'stack1', '2024-03-25 15:30:36.000', '2024-03-27 15:30:43.000'),
|
||||
(2, '6789', 'stack2', '2024-03-25 15:30:36.000', '2024-03-27 15:30:43.000'),
|
||||
(3, '777', 'stack3', '2024-03-25 15:30:36.000', '2024-03-27 15:30:43.000');
|
||||
INSERT INTO cloud_migration (id, auth_token, stack, stack_id, region_slug, cluster_slug, created, updated)
|
||||
VALUES (1, '12345', '11111', 11111, 'test', 'test', '2024-03-25 15:30:36.000', '2024-03-27 15:30:43.000'),
|
||||
(2, '6789', '22222', 22222, 'test', 'test', '2024-03-25 15:30:36.000', '2024-03-27 15:30:43.000'),
|
||||
(3, '777', '33333', 33333, 'test', 'test', '2024-03-25 15:30:36.000', '2024-03-27 15:30:43.000');
|
||||
`)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -39,14 +40,14 @@ func TestGetAllCloudMigrations(t *testing.T) {
|
||||
for _, m := range value {
|
||||
switch m.ID {
|
||||
case 1:
|
||||
require.Equal(t, "stack1", m.Stack)
|
||||
require.Equal(t, "12345", m.AuthToken)
|
||||
assert.Equal(t, "11111", m.Stack)
|
||||
assert.Equal(t, "12345", m.AuthToken)
|
||||
case 2:
|
||||
require.Equal(t, "stack2", m.Stack)
|
||||
require.Equal(t, "6789", m.AuthToken)
|
||||
assert.Equal(t, "22222", m.Stack)
|
||||
assert.Equal(t, "6789", m.AuthToken)
|
||||
case 3:
|
||||
require.Equal(t, "stack3", m.Stack)
|
||||
require.Equal(t, "777", m.AuthToken)
|
||||
assert.Equal(t, "33333", m.Stack)
|
||||
assert.Equal(t, "777", m.AuthToken)
|
||||
default:
|
||||
require.Fail(t, "ID value not expected: "+strconv.FormatInt(m.ID, 10))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user