From 868e754ed437cbadf0cd266156e161842e04a2ba Mon Sep 17 00:00:00 2001 From: Joseph Palermo Date: Tue, 25 Apr 2023 18:08:22 -0500 Subject: [PATCH] Fix for the auditor permissions tests. AWS SDK is not returning all the roles at once while calling get-account-authorization-details, but is paginating the results. This is a fix that iterates over all the pages of the response. [#184632801] Add AssumeRole support to bosh-aws-cpi Signed-off-by: Daniel Felipe Ochoa --- src/bosh_aws_cpi/spec/integration/spec_helper.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bosh_aws_cpi/spec/integration/spec_helper.rb b/src/bosh_aws_cpi/spec/integration/spec_helper.rb index 7e0cf8b6..87ffe730 100644 --- a/src/bosh_aws_cpi/spec/integration/spec_helper.rb +++ b/src/bosh_aws_cpi/spec/integration/spec_helper.rb @@ -23,7 +23,15 @@ def validate_minimum_permissions(logger) logger: logger ) - account_details = iam_client.get_account_authorization_details(filter: ['Role']).role_detail_list.find { |role| + + ## + # The following lines are a workaround for the fact that the AWS SDK does not return all the results at once. + role_list = [] + iam_client.get_account_authorization_details(filter: ['Role']).each{ | response | + role_list += response.role_detail_list + } + + account_details = role_list.find { |role| role.arn == 'arn:aws:iam::' + integration_test_user.account + ':role/' + integration_test_user.arn.split('/')[1] } @@ -46,7 +54,7 @@ def validate_minimum_permissions(logger) s['Action'] end.flatten.uniq - expect(actions).to include(*minimum_action) + expect(actions).to match_array(minimum_action) end end