@@ -842,11 +842,12 @@ var _ = Describe("Credentials Provider Priority", func() {
842
842
It ("should handle credential updates from streaming provider" , func () {
843
843
initialCreds := auth .NewBasicCredentials ("initial_user" , "initial_pass" )
844
844
updatedCreds := auth .NewBasicCredentials ("updated_user" , "updated_pass" )
845
+ updatesChan := make (chan auth.Credentials , 1 )
845
846
846
847
opt = & redis.Options {
847
848
StreamingCredentialsProvider : & mockStreamingProvider {
848
849
credentials : initialCreds ,
849
- updates : make ( chan auth. Credentials , 1 ) ,
850
+ updates : updatesChan ,
850
851
},
851
852
}
852
853
@@ -861,6 +862,7 @@ var _ = Describe("Credentials Provider Priority", func() {
861
862
// wrongpass
862
863
Expect (client .Ping (context .Background ()).Err ()).To (HaveOccurred ())
863
864
Expect (recorder .Contains ("AUTH updated_user" )).To (BeTrue ())
865
+ close (updatesChan )
864
866
})
865
867
})
866
868
@@ -875,9 +877,6 @@ func (m *mockStreamingProvider) Subscribe(listener auth.CredentialsListener) (au
875
877
return nil , nil , m .err
876
878
}
877
879
878
- // Send initial credentials
879
- listener .OnNext (m .credentials )
880
-
881
880
// Start goroutine to handle updates
882
881
go func () {
883
882
for creds := range m .updates {
@@ -892,7 +891,6 @@ func (m *mockStreamingProvider) Subscribe(listener auth.CredentialsListener) (au
892
891
// allow multiple closes from multiple listeners
893
892
}
894
893
}()
895
- close (m .updates )
896
894
return
897
895
}, nil
898
896
}
0 commit comments