Chore: Remove mysqlParseTime feature toggle (#97761)

This commit is contained in:
Stephanie Hingtgen
2024-12-10 15:13:13 -06:00
committed by GitHub
parent db8ece3167
commit f05d016ae7
10 changed files with 1 additions and 44 deletions
+1 -2
View File
@@ -284,7 +284,7 @@ func (ss *SQLStore) initEngine(engine *xorm.Engine) error {
}
if engine == nil {
// Ensure that parseTime is enabled for MySQL
if ss.features.IsEnabledGlobally(featuremgmt.FlagMysqlParseTime) && strings.Contains(ss.dbCfg.Type, migrator.MySQL) && !strings.Contains(ss.dbCfg.ConnectionString, "parseTime=") {
if strings.Contains(ss.dbCfg.Type, migrator.MySQL) && !strings.Contains(ss.dbCfg.ConnectionString, "parseTime=") {
if strings.Contains(ss.dbCfg.ConnectionString, "?") {
ss.dbCfg.ConnectionString += "&parseTime=true"
} else {
@@ -490,7 +490,6 @@ func getCfgForTesting(opts ...InitTestDBOpt) *setting.Cfg {
func getFeaturesForTesting(opts ...InitTestDBOpt) featuremgmt.FeatureToggles {
featureKeys := []any{
featuremgmt.FlagPanelTitleSearch,
featuremgmt.FlagMysqlParseTime,
}
for _, opt := range opts {
if len(opt.FeatureFlags) > 0 {
-15
View File
@@ -76,42 +76,30 @@ func TestInitEngine_ParseTimeInConnectionString(t *testing.T) {
name string
connectionString string
dbType string
featureEnabled bool
expectedConnection string
}{
{
name: "MySQL with parseTime already present",
connectionString: "mysql://user:password@localhost:3306/alreadypresent?parseTime=false",
dbType: "mysql",
featureEnabled: true,
expectedConnection: "user:password@tcp(localhost:3306)/alreadypresent?collation=utf8mb4_unicode_ci&allowNativePasswords=true&clientFoundRows=true&parseTime=false",
},
{
name: "MySQL with feature enabled",
connectionString: "mysql://user:password@localhost:3306/existingparams?charset=utf8",
dbType: "mysql",
featureEnabled: true,
expectedConnection: "user:password@tcp(localhost:3306)/existingparams?collation=utf8mb4_unicode_ci&allowNativePasswords=true&clientFoundRows=true&charset=utf8&parseTime=true",
},
{
name: "MySQL with feature enabled",
connectionString: "mysql://user:password@localhost:3306/existingparams?charset=utf8",
dbType: "mysqlWithHooks",
featureEnabled: true,
expectedConnection: "user:password@tcp(localhost:3306)/existingparams?collation=utf8mb4_unicode_ci&allowNativePasswords=true&clientFoundRows=true&charset=utf8&parseTime=true",
},
{
name: "MySQL with feature disabled",
connectionString: "mysql://user:password@localhost:3306/disabled",
dbType: "mysql",
featureEnabled: false,
expectedConnection: "user:password@tcp(localhost:3306)/disabled?collation=utf8mb4_unicode_ci&allowNativePasswords=true&clientFoundRows=true",
},
{
name: "Postgres",
connectionString: "postgres://username:password@localhost:5432/mydatabase",
dbType: "postgres",
featureEnabled: true,
expectedConnection: "user=username host=localhost port=5432 dbname=mydatabase sslmode='' sslcert='' sslkey='' sslrootcert='' password=password",
},
}
@@ -124,9 +112,6 @@ func TestInitEngine_ParseTimeInConnectionString(t *testing.T) {
require.NoError(t, err)
ftMgr := featuremgmt.WithFeatures()
if tt.featureEnabled {
ftMgr = featuremgmt.WithFeatures(featuremgmt.FlagMysqlParseTime)
}
ss := &SQLStore{
cfg: &setting.Cfg{