Skip to content

Commit

Permalink
config: avoid file conflicts between tests (#44947)
Browse files Browse the repository at this point in the history
close #44906
  • Loading branch information
hawkingrei authored Jun 26, 2023
1 parent bc80cf9 commit ab2bec3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ engines = ["tikv", "tiflash", "tidb"]

for _, test := range configTest {
conf := new(Config)
configFile := "config.toml"
storeDir := t.TempDir()
configFile := filepath.Join(storeDir, "config.toml")
f, err := os.Create(configFile)
require.NoError(t, err)
// Write the sample config file
Expand Down Expand Up @@ -690,7 +691,8 @@ func TestConfig(t *testing.T) {
conf.TiKVClient.CommitTimeout = "10s"
conf.TiKVClient.RegionCacheTTL = 600
conf.Instance.EnableSlowLog.Store(logutil.DefaultTiDBEnableSlowLog)
configFile := "config.toml"
storeDir := t.TempDir()
configFile := filepath.Join(storeDir, "config.toml")
f, err := os.Create(configFile)
require.NoError(t, err)
defer func(configFile string) {
Expand Down Expand Up @@ -1021,7 +1023,8 @@ func TestTxnTotalSizeLimitValid(t *testing.T) {
func TestConflictInstanceConfig(t *testing.T) {
var expectedNewName string
conf := new(Config)
configFile := "config.toml"
storeDir := t.TempDir()
configFile := filepath.Join(storeDir, "config.toml")

f, err := os.Create(configFile)
require.NoError(t, err)
Expand Down Expand Up @@ -1077,7 +1080,8 @@ func TestConflictInstanceConfig(t *testing.T) {
func TestDeprecatedConfig(t *testing.T) {
var expectedNewName string
conf := new(Config)
configFile := "config.toml"
storeDir := t.TempDir()
configFile := filepath.Join(storeDir, "config.toml")

f, err := os.Create(configFile)
require.NoError(t, err)
Expand Down

0 comments on commit ab2bec3

Please sign in to comment.