@@ -549,11 +549,13 @@ func TestIdentityStore_TokenEntityInheritance(t *testing.T) {
549549}
550550
551551func TestIdentityStore_MergeConflictingAliases (t * testing.T ) {
552- err := AddTestCredentialBackend ("github" , credGithub .Factory )
553- if err != nil {
554- t .Fatalf ("err: %s" , err )
552+ conf := & CoreConfig {
553+ BuiltinRegistry : corehelpers .NewMockBuiltinRegistry (),
554+ CredentialBackends : map [string ]logical.Factory {
555+ "github" : credGithub .Factory ,
556+ },
555557 }
556- c , _ , _ := TestCoreUnsealed ( t )
558+ c , _ , _ := TestCoreUnsealedWithConfig ( t , conf )
557559
558560 meGH := & MountEntry {
559561 Table : credentialTableType ,
@@ -562,7 +564,7 @@ func TestIdentityStore_MergeConflictingAliases(t *testing.T) {
562564 Description : "github auth" ,
563565 }
564566
565- err = c .enableCredential (namespace .RootContext (nil ), meGH )
567+ err : = c .enableCredential (namespace .RootContext (nil ), meGH )
566568 if err != nil {
567569 t .Fatal (err )
568570 }
@@ -666,13 +668,13 @@ func testIdentityStoreWithGithubAuth(ctx context.Context, t *testing.T) (*Identi
666668// backend to assist with testing aliases and entities that require an valid
667669// mount accessor of an auth backend.
668670func testIdentityStoreWithGithubAuthRoot (ctx context.Context , t * testing.T ) (* IdentityStore , string , * Core , string ) {
669- // Add github credential factory to core config
670- err := AddTestCredentialBackend ("github" , credGithub .Factory )
671- if err != nil {
672- t .Fatalf ("err: %s" , err )
671+ conf := & CoreConfig {
672+ BuiltinRegistry : corehelpers .NewMockBuiltinRegistry (),
673+ CredentialBackends : map [string ]logical.Factory {
674+ "github" : credGithub .Factory ,
675+ },
673676 }
674-
675- c , _ , root := TestCoreUnsealed (t )
677+ c , _ , root := TestCoreUnsealedWithConfig (t , conf )
676678
677679 meGH := & MountEntry {
678680 Table : credentialTableType ,
@@ -681,27 +683,21 @@ func testIdentityStoreWithGithubAuthRoot(ctx context.Context, t *testing.T) (*Id
681683 Description : "github auth" ,
682684 }
683685
684- err = c .enableCredential (ctx , meGH )
685- if err != nil {
686- t .Fatal (err )
687- }
686+ err := c .enableCredential (ctx , meGH )
687+ require .NoError (t , err )
688688
689689 return c .identityStore , meGH .Accessor , c , root
690690}
691691
692692func testIdentityStoreWithGithubUserpassAuth (ctx context.Context , t * testing.T ) (* IdentityStore , string , string , * Core ) {
693- // Setup 2 auth backends, github and userpass
694- err := AddTestCredentialBackend ("github" , credGithub .Factory )
695- if err != nil {
696- t .Fatalf ("err: %s" , err )
697- }
698-
699- err = AddTestCredentialBackend ("userpass" , credUserpass .Factory )
700- if err != nil {
701- t .Fatalf ("err: %s" , err )
693+ conf := & CoreConfig {
694+ BuiltinRegistry : corehelpers .NewMockBuiltinRegistry (),
695+ CredentialBackends : map [string ]logical.Factory {
696+ "github" : credGithub .Factory ,
697+ "userpass" : credUserpass .Factory ,
698+ },
702699 }
703-
704- c , _ , _ := TestCoreUnsealed (t )
700+ c , _ , _ := TestCoreUnsealedWithConfig (t , conf )
705701
706702 githubMe := & MountEntry {
707703 Table : credentialTableType ,
@@ -710,7 +706,7 @@ func testIdentityStoreWithGithubUserpassAuth(ctx context.Context, t *testing.T)
710706 Description : "github auth" ,
711707 }
712708
713- err = c .enableCredential (ctx , githubMe )
709+ err : = c .enableCredential (ctx , githubMe )
714710 if err != nil {
715711 t .Fatal (err )
716712 }
@@ -774,13 +770,13 @@ func expectSingleCount(t *testing.T, sink *metrics.InmemSink, keyPrefix string)
774770}
775771
776772func TestIdentityStore_NewEntityCounter (t * testing.T ) {
777- // Add github credential factory to core config
778- err := AddTestCredentialBackend ("github" , credGithub .Factory )
779- if err != nil {
780- t .Fatalf ("err: %s" , err )
773+ conf := & CoreConfig {
774+ BuiltinRegistry : corehelpers .NewMockBuiltinRegistry (),
775+ CredentialBackends : map [string ]logical.Factory {
776+ "github" : credGithub .Factory ,
777+ },
781778 }
782-
783- c , _ , _ , sink := TestCoreUnsealedWithMetrics (t )
779+ c , _ , _ , sink := TestCoreUnsealedWithMetricsAndConfig (t , conf )
784780
785781 meGH := & MountEntry {
786782 Table : credentialTableType ,
@@ -790,7 +786,7 @@ func TestIdentityStore_NewEntityCounter(t *testing.T) {
790786 }
791787
792788 ctx := namespace .RootContext (nil )
793- err = c .enableCredential (ctx , meGH )
789+ err : = c .enableCredential (ctx , meGH )
794790 if err != nil {
795791 t .Fatal (err )
796792 }
0 commit comments