Unified Storage: Fix Create, Update and Delete wrt Resource Versions (#88183)

* add sqltemplate utilities, improve tests and documentation

* bunch of things

* remove unnecessary message

* add queries

* add queries

* add queries

* add folders support

* fix diff

* fix linters

* fix diff

* fix linters

* fix linters

* fix typo

* fix linters

* fix linters

* fix linters

* several fixes

* several fixes

* temporarily disable k8s integration tests for Entity Server

* postpone some tests

* postpone documentation changes

* Fix bug in create

* improve error reporting

* fix PostgeSQL parameters

* fix MySQL sqlmode

* fix MySQL-5.7

* reduce but document the number of database connection options

* remove unused code and improve docs
This commit is contained in:
Diego Augusto Molina
2024-06-05 14:23:32 -03:00
committed by GitHub
parent cbe7521a56
commit 6fcd7d9e03
43 changed files with 1867 additions and 1298 deletions
@@ -19,7 +19,10 @@ func TestGetEnginePostgresFromConfig(t *testing.T) {
s.Key("db_user").SetValue("user")
s.Key("db_password").SetValue("password")
engine, err := getEnginePostgres(cfg.SectionWithEnvOverrides("entity_api"), nil)
getter := &sectionGetter{
DynamicSection: cfg.SectionWithEnvOverrides("entity_api"),
}
engine, err := getEnginePostgres(getter, nil)
assert.NotNil(t, engine)
assert.NoError(t, err)
@@ -36,19 +39,11 @@ func TestGetEngineMySQLFromConfig(t *testing.T) {
s.Key("db_user").SetValue("user")
s.Key("db_password").SetValue("password")
engine, err := getEngineMySQL(cfg.SectionWithEnvOverrides("entity_api"), nil)
getter := &sectionGetter{
DynamicSection: cfg.SectionWithEnvOverrides("entity_api"),
}
engine, err := getEngineMySQL(getter, nil)
assert.NotNil(t, engine)
assert.NoError(t, err)
}
func TestGetConnectionStrings(t *testing.T) {
t.Run("generate mysql connection string", func(t *testing.T) {
expected := "user:password@tcp(localhost)/grafana?collation=utf8mb4_unicode_ci&allowNativePasswords=true&clientFoundRows=true"
assert.Equal(t, expected, connectionStringMySQL("user", "password", "tcp", "localhost", "grafana"))
})
t.Run("generate postgres connection string", func(t *testing.T) {
expected := "user=user password=password host=localhost port=5432 dbname=grafana sslmode=disable"
assert.Equal(t, expected, connectionStringPostgres("user", "password", "localhost", "5432", "grafana", "disable"))
})
}