/
githubmirror
/
grafana
Обзор
Документация
Войти
/
githubmirror
/
grafana
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/services/sqlstore/user_test.go
40 строк
1 KB
Peter Štibraný
Replace check for integration tests. (#110707)
08 сен 2025, 16:49
Не верифицирован
08 сен 2025, 16:49
7fd9ab9
Код
Авторство
О чём код?
package sqlstore import ( "context" "testing" "github.com/grafana/grafana/pkg/util/testutil" "github.com/stretchr/testify/require" ) // testing a regression which shows up when the main org is created, but not the // admin user: getOrCreateOrg was unable to find the existing org. // https://github.com/grafana/grafana/issues/71781 func TestIntegrationGetOrCreateOrg(t *testing.T) { testutil.SkipIntegrationTestInShortMode(t) ss, _ := InitTestDB(t) err := ss.WithDbSession(context.Background(), func(sess *DBSession) error { // Create the org only: ss.cfg.AutoAssignOrg = true ss.cfg.DisableInitAdminCreation = true ss.cfg.AutoAssignOrgId = 1 createdOrgID, err := ss.getOrCreateOrg(sess, mainOrgName) require.NoError(t, err) require.Equal(t, int64(1), createdOrgID) return nil }) require.NoError(t, err) err = ss.WithDbSession(context.Background(), func(sess *DBSession) error { // Run it a second time and verify that it finds the org that was // created above. gotOrgId, err := ss.getOrCreateOrg(sess, mainOrgName) require.NoError(t, err) require.Equal(t, int64(1), gotOrgId) return nil }) require.NoError(t, err) }