Delete temp test file when exist
This commit is contained in:
parent
ec7ab83d7c
commit
c5493fd1f1
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ package conf
|
||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ Host = 127.0.0.1:3306
|
||||||
Name = v3
|
Name = v3
|
||||||
TablePrefix = v3_`
|
TablePrefix = v3_`
|
||||||
err := ioutil.WriteFile("testConf.ini", []byte(testCase), 0644)
|
err := ioutil.WriteFile("testConf.ini", []byte(testCase), 0644)
|
||||||
|
defer func() { err = os.Remove("testConf.ini") }()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -47,6 +49,7 @@ Host = 127.0.0.1:3306
|
||||||
Name = v3
|
Name = v3
|
||||||
TablePrefix = v3_`
|
TablePrefix = v3_`
|
||||||
err := ioutil.WriteFile("testConf.ini", []byte(testCase), 0644)
|
err := ioutil.WriteFile("testConf.ini", []byte(testCase), 0644)
|
||||||
|
defer func() { err = os.Remove("testConf.ini") }()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -67,6 +70,7 @@ Host = 127.0.0.1:3306
|
||||||
Name = v3
|
Name = v3
|
||||||
TablePrefix = v3_`
|
TablePrefix = v3_`
|
||||||
err := ioutil.WriteFile("testConf.ini", []byte(testCase), 0644)
|
err := ioutil.WriteFile("testConf.ini", []byte(testCase), 0644)
|
||||||
|
defer func() { err = os.Remove("testConf.ini") }()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue