MCPcopy
hub / github.com/seaweedfs/seaweedfs / iamApiServerWithCredentialManager

Function iamApiServerWithCredentialManager

weed/iamapi/iamapi_test.go:566–581  ·  view source on GitHub ↗

iamApiServerWithCredentialManager builds an IamApiServer backed by a real in-memory credential store. Used for tests that exercise the targeted credentialManager paths (e.g. CreateUser) instead of the legacy mock.

()

Source from the content-addressed store, hash-verified

564// in-memory credential store. Used for tests that exercise the targeted
565// credentialManager paths (e.g. CreateUser) instead of the legacy mock.
566func iamApiServerWithCredentialManager() (*IamApiServer, *credential.CredentialManager, *countingConfigSaver) {
567 store := &memory.MemoryStore{}
568 store.Initialize(nil, "")
569 cm := &credential.CredentialManager{Store: store}
570
571 counter := &countingConfigSaver{cm: cm}
572 iamInstance := &s3api.IdentityAccessManagement{}
573 // Wire up the credential manager so GetCredentialManager() returns it.
574 iamInstance.SetCredentialManagerForTest(cm)
575
576 srv := &IamApiServer{
577 s3ApiConfig: counter,
578 iam: iamInstance,
579 }
580 return srv, cm, counter
581}
582
583// countingConfigSaver wraps the credential manager and counts full-config saves.
584type countingConfigSaver struct {

Callers 1

Calls 2

InitializeMethod · 0.95

Tested by

no test coverage detected