api/admin: Reenable AdminApiReencrypt tests, fix enterprise version of the test. (#105462)

* Reenable tests. Fix access to "key" column when using mysql.
This commit is contained in:
Peter Štibraný
2025-05-15 16:25:30 +02:00
committed by GitHub
parent b77bf98890
commit 7d0f73058b
2 changed files with 7 additions and 5 deletions
@@ -20,8 +20,6 @@ import (
)
func TestIntegration_AdminApiReencrypt_Enterprise(t *testing.T) {
t.Skip("This test is currently broken, investigating...")
getSecretsFunctions := map[string]func(*testing.T, *server.TestEnv) map[int]secret{}
getSecretsFunctions["settings"] = func(t *testing.T, env *server.TestEnv) map[int]secret {
return getSettingSecrets(t, env.SQLStore)
@@ -72,7 +70,13 @@ func getSettingSecrets(t *testing.T, store db.DB) map[int]secret {
}
err := store.WithDbSession(t.Context(), func(sess *db.Session) error {
return sess.Table("setting").Select("section, key, encrypted_value").OrderBy("section, key").Find(&rows)
cols := []string{
store.GetDialect().Quote("section"),
store.GetDialect().Quote("key"),
store.GetDialect().Quote("encrypted_value"),
}
// Quote all column names. In practice, only `key` needs to be quoted in MySQL, but we quote all to be safe.
return sess.Table("setting").Select(strings.Join(cols, ", ")).Find(&rows)
})
require.NoError(t, err)
@@ -36,8 +36,6 @@ func TestMain(m *testing.M) {
}
func TestIntegration_AdminApiReencrypt(t *testing.T) {
t.Skip("This test is currently broken, investigating...")
const (
dataSourceTable = "data_source"
secretsTable = "secrets"