File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 68
68
:assume_role_with_web_identity ,
69
69
credentials : credentials
70
70
)
71
- @system = Object . any_instance . stubs ( :system ) . with { |x | x . match /aws configure set / }
71
+ @system = Object . any_instance . stubs ( :system ) . with do |x |
72
+ x . match ( 'which aws' ) || x . match ( 'aws configure set ' )
73
+ end . returns ( true )
72
74
@oauth_default = Google ::Auth . stubs ( :get_application_default ) . returns ( oauth )
73
75
end
74
76
75
77
it 'creates credentials from a Google auth token' do
76
78
@oauth_default . once
77
- system . times ( 4 )
79
+ system . times ( 5 )
78
80
79
81
c = Aws ::STS ::Client . new . config . credentials
80
82
c . credentials . access_key_id . must_equal credentials [ :access_key_id ]
90
92
then . returns ( JWT . encode ( { email : 'email' } , '' ) )
91
93
Google ::Auth . stubs ( :get_application_default ) . returns ( m )
92
94
93
- system . times ( 4 )
95
+ system . times ( 5 )
94
96
95
97
c = Aws ::STS ::Client . new . config . credentials
96
98
c . credentials . access_key_id . must_equal credentials [ :access_key_id ]
117
119
it 'refreshes saved expired credentials' do
118
120
config [ :profile ] = 'cdo-expired'
119
121
@oauth_default . once
120
- system . times ( 4 )
122
+ system . times ( 5 )
121
123
Aws ::STS ::Client . new . config . credentials
122
124
end
123
125
139
141
end
140
142
141
143
it 'retries Google auth when invalid credentials are provided' do
142
- system . times ( 4 )
144
+ system . times ( 5 )
143
145
@oauth_default . once
144
146
Aws ::Google . any_instance . expects ( :google_oauth ) . returns ( oauth )
145
147
Aws ::STS ::Client . new . config . credentials
You can’t perform that action at this time.
0 commit comments