(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func initModelListColumnNames(t *testing.T) { |
| 65 | t.Helper() |
| 66 | |
| 67 | originalIsMasterNode := common.IsMasterNode |
| 68 | originalSQLitePath := common.SQLitePath |
| 69 | originalMainDatabaseType := common.MainDatabaseType() |
| 70 | originalLogDatabaseType := common.LogDatabaseType() |
| 71 | originalSQLDSN, hadSQLDSN := os.LookupEnv("SQL_DSN") |
| 72 | defer func() { |
| 73 | common.IsMasterNode = originalIsMasterNode |
| 74 | common.SQLitePath = originalSQLitePath |
| 75 | common.SetDatabaseTypes(originalMainDatabaseType, originalLogDatabaseType) |
| 76 | if hadSQLDSN { |
| 77 | require.NoError(t, os.Setenv("SQL_DSN", originalSQLDSN)) |
| 78 | } else { |
| 79 | require.NoError(t, os.Unsetenv("SQL_DSN")) |
| 80 | } |
| 81 | }() |
| 82 | |
| 83 | common.IsMasterNode = false |
| 84 | common.SQLitePath = fmt.Sprintf("file:%s_init?mode=memory&cache=shared", strings.ReplaceAll(t.Name(), "/", "_")) |
| 85 | common.SetDatabaseTypes(common.DatabaseTypeSQLite, common.DatabaseTypeSQLite) |
| 86 | require.NoError(t, os.Setenv("SQL_DSN", "local")) |
| 87 | |
| 88 | require.NoError(t, model.InitDB()) |
| 89 | if model.DB != nil { |
| 90 | sqlDB, err := model.DB.DB() |
| 91 | if err == nil { |
| 92 | _ = sqlDB.Close() |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func withTieredBillingConfig(t *testing.T, modes map[string]string, exprs map[string]string) { |
| 98 | t.Helper() |
no test coverage detected