Migrate config.json from config-dir to backend (#6195)

This PR is the first set of changes to move the config
to the backend, the changes use the existing `config.json`
allows it to be migrated such that we can save it in on
backend disks.

In future releases, we will slowly migrate out of the
current architecture.

Fixes #6182
This commit is contained in:
Harshavardhana
2018-08-14 21:41:47 -07:00
committed by Nitish Tiwari
parent 380524ae27
commit 0e02328c98
46 changed files with 818 additions and 845 deletions

View File

@@ -25,11 +25,15 @@ import (
)
func testAuthenticate(authType string, t *testing.T) {
testPath, err := newTestConfig(globalMinioDefaultRegion)
obj, fsDir, err := prepareFS()
if err != nil {
t.Fatalf("unable initialize config file, %s", err)
t.Fatal(err)
}
defer os.RemoveAll(testPath)
defer os.RemoveAll(fsDir)
if err = newTestConfig(globalMinioDefaultRegion, obj); err != nil {
t.Fatal(err)
}
cred, err := auth.GetNewCredentials()
if err != nil {
t.Fatalf("Error getting new credentials: %s", err)
@@ -92,11 +96,14 @@ func TestAuthenticateURL(t *testing.T) {
// Tests web request authenticator.
func TestWebRequestAuthenticate(t *testing.T) {
testPath, err := newTestConfig(globalMinioDefaultRegion)
obj, fsDir, err := prepareFS()
if err != nil {
t.Fatalf("unable initialize config file, %s", err)
t.Fatal(err)
}
defer os.RemoveAll(fsDir)
if err = newTestConfig(globalMinioDefaultRegion, obj); err != nil {
t.Fatal(err)
}
defer os.RemoveAll(testPath)
creds := globalServerConfig.GetCredential()
token, err := getTokenString(creds.AccessKey, creds.SecretKey)
@@ -143,11 +150,14 @@ func TestWebRequestAuthenticate(t *testing.T) {
}
func BenchmarkAuthenticateNode(b *testing.B) {
testPath, err := newTestConfig(globalMinioDefaultRegion)
obj, fsDir, err := prepareFS()
if err != nil {
b.Fatalf("unable initialize config file, %s", err)
b.Fatal(err)
}
defer os.RemoveAll(fsDir)
if err = newTestConfig(globalMinioDefaultRegion, obj); err != nil {
b.Fatal(err)
}
defer os.RemoveAll(testPath)
creds := globalServerConfig.GetCredential()
b.ResetTimer()
@@ -158,11 +168,14 @@ func BenchmarkAuthenticateNode(b *testing.B) {
}
func BenchmarkAuthenticateWeb(b *testing.B) {
testPath, err := newTestConfig(globalMinioDefaultRegion)
obj, fsDir, err := prepareFS()
if err != nil {
b.Fatalf("unable initialize config file, %s", err)
b.Fatal(err)
}
defer os.RemoveAll(fsDir)
if err = newTestConfig(globalMinioDefaultRegion, obj); err != nil {
b.Fatal(err)
}
defer os.RemoveAll(testPath)
creds := globalServerConfig.GetCredential()
b.ResetTimer()