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.
()
| 564 | // in-memory credential store. Used for tests that exercise the targeted |
| 565 | // credentialManager paths (e.g. CreateUser) instead of the legacy mock. |
| 566 | func 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. |
| 584 | type countingConfigSaver struct { |
no test coverage detected