Fix config reloader in tests
config file may get removed before fsnotify starts watching it make sure the config file gets removed when test ends, closes #608 Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
19434af3c4
commit
003de3a80a
@ -608,22 +608,20 @@ func runCLIWithConfig(tempDir string, config string) (string, error) {
|
||||
port := GetFreePort()
|
||||
baseURL := GetBaseURL(port)
|
||||
|
||||
logFile, err := ioutil.TempFile("", "zot-log*.txt")
|
||||
logFile, err := ioutil.TempFile(tempDir, "zot-log*.txt")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
defer os.Remove(logFile.Name()) // clean up
|
||||
|
||||
cfgfile, err := ioutil.TempFile("", "zot-test*.json")
|
||||
cfgfile, err := ioutil.TempFile(tempDir, "zot-test*.json")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
config = fmt.Sprintf(config, tempDir, port, logFile.Name())
|
||||
|
||||
defer os.Remove(cfgfile.Name()) // clean up
|
||||
|
||||
_, err = cfgfile.Write([]byte(config))
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
Loading…
Reference in New Issue
Block a user