123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #include <AzCore/Settings/SettingsRegistry.h>
- #include <AzFramework/StringFunc/StringFunc.h>
- #include <Configuration/AWSCoreConfiguration.h>
- #include <ResourceMapping/AWSResourceMappingConstants.h>
- #include <ResourceMapping/AWSResourceMappingManager.h>
- #include <TestFramework/AWSCoreFixture.h>
- using namespace AWSCore;
- static constexpr const char TEST_EXPECTED_GLOBAL_ACCOUNTID[] = "123456789012";
- static constexpr const char TEST_EXPECTED_GLOBAL_REGION[] = "us-west-2";
- static constexpr const char TEST_EXPECTED_RESOURCE_ACCOUNTID[] = "012345678912";
- static constexpr const char TEST_EXPECTED_RESOURCE_REGION[] = "us-east-1";
- static constexpr const char TEST_EXPECTED_LAMBDA_KEYNAME[] = "TestLambda";
- static constexpr const char TEST_EXPECTED_LAMBDA_TYPE[] = "AWS::Lambda::Function";
- static constexpr const char TEST_EXPECTED_LAMBDA_NAMEID[] = "MyTestLambda";
- static constexpr const char TEST_EXPECTED_BUCKET_KEYNAME[] = "TestS3Bucket";
- static constexpr const char TEST_EXPECTED_BUCKET_TYPE[] = "AWS::S3::Bucket";
- static constexpr const char TEST_EXPECTED_BUCKET_NAMEID[] = "MyTestS3Bucket";
- static constexpr const char TEST_EXPECTED_SERVICE_KEYNAME[] = "TestService";
- static constexpr const char TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE[] =
- R"({
- "AWSResourceMappings": {
- "TestLambda": {
- "Type": "AWS::Lambda::Function",
- "Name/ID": "MyTestLambda",
- "Region": "us-east-1",
- "AccountId": "012345678912"
- },
- "TestS3Bucket": {
- "Type": "AWS::S3::Bucket",
- "Name/ID": "MyTestS3Bucket"
- },
- "TestService.RESTApiId": {
- "Type": "AWS::ApiGateway::RestApi",
- "Name/ID": "1234567890"
- },
- "TestService.RESTApiStage": {
- "Type": "AWS::ApiGateway::Stage",
- "Name/ID": "prod",
- "Region": "us-east-1"
- }
- },
- "AccountId": "123456789012",
- "Region": "us-west-2",
- "Version": "1.0.0"
- })";
- static constexpr const char TEST_VALID_EMPTY_ACCOUNTID_RESOURCE_MAPPING_CONFIG_FILE[] =
- R"({
- "AWSResourceMappings": {
- "TestLambda": {
- "Type": "AWS::Lambda::Function",
- "Name/ID": "MyTestLambda",
- "Region": "us-east-1",
- "AccountId": "012345678912"
- },
- "TestS3Bucket": {
- "Type": "AWS::S3::Bucket",
- "Name/ID": "MyTestS3Bucket"
- },
- "TestService.RESTApiId": {
- "Type": "AWS::ApiGateway::RestApi",
- "Name/ID": "1234567890"
- },
- "TestService.RESTApiStage": {
- "Type": "AWS::ApiGateway::Stage",
- "Name/ID": "prod",
- "Region": "us-east-1"
- }
- },
- "AccountId": "",
- "Region": "us-west-2",
- "Version": "1.1.0"
- })";
- static constexpr const char TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE[] =
- R"({
- "AWSResourceMappings": {},
- "AccountId": "123",
- "Region": "123",
- "Version": "123"
- })";
- static constexpr const char TEST_TEMPLATE_RESOURCE_MAPPING_CONFIG_FILE[] =
- R"({
- "AWSResourceMappings": {},
- "AccountId": "EMPTY",
- "Region": "us-west-2",
- "Version": "1.0.0"
- })";
- class AWSResourceMappingManagerTest
- : public AWSCoreFixture
- , AWSCoreInternalRequestBus::Handler
- {
- public:
- AWSResourceMappingManagerTest(): m_reloadConfigurationCounter(0)
- {
- m_resourceMappingManager = AZStd::make_unique<AWSCore::AWSResourceMappingManager>();
- }
- void SetUp() override
- {
- AWSCoreFixture::SetUpFixture(false);
- m_configFilePath = (GetTestTempDirectoryPath() /
- AWSCore::AWSCoreConfiguration::AWSCoreResourceMappingConfigFolderName /
- "test_aws_resource_mappings.json").LexicallyNormal();
- AWSCoreInternalRequestBus::Handler::BusConnect();
- }
- void TearDown() override
- {
- AWSCoreInternalRequestBus::Handler::BusDisconnect();
- RemoveFile(m_configFilePath.Native());
- m_configFilePath.clear();
- m_reloadConfigurationCounter = 0;
- m_resourceMappingManager->DeactivateManager();
- m_resourceMappingManager.reset();
- AWSCoreFixture::TearDownFixture(false);
- }
- // AWSCoreInternalRequestBus interface implementation
- AZStd::string GetProfileName() const override { return ""; }
- AZStd::string GetResourceMappingConfigFilePath() const override { return m_configFilePath.Native(); }
- bool IsAllowedAWSMetadataCredentials() const override { return false; }
- void ReloadConfiguration() override { m_reloadConfigurationCounter++; }
- AZStd::unique_ptr<AWSCore::AWSResourceMappingManager> m_resourceMappingManager;
- AZ::u8 m_reloadConfigurationCounter;
- AZ::IO::Path m_configFilePath;
- };
- TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseInvalidConfigFile_ConfigDataIsEmpty)
- {
- CreateFile(m_configFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_EQ(m_reloadConfigurationCounter, 0);
- EXPECT_TRUE(actualAccountId.empty());
- EXPECT_TRUE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Error);
- }
- TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_ConfigDataIsNotEmpty)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_EQ(m_reloadConfigurationCounter, 0);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Ready);
- }
- TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseTemplateConfigFile_ConfigDataIsNotEmpty)
- {
- CreateFile(m_configFilePath.Native(), TEST_TEMPLATE_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_EQ(m_reloadConfigurationCounter, 0);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Ready);
- }
- TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_ConfigDataIsNotEmptyWithMultithreadCalls)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- constexpr int testThreadNumber = 10;
- AZStd::atomic<int> actualEbusCalls = 0;
- AZStd::vector<AZStd::thread> testThreadPool;
- for (int index = 0; index < testThreadNumber; index++)
- {
- testThreadPool.emplace_back(AZStd::thread([&]() {
- AZStd::string actualAccountId;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- EXPECT_FALSE(actualAccountId.empty());
- ++actualEbusCalls;
- }));
- }
- for (auto& testThread : testThreadPool)
- {
- testThread.join();
- }
- EXPECT_TRUE(actualEbusCalls == testThreadNumber);
- }
- TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_GlobalAccountIdEmpty)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_EMPTY_ACCOUNTID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_EQ(m_reloadConfigurationCounter, 0);
- EXPECT_TRUE(actualAccountId.empty());
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Ready);
- }
- TEST_F(AWSResourceMappingManagerTest, DeactivateManager_AfterActivatingWithValidConfigFile_ConfigDataGetCleanedUp)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Ready);
- m_resourceMappingManager->DeactivateManager();
- EXPECT_TRUE(m_resourceMappingManager->GetDefaultAccountId().empty());
- EXPECT_TRUE(m_resourceMappingManager->GetDefaultRegion().empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::NotLoaded);
- }
- TEST_F(AWSResourceMappingManagerTest, GetDefaultAccountId_AfterParsingValidConfigFile_GetExpectedDefaultAccountId)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_EQ(TEST_EXPECTED_GLOBAL_ACCOUNTID, actualAccountId);
- }
- TEST_F(AWSResourceMappingManagerTest, GetDefaultRegion_AfterParsingValidConfigFile_GetExpectedDefaultRegion)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_EQ(TEST_EXPECTED_GLOBAL_REGION, actualRegion);
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceAccountId_AfterParsingValidConfigFile_GetExpectedAccountId)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualAccountId, &AWSResourceMappingRequests::GetResourceAccountId, TEST_EXPECTED_LAMBDA_KEYNAME);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_EQ(TEST_EXPECTED_RESOURCE_ACCOUNTID, actualAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(
- actualAccountId, &AWSResourceMappingRequests::GetResourceAccountId, TEST_EXPECTED_BUCKET_KEYNAME);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_EQ(TEST_EXPECTED_GLOBAL_ACCOUNTID, actualAccountId);
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceAccountId_QueryNonexistResourceMappingKeyName_GetEmptyAccountId)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualAccountId, &AWSResourceMappingRequests::GetResourceAccountId, "dummyKeyName");
- EXPECT_TRUE(actualAccountId.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceNameId_AfterParsingValidConfigFile_GetExpectedNameId)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualNameId;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualNameId, &AWSResourceMappingRequests::GetResourceNameId, TEST_EXPECTED_LAMBDA_KEYNAME);
- EXPECT_FALSE(actualNameId.empty());
- EXPECT_EQ(TEST_EXPECTED_LAMBDA_NAMEID, actualNameId);
- AWSResourceMappingRequestBus::BroadcastResult(
- actualNameId, &AWSResourceMappingRequests::GetResourceNameId, TEST_EXPECTED_BUCKET_KEYNAME);
- EXPECT_FALSE(actualNameId.empty());
- EXPECT_EQ(TEST_EXPECTED_BUCKET_NAMEID, actualNameId);
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceNameId_QueryNonexistResourceMappingKeyName_GetEmptyNameId)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualNameId;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualNameId, &AWSResourceMappingRequests::GetResourceNameId, "dummyKeyName");
- EXPECT_TRUE(actualNameId.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceRegion_AfterParsingValidConfigFile_GetExpectedRegion)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualRegion, &AWSResourceMappingRequests::GetResourceRegion, TEST_EXPECTED_LAMBDA_KEYNAME);
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_EQ(TEST_EXPECTED_RESOURCE_REGION, actualRegion);
- AWSResourceMappingRequestBus::BroadcastResult(
- actualRegion, &AWSResourceMappingRequests::GetResourceRegion, TEST_EXPECTED_BUCKET_KEYNAME);
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_EQ(TEST_EXPECTED_GLOBAL_REGION, actualRegion);
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceRegion_QueryNonexistResourceMappingKeyName_GetEmptyRegion)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualRegion, &AWSResourceMappingRequests::GetResourceRegion, "dummyKeyName");
- EXPECT_TRUE(actualRegion.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceType_AfterParsingValidConfigFile_GetExpectedType)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualType;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualType, &AWSResourceMappingRequests::GetResourceType, TEST_EXPECTED_LAMBDA_KEYNAME);
- EXPECT_FALSE(actualType.empty());
- EXPECT_EQ(TEST_EXPECTED_LAMBDA_TYPE, actualType);
- AWSResourceMappingRequestBus::BroadcastResult(
- actualType, &AWSResourceMappingRequests::GetResourceType, TEST_EXPECTED_BUCKET_KEYNAME);
- EXPECT_FALSE(actualType.empty());
- EXPECT_EQ(TEST_EXPECTED_BUCKET_TYPE, actualType);
- }
- TEST_F(AWSResourceMappingManagerTest, GetResourceType_QueryNonexistResourceMappingKeyName_GetEmptyType)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualType;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualType, &AWSResourceMappingRequests::GetResourceType, "dummyKeyName");
- EXPECT_TRUE(actualType.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_PassingEmptyServiceName_GetEmptyUrl)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualServiceUrl;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualServiceUrl, &AWSResourceMappingRequests::GetServiceUrlByServiceName, "");
- EXPECT_TRUE(actualServiceUrl.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_PassingEmptyRESTApiIdAndStage_GetEmptyUrl)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualServiceUrl;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualServiceUrl, &AWSResourceMappingRequests::GetServiceUrlByRESTApiIdAndStage, "", "");
- EXPECT_TRUE(actualServiceUrl.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_RESTApiIdAndStageHaveInconsistentRegion_GetEmptyUrl)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualServiceUrl;
- AWSResourceMappingRequestBus::BroadcastResult(
- actualServiceUrl, &AWSResourceMappingRequests::GetServiceUrlByServiceName, TEST_EXPECTED_SERVICE_KEYNAME);
- EXPECT_TRUE(actualServiceUrl.empty());
- }
- TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ParseValidConfigFileAfterParsingInvalid_ConfigDataGetParsed)
- {
- CreateFile(m_configFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ActivateManager();
- AZStd::string actualAccountId;
- AZStd::string actualRegion;
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_EQ(m_reloadConfigurationCounter, 0);
- EXPECT_TRUE(actualAccountId.empty());
- EXPECT_TRUE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Error);
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ReloadConfigFile();
- AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
- AWSResourceMappingRequestBus::BroadcastResult(actualRegion, &AWSResourceMappingRequests::GetDefaultRegion);
- EXPECT_EQ(m_reloadConfigurationCounter, 0);
- EXPECT_FALSE(actualAccountId.empty());
- EXPECT_FALSE(actualRegion.empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Ready);
- }
- TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ReloadConfigFileNameAndParseValidConfigFile_ConfigDataGetParsed)
- {
- CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
- m_resourceMappingManager->ReloadConfigFile(true);
- EXPECT_EQ(m_reloadConfigurationCounter, 1);
- EXPECT_FALSE(m_resourceMappingManager->GetDefaultAccountId().empty());
- EXPECT_FALSE(m_resourceMappingManager->GetDefaultRegion().empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Ready);
- }
- TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_MissingSetRegFile_ConfigDataIsNotParsed)
- {
- m_configFilePath.clear();
- m_resourceMappingManager->ReloadConfigFile(true);
- EXPECT_EQ(m_reloadConfigurationCounter, 1);
- EXPECT_TRUE(m_resourceMappingManager->GetDefaultAccountId().empty());
- EXPECT_TRUE(m_resourceMappingManager->GetDefaultRegion().empty());
- EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::NotLoaded);
- }
|