Skip to content

Commit 523dc7a

Browse files
authored
Using us-east-1 for IAM clients in integration tests.
1 parent b72fd8e commit 523dc7a

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

aws-cpp-sdk-cognitoidentity-integration-tests/IdentityPoolOperationTest.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class IdentityPoolOperationTest : public ::testing::Test
5757
protected:
5858
void SetUp()
5959
{
60+
Aws::Client::ClientConfiguration config;
61+
config.region = Aws::Region::US_EAST_1;
6062
//TODO: move this over to profile config file.
61-
client = Aws::MakeShared<CognitoIdentityClient>(ALLOCATION_TAG);
63+
client = Aws::MakeShared<CognitoIdentityClient>(ALLOCATION_TAG, config);
6264
CleanupPreviousFailedTests();
6365
}
6466

@@ -97,7 +99,7 @@ class IdentityPoolOperationTest : public ::testing::Test
9799
ListIdentitiesRequest listIdentitiesRequest;
98100
listIdentitiesRequest.WithIdentityPoolId(identityPoolId).WithMaxResults(10);
99101
ListIdentitiesOutcome listIdentitiesOutcome = client->ListIdentities(listIdentitiesRequest);
100-
102+
101103
if (listIdentitiesOutcome.IsSuccess())
102104
{
103105
if (listIdentitiesOutcome.GetResult().GetIdentities().size() > 0)
@@ -246,12 +248,13 @@ TEST_F(IdentityPoolOperationTest, TestIdentityActions)
246248

247249
GetIdRequest getIdRequest;
248250
getIdRequest.WithIdentityPoolId(identityPoolId);
249-
251+
250252
ClientConfiguration clientConfig;
253+
clientConfig.region = Aws::Region::US_EAST_1;
251254

252255
auto iamClient = Aws::MakeShared<Aws::IAM::IAMClient>(ALLOCATION_TAG, clientConfig);
253256
Aws::AccessManagement::AccessManagementClient accessManagementClient(iamClient, client);
254-
257+
255258
getIdRequest.WithAccountId(accessManagementClient.GetAccountId());
256259

257260
GetIdOutcome getIdOutcome = client->GetId(getIdRequest);

aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class FunctionTest : public ::testing::Test {
110110

111111
// Create a client
112112
ClientConfiguration config;
113+
config.region = Aws::Region::US_EAST_1;
113114
config.scheme = Scheme::HTTPS;
114115
config.connectTimeoutMs = 30000;
115116
config.requestTimeoutMs = 30000;
@@ -123,6 +124,7 @@ class FunctionTest : public ::testing::Test {
123124
//Create our IAM Role, so that the Lambda tests have the right policies.
124125
m_role = Aws::MakeShared<Aws::IAM::Model::Role>(ALLOCATION_TAG);
125126
ClientConfiguration clientConfig;
127+
clientConfig.region = Aws::Region::US_EAST_1;
126128
m_iamClient = Aws::MakeShared<Aws::IAM::IAMClient>(ALLOCATION_TAG, clientConfig);
127129
auto cognitoClient = Aws::MakeShared<CognitoIdentityClient>(ALLOCATION_TAG);
128130
m_accessManagementClient = Aws::MakeShared<Aws::AccessManagement::AccessManagementClient>(ALLOCATION_TAG, m_iamClient, cognitoClient);

aws-cpp-sdk-s3-encryption-integration-tests/LiveClientTests.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class LiveClientTest : public ::testing::Test
4848
{
4949
TimeStamp = DateTime::Now().CalculateLocalTimestampAsString("%Y%m%dt%H%M%Sz").c_str();
5050

51-
StandardClient = Aws::MakeShared<Aws::S3::S3Client>(ALLOCATION_TAG);
51+
ClientConfiguration config;
52+
config.region = Aws::Region::US_EAST_1;
53+
StandardClient = Aws::MakeShared<Aws::S3::S3Client>(ALLOCATION_TAG, config);
5254
BucketName = ComputeUniqueBucketName(ENCRYPTED_BUCKET_TEST_NAME).c_str();
5355
Model::CreateBucketRequest createBucketRequest;
5456
createBucketRequest.WithBucket(BucketName.c_str())
@@ -86,12 +88,15 @@ TEST_F(LiveClientTest, TestEOMode)
8688
configuration.SetCryptoMode(CryptoMode::ENCRYPTION_ONLY);
8789
configuration.SetStorageMethod(StorageMethod::METADATA);
8890

91+
ClientConfiguration s3ClientConfig;
92+
s3ClientConfig.region = Aws::Region::US_EAST_1;
93+
8994
auto key = SymmetricCipher::GenerateKey();
9095
auto simpleEncryptionMaterials = Aws::MakeShared<Materials::SimpleEncryptionMaterialsWithGCMAAD>(ALLOCATION_TAG, key);
9196

9297
static const char* objectKey = "TestEOKey";
9398

94-
S3EncryptionClient client(simpleEncryptionMaterials, configuration);
99+
S3EncryptionClient client(simpleEncryptionMaterials, configuration, s3ClientConfig);
95100

96101
Model::PutObjectRequest putObjectRequest;
97102
putObjectRequest.WithBucket(BucketName.c_str())
@@ -164,12 +169,15 @@ TEST_F(LiveClientTest, TestAEMode)
164169
configuration.SetCryptoMode(CryptoMode::AUTHENTICATED_ENCRYPTION);
165170
configuration.SetStorageMethod(StorageMethod::METADATA);
166171

172+
ClientConfiguration s3ClientConfig;
173+
s3ClientConfig.region = Aws::Region::US_EAST_1;
174+
167175
auto key = SymmetricCipher::GenerateKey();
168176
auto simpleEncryptionMaterials = Aws::MakeShared<Materials::SimpleEncryptionMaterialsWithGCMAAD>(ALLOCATION_TAG, key);
169177

170178
static const char* objectKey = "TestAEKey";
171179

172-
S3EncryptionClient client(simpleEncryptionMaterials, configuration);
180+
S3EncryptionClient client(simpleEncryptionMaterials, configuration, s3ClientConfig);
173181

174182
Model::PutObjectRequest putObjectRequest;
175183
putObjectRequest.WithBucket(BucketName.c_str())
@@ -248,12 +256,15 @@ TEST_F(LiveClientTest, TestAEModeRangeGet)
248256
configuration.SetCryptoMode(CryptoMode::AUTHENTICATED_ENCRYPTION);
249257
configuration.SetStorageMethod(StorageMethod::METADATA);
250258

259+
ClientConfiguration s3ClientConfig;
260+
s3ClientConfig.region = Aws::Region::US_EAST_1;
261+
251262
auto key = SymmetricCipher::GenerateKey();
252263
auto simpleEncryptionMaterials = Aws::MakeShared<Materials::SimpleEncryptionMaterialsWithGCMAAD>(ALLOCATION_TAG, key);
253264

254265
static const char* objectKey = "TestAERangeGetKey";
255266

256-
S3EncryptionClient client(simpleEncryptionMaterials, configuration);
267+
S3EncryptionClient client(simpleEncryptionMaterials, configuration, s3ClientConfig);
257268

258269
Model::PutObjectRequest putObjectRequest;
259270
putObjectRequest.WithBucket(BucketName.c_str())
@@ -329,10 +340,13 @@ TEST_F(LiveClientTest, TestAEModeRangeGet)
329340

330341
TEST_F(LiveClientTest, TestS3EncryptionError)
331342
{
343+
ClientConfiguration s3ClientConfig;
344+
s3ClientConfig.region = Aws::Region::US_EAST_1;
345+
332346
auto kmsMaterials = Aws::MakeShared<Aws::S3Encryption::Materials::KMSWithContextEncryptionMaterials>("s3Encryption", "badKey");
333347
Aws::S3Encryption::CryptoConfiguration cryptoConfiguration(Aws::S3Encryption::StorageMethod::METADATA, Aws::S3Encryption::CryptoMode::ENCRYPTION_ONLY);
334348
auto credentials = Aws::MakeShared<Aws::Auth::DefaultAWSCredentialsProviderChain>("s3Encryption");
335-
Aws::S3Encryption::S3EncryptionClient encryptionClient(kmsMaterials, cryptoConfiguration, credentials);
349+
Aws::S3Encryption::S3EncryptionClient encryptionClient(kmsMaterials, cryptoConfiguration, credentials, s3ClientConfig);
336350

337351
Model::PutObjectRequest putObjectRequest;
338352
putObjectRequest.WithBucket("badBucket").WithKey("badKey");

aws-cpp-sdk-sqs-integration-tests/QueueOperationTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class QueueOperationTest : public ::testing::Test
8585
static ClientConfiguration GetConfig()
8686
{
8787
ClientConfiguration config("default");
88+
config.region = Aws::Region::US_EAST_1;
8889

8990
#if USE_PROXY_FOR_TESTS
9091
config.scheme = Scheme::HTTP;
@@ -148,7 +149,7 @@ class QueueOperationTest : public ::testing::Test
148149
Aws::String GetAwsAccountId()
149150
{
150151
auto cognitoClient = Aws::MakeShared<Aws::CognitoIdentity::CognitoIdentityClient>(ALLOCATION_TAG, GetConfig());
151-
auto iamClient = Aws::MakeShared<Aws::IAM::IAMClient>(ALLOCATION_TAG);
152+
auto iamClient = Aws::MakeShared<Aws::IAM::IAMClient>(ALLOCATION_TAG, GetConfig());
152153
Aws::AccessManagement::AccessManagementClient accessManagementClient(iamClient, cognitoClient);
153154
return accessManagementClient.GetAccountId();
154155
}

0 commit comments

Comments
 (0)