|
|
@ -1,9 +1,13 @@ |
|
|
|
package config |
|
|
|
package config |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
|
|
|
|
"os" |
|
|
|
|
|
|
|
"path" |
|
|
|
|
|
|
|
"sync" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/minio-io/minio/pkg/utils/crypto/keys" |
|
|
|
"github.com/minio-io/minio/pkg/utils/crypto/keys" |
|
|
|
|
|
|
|
"github.com/minio-io/minio/pkg/utils/helpers" |
|
|
|
. "gopkg.in/check.v1" |
|
|
|
. "gopkg.in/check.v1" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -15,7 +19,16 @@ func Test(t *testing.T) { TestingT(t) } |
|
|
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestConfig(c *C) { |
|
|
|
func (s *MySuite) TestConfig(c *C) { |
|
|
|
conf := Config{} |
|
|
|
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) |
|
|
|
accesskey, _ := keys.GetRandomAlphaNumeric(keys.MINIO_ACCESS_ID) |
|
|
|
secretkey, _ := keys.GetRandomBase64(keys.MINIO_SECRET_ID) |
|
|
|
secretkey, _ := keys.GetRandomBase64(keys.MINIO_SECRET_ID) |
|
|
|