IAM: init IAM with Init() rather than InitStore() in tests (#13643)

- rename InitStore() to initStore() and fix tests

- Use IAMSys.Lock() only when IAMSys struct is being mutated
This commit is contained in:
Aditya Manthramurthy
2021-11-11 21:03:02 -08:00
committed by GitHub
parent 087c1b98dc
commit e8c6314770
6 changed files with 79 additions and 72 deletions
+6 -2
View File
@@ -22,6 +22,7 @@ import (
"net/http"
"os"
"testing"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/internal/auth"
@@ -29,6 +30,9 @@ import (
)
func TestCheckValid(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
objLayer, fsDir, err := prepareFS()
if err != nil {
t.Fatal(err)
@@ -40,9 +44,9 @@ func TestCheckValid(t *testing.T) {
newAllSubsystems()
initAllSubsystems(context.Background(), objLayer)
initAllSubsystems(ctx, objLayer)
globalIAMSys.InitStore(objLayer, globalEtcdClient)
globalIAMSys.Init(ctx, objLayer, globalEtcdClient, 2*time.Second)
req, err := newTestRequest(http.MethodGet, "http://example.com:9000/bucket/object", 0, nil)
if err != nil {