@@ -493,90 +493,6 @@ func TestBackendDiscoverer_applyAuthConfigToBackend(t *testing.T) {
493493assert .Equal (t , "config-token" , backend .AuthMetadata ["token" ])
494494})
495495
496- t .Run ("mixed mode with explicit config override" , func (t * testing.T ) {
497- t .Parallel ()
498- ctrl := gomock .NewController (t )
499- t .Cleanup (ctrl .Finish )
500-
501- mockWorkloadDiscoverer := discoverermocks .NewMockDiscoverer (ctrl )
502- mockGroups := mocks .NewMockManager (ctrl )
503-
504- authConfig := & config.OutgoingAuthConfig {
505- Source : "mixed" ,
506- Backends : map [string ]* config.BackendAuthStrategy {
507- "backend1" : {
508- Type : "bearer" ,
509- Metadata : map [string ]any {
510- "token" : "override-token" ,
511- },
512- },
513- },
514- }
515-
516- discoverer := & backendDiscoverer {
517- workloadsManager : mockWorkloadDiscoverer ,
518- groupsManager : mockGroups ,
519- authConfig : authConfig ,
520- }
521-
522- backend := & vmcp.Backend {
523- ID : "backend1" ,
524- Name : "backend1" ,
525- AuthStrategy : "token_exchange" ,
526- AuthMetadata : map [string ]any {
527- "token_endpoint" : "https://auth.example.com/token" ,
528- },
529- }
530-
531- discoverer .applyAuthConfigToBackend (backend , "backend1" )
532-
533- // In mixed mode with explicit config, config should override discovered auth
534- assert .Equal (t , "bearer" , backend .AuthStrategy )
535- assert .Equal (t , "override-token" , backend .AuthMetadata ["token" ])
536- })
537-
538- t .Run ("mixed mode without explicit config uses discovered auth" , func (t * testing.T ) {
539- t .Parallel ()
540- ctrl := gomock .NewController (t )
541- t .Cleanup (ctrl .Finish )
542-
543- mockWorkloadDiscoverer := discoverermocks .NewMockDiscoverer (ctrl )
544- mockGroups := mocks .NewMockManager (ctrl )
545-
546- authConfig := & config.OutgoingAuthConfig {
547- Source : "mixed" ,
548- Backends : map [string ]* config.BackendAuthStrategy {
549- "other-backend" : {
550- Type : "bearer" ,
551- Metadata : map [string ]any {
552- "token" : "other-token" ,
553- },
554- },
555- },
556- }
557-
558- discoverer := & backendDiscoverer {
559- workloadsManager : mockWorkloadDiscoverer ,
560- groupsManager : mockGroups ,
561- authConfig : authConfig ,
562- }
563-
564- backend := & vmcp.Backend {
565- ID : "backend1" ,
566- Name : "backend1" ,
567- AuthStrategy : "token_exchange" ,
568- AuthMetadata : map [string ]any {
569- "token_endpoint" : "https://auth.example.com/token" ,
570- },
571- }
572-
573- discoverer .applyAuthConfigToBackend (backend , "backend1" )
574-
575- // In mixed mode without explicit config, discovered auth should be preserved
576- assert .Equal (t , "token_exchange" , backend .AuthStrategy )
577- assert .Equal (t , "https://auth.example.com/token" , backend .AuthMetadata ["token_endpoint" ])
578- })
579-
580496t .Run ("inline mode ignores discovered auth" , func (t * testing.T ) {
581497t .Parallel ()
582498ctrl := gomock .NewController (t )
@@ -813,52 +729,6 @@ func TestBackendDiscoverer_applyAuthConfigToBackend(t *testing.T) {
813729assert .Equal (t , "secret-key-123" , backend .AuthMetadata ["api_key" ])
814730})
815731
816- t .Run ("mixed mode falls back to config when no discovered auth" , func (t * testing.T ) {
817- t .Parallel ()
818- ctrl := gomock .NewController (t )
819- t .Cleanup (ctrl .Finish )
820-
821- mockWorkloadDiscoverer := discoverermocks .NewMockDiscoverer (ctrl )
822- mockGroups := mocks .NewMockManager (ctrl )
823-
824- authConfig := & config.OutgoingAuthConfig {
825- Source : "mixed" ,
826- Backends : map [string ]* config.BackendAuthStrategy {
827- "other-backend" : {
828- Type : "bearer" ,
829- Metadata : map [string ]any {
830- "token" : "other-token" ,
831- },
832- },
833- },
834- Default : & config.BackendAuthStrategy {
835- Type : "bearer" ,
836- Metadata : map [string ]any {
837- "token" : "default-token" ,
838- },
839- },
840- }
841-
842- discoverer := & backendDiscoverer {
843- workloadsManager : mockWorkloadDiscoverer ,
844- groupsManager : mockGroups ,
845- authConfig : authConfig ,
846- }
847-
848- backend := & vmcp.Backend {
849- ID : "backend1" ,
850- Name : "backend1" ,
851- // No discovered auth
852- }
853-
854- discoverer .applyAuthConfigToBackend (backend , "backend1" )
855-
856- // In mixed mode with no explicit config and no discovered auth,
857- // should use default config
858- assert .Equal (t , "bearer" , backend .AuthStrategy )
859- assert .Equal (t , "default-token" , backend .AuthMetadata ["token" ])
860- })
861-
862732t .Run ("discovered mode falls back to default config when no auth discovered" , func (t * testing.T ) {
863733t .Parallel ()
864734ctrl := gomock .NewController (t )
0 commit comments