mirror of
https://github.com/minio/minio.git
synced 2025-01-26 06:03:17 -05:00
Make sure config testing is done in tempdir
This commit is contained in:
parent
f4cd0aa978
commit
582ce3df36
@ -1,9 +1,13 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/minio-io/minio/pkg/utils/crypto/keys"
|
||||
"github.com/minio-io/minio/pkg/utils/helpers"
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
@ -15,7 +19,16 @@ func Test(t *testing.T) { TestingT(t) }
|
||||
|
||||
func (s *MySuite) TestConfig(c *C) {
|
||||
conf := Config{}
|
||||
conf.SetupConfig()
|
||||
conf.configPath, _ = helpers.MakeTempTestDir()
|
||||
defer os.RemoveAll(conf.configPath)
|
||||
conf.configFile = path.Join(conf.configPath, "config.json")
|
||||
if _, err := os.Stat(conf.configFile); os.IsNotExist(err) {
|
||||
_, err = os.Create(conf.configFile)
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
conf.configLock = new(sync.RWMutex)
|
||||
|
||||
accesskey, _ := keys.GetRandomAlphaNumeric(keys.MINIO_ACCESS_ID)
|
||||
secretkey, _ := keys.GetRandomBase64(keys.MINIO_SECRET_ID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user