1111package credentials
1212
1313import (
14+ "context"
1415 "reflect"
1516 "testing"
1617
@@ -23,7 +24,7 @@ type secondStubProvider struct {
2324 err error
2425}
2526
26- func (s * secondStubProvider ) Retrieve () (Value , error ) {
27+ func (s * secondStubProvider ) Retrieve (_ context. Context ) (Value , error ) {
2728 s .expired = false
2829 s .creds .ProviderName = "secondStubProvider"
2930 return s .creds , s .err
@@ -54,7 +55,7 @@ func TestChainProviderWithNames(t *testing.T) {
5455 },
5556 }
5657
57- creds , err := p .Retrieve ()
58+ creds , err := p .Retrieve (context . Background () )
5859 if err != nil {
5960 t .Errorf ("Expect no error, got %v" , err )
6061 }
@@ -90,7 +91,7 @@ func TestChainProviderGet(t *testing.T) {
9091 },
9192 }
9293
93- creds , err := p .Retrieve ()
94+ creds , err := p .Retrieve (context . Background () )
9495 if err != nil {
9596 t .Errorf ("Expect no error, got %v" , err )
9697 }
@@ -113,10 +114,12 @@ func TestChainProviderIsExpired(t *testing.T) {
113114 },
114115 }
115116
117+ ctx := context .Background ()
118+
116119 if ! p .IsExpired () {
117120 t .Errorf ("Expect expired to be true before any Retrieve" )
118121 }
119- _ , err := p .Retrieve ()
122+ _ , err := p .Retrieve (ctx )
120123 if err != nil {
121124 t .Errorf ("Expect no error, got %v" , err )
122125 }
@@ -129,7 +132,7 @@ func TestChainProviderIsExpired(t *testing.T) {
129132 t .Errorf ("Expect return of expired provider" )
130133 }
131134
132- _ , err = p .Retrieve ()
135+ _ , err = p .Retrieve (ctx )
133136 if err != nil {
134137 t .Errorf ("Expect no error, got %v" , err )
135138 }
@@ -146,7 +149,7 @@ func TestChainProviderWithNoProvider(t *testing.T) {
146149 if ! p .IsExpired () {
147150 t .Errorf ("Expect expired with no providers" )
148151 }
149- _ , err := p .Retrieve ()
152+ _ , err := p .Retrieve (context . Background () )
150153 if err .Error () != "NoCredentialProviders: no valid providers in chain" {
151154 t .Errorf ("Expect no providers error returned, got %v" , err )
152155 }
@@ -167,7 +170,7 @@ func TestChainProviderWithNoValidProvider(t *testing.T) {
167170 if ! p .IsExpired () {
168171 t .Errorf ("Expect expired with no providers" )
169172 }
170- _ , err := p .Retrieve ()
173+ _ , err := p .Retrieve (context . Background () )
171174
172175 expectErr := awserr .NewBatchError ("NoCredentialProviders" , "no valid providers in chain" , errs )
173176 if e , a := expectErr , err ; ! reflect .DeepEqual (e , a ) {
0 commit comments