File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 SSHKit ::EC2InstanceConnect ::Backend . ssh_keys . clear
2929 SSHKit ::EC2InstanceConnect ::Backend . tunnels . clear
3030 end
31+
32+ # Stub calls to AWS metadata API on CI.
33+ if ENV [ 'CI' ]
34+ config . before do
35+ stub_request ( :put , 'http://169.254.169.254/latest/api/token' ) . to_return ( status : 200 )
36+
37+ stub_request ( :get , 'http://169.254.169.254/latest/meta-data/iam/security-credentials/' )
38+ . to_return ( status : 200 , body : 'DummyRole' )
39+
40+ stub_request ( :get , 'http://169.254.169.254/latest/meta-data/iam/security-credentials/DummyRole' )
41+ . to_return ( status : 200 , body : {
42+ Code : 'Success' ,
43+ LastUpdated : Time . now . utc . iso8601 ,
44+ Type : 'AWS-HMAC' ,
45+ AccessKeyId : SecureRandom . alphanumeric ( 10 ) ,
46+ SecretAccessKey : SecureRandom . alphanumeric ( 20 ) ,
47+ Token : SecureRandom . alphanumeric ( 60 ) ,
48+ Expiration : ( Time . now + 3600 ) . utc . iso8601
49+ } . to_json )
50+ end
51+ end
3152end
You can’t perform that action at this time.
0 commit comments