Add cvar for aws log level (#5507)
* Add cvar for aws log level Signed-off-by: onecent1101 <liug@amazon.com> * Remove old crysystem registered cmd and add safeguard to get cvar from console Signed-off-by: onecent1101 <liug@amazon.com> * Suppress error for client auth unit test as logging was routed to warning before Signed-off-by: onecent1101 <liug@amazon.com>
This commit is contained in:
@@ -1225,20 +1225,6 @@ static AZStd::string ConcatPath(const char* szPart1, const char* szPart2)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to maintain backwards compatibility with our CVar but not force our new code to
|
|
||||||
// pull in CryCommon by routing through an environment variable
|
|
||||||
void CmdSetAwsLogLevel(IConsoleCmdArgs* pArgs)
|
|
||||||
{
|
|
||||||
static const char* const logLevelEnvVar = "sys_SetLogLevel";
|
|
||||||
static AZ::EnvironmentVariable<int> logVar = AZ::Environment::CreateVariable<int>(logLevelEnvVar);
|
|
||||||
if (pArgs->GetArgCount() > 1)
|
|
||||||
{
|
|
||||||
int logLevel = atoi(pArgs->GetArg(1));
|
|
||||||
*logVar = logLevel;
|
|
||||||
AZ_TracePrintf("AWSLogging", "Log level set to %d", *logVar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void CSystem::CreateSystemVars()
|
void CSystem::CreateSystemVars()
|
||||||
{
|
{
|
||||||
@@ -1601,8 +1587,6 @@ void CSystem::CreateSystemVars()
|
|||||||
// Since the UI Canvas Editor is incomplete, we have a variable to enable it.
|
// Since the UI Canvas Editor is incomplete, we have a variable to enable it.
|
||||||
// By default it is now enabled. Modify system.cfg or game.cfg to disable it
|
// By default it is now enabled. Modify system.cfg or game.cfg to disable it
|
||||||
REGISTER_INT("sys_enableCanvasEditor", 1, VF_NULL, "Enables the UI Canvas Editor");
|
REGISTER_INT("sys_enableCanvasEditor", 1, VF_NULL, "Enables the UI Canvas Editor");
|
||||||
|
|
||||||
REGISTER_COMMAND("sys_SetLogLevel", CmdSetAwsLogLevel, 0, "Set AWS log level [0 - 6].");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -24,3 +24,30 @@ ly_add_target(
|
|||||||
3rdParty::AWSNativeSDK::Core
|
3rdParty::AWSNativeSDK::Core
|
||||||
AZ::AzCore
|
AZ::AzCore
|
||||||
)
|
)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Tests
|
||||||
|
################################################################################
|
||||||
|
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||||
|
ly_add_target(
|
||||||
|
NAME AWSNativeSDKInit.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||||
|
NAMESPACE AZ
|
||||||
|
FILES_CMAKE
|
||||||
|
aws_native_sdk_init_tests_files.cmake
|
||||||
|
INCLUDE_DIRECTORIES
|
||||||
|
PRIVATE
|
||||||
|
include
|
||||||
|
tests
|
||||||
|
source
|
||||||
|
BUILD_DEPENDENCIES
|
||||||
|
PRIVATE
|
||||||
|
AZ::AzCore
|
||||||
|
AZ::AzFramework
|
||||||
|
AZ::AzTest
|
||||||
|
AZ::AWSNativeSDKInit
|
||||||
|
3rdParty::AWSNativeSDK::Core
|
||||||
|
)
|
||||||
|
ly_add_googletest(
|
||||||
|
NAME AZ::AWSNativeSDKInit.Tests
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
set(FILES
|
||||||
|
tests/AWSLogSystemInterfaceTest.cpp
|
||||||
|
tests/AWSNativeSDKInitTest.cpp
|
||||||
|
)
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
#include <AWSNativeSDKInit/AWSLogSystemInterface.h>
|
#include <AWSNativeSDKInit/AWSLogSystemInterface.h>
|
||||||
|
|
||||||
#include <AzCore/base.h>
|
#include <AzCore/base.h>
|
||||||
|
#include <AzCore/Console/IConsole.h>
|
||||||
|
#include <AzCore/Interface/Interface.h>
|
||||||
#include <AzCore/Module/Environment.h>
|
#include <AzCore/Module/Environment.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -24,6 +26,9 @@ AZ_POP_DISABLE_WARNING
|
|||||||
|
|
||||||
namespace AWSNativeSDKInit
|
namespace AWSNativeSDKInit
|
||||||
{
|
{
|
||||||
|
AZ_CVAR(int, bg_awsLogLevel, -1, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||||
|
"AWSLogLevel used to control verbosity of logging system. Off = 0, Fatal = 1, Error = 2, Warn = 3, Info = 4, Debug = 5, Trace = 6");
|
||||||
|
|
||||||
const char* AWSLogSystemInterface::AWS_API_LOG_PREFIX = "AwsApi-";
|
const char* AWSLogSystemInterface::AWS_API_LOG_PREFIX = "AwsApi-";
|
||||||
const int AWSLogSystemInterface::MAX_MESSAGE_LENGTH = 4096;
|
const int AWSLogSystemInterface::MAX_MESSAGE_LENGTH = 4096;
|
||||||
const char* AWSLogSystemInterface::MESSAGE_FORMAT = "[AWS] %s - %s";
|
const char* AWSLogSystemInterface::MESSAGE_FORMAT = "[AWS] %s - %s";
|
||||||
@@ -40,15 +45,16 @@ namespace AWSNativeSDKInit
|
|||||||
Aws::Utils::Logging::LogLevel AWSLogSystemInterface::GetLogLevel() const
|
Aws::Utils::Logging::LogLevel AWSLogSystemInterface::GetLogLevel() const
|
||||||
{
|
{
|
||||||
Aws::Utils::Logging::LogLevel newLevel = m_logLevel;
|
Aws::Utils::Logging::LogLevel newLevel = m_logLevel;
|
||||||
static const char* const logLevelEnvVar = "sys_SetLogLevel";
|
if (auto console = AZ::Interface<AZ::IConsole>::Get(); console != nullptr)
|
||||||
auto logVar = AZ::Environment::FindVariable<int>(logLevelEnvVar);
|
|
||||||
|
|
||||||
if (logVar)
|
|
||||||
{
|
{
|
||||||
newLevel = (Aws::Utils::Logging::LogLevel) *logVar;
|
int awsLogLevel = -1;
|
||||||
|
console->GetCvarValue("bg_awsLogLevel", awsLogLevel);
|
||||||
|
if (awsLogLevel >= 0)
|
||||||
|
{
|
||||||
|
newLevel = static_cast<Aws::Utils::Logging::LogLevel>(awsLogLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return newLevel;
|
||||||
return newLevel != m_logLevel ? newLevel : m_logLevel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,14 +84,12 @@ namespace AWSNativeSDKInit
|
|||||||
*/
|
*/
|
||||||
void AWSLogSystemInterface::LogStream(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream)
|
void AWSLogSystemInterface::LogStream(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!ShouldLog(logLevel))
|
if(!ShouldLog(logLevel))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ForwardAwsApiLogMessage(logLevel, tag, messageStream.str().c_str());
|
ForwardAwsApiLogMessage(logLevel, tag, messageStream.str().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AWSLogSystemInterface::ShouldLog(Aws::Utils::Logging::LogLevel logLevel)
|
bool AWSLogSystemInterface::ShouldLog(Aws::Utils::Logging::LogLevel logLevel)
|
||||||
@@ -93,7 +97,7 @@ namespace AWSNativeSDKInit
|
|||||||
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
||||||
Aws::Utils::Logging::LogLevel newLevel = GetLogLevel();
|
Aws::Utils::Logging::LogLevel newLevel = GetLogLevel();
|
||||||
|
|
||||||
if (newLevel > Aws::Utils::Logging::LogLevel::Info && newLevel <= Aws::Utils::Logging::LogLevel::Trace && newLevel != m_logLevel)
|
if (newLevel != m_logLevel)
|
||||||
{
|
{
|
||||||
SetLogLevel(newLevel);
|
SetLogLevel(newLevel);
|
||||||
}
|
}
|
||||||
@@ -124,7 +128,7 @@ namespace AWSNativeSDKInit
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Aws::Utils::Logging::LogLevel::Error:
|
case Aws::Utils::Logging::LogLevel::Error:
|
||||||
AZ::Debug::Trace::Instance().Warning(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE, AWSLogSystemInterface::ERROR_WINDOW_NAME, MESSAGE_FORMAT, tag, message);
|
AZ::Debug::Trace::Instance().Error(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE, AWSLogSystemInterface::ERROR_WINDOW_NAME, MESSAGE_FORMAT, tag, message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Aws::Utils::Logging::LogLevel::Warn:
|
case Aws::Utils::Logging::LogLevel::Warn:
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ namespace AWSNativeSDKInit
|
|||||||
{
|
{
|
||||||
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
||||||
Aws::Utils::Logging::LogLevel logLevel;
|
Aws::Utils::Logging::LogLevel logLevel;
|
||||||
#ifdef _DEBUG
|
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
|
||||||
logLevel = Aws::Utils::Logging::LogLevel::Warn;
|
logLevel = Aws::Utils::Logging::LogLevel::Warn;
|
||||||
#else
|
#else
|
||||||
logLevel = Aws::Utils::Logging::LogLevel::Warn;
|
logLevel = Aws::Utils::Logging::LogLevel::Error;
|
||||||
#endif
|
#endif
|
||||||
m_awsSDKOptions.loggingOptions.logLevel = logLevel;
|
m_awsSDKOptions.loggingOptions.logLevel = logLevel;
|
||||||
m_awsSDKOptions.loggingOptions.logger_create_fn = [logLevel]()
|
m_awsSDKOptions.loggingOptions.logger_create_fn = [logLevel]()
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
/*
|
||||||
|
* 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/Console/Console.h>
|
||||||
|
#include <AzCore/Console/IConsole.h>
|
||||||
|
#include <AzCore/Interface/Interface.h>
|
||||||
|
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||||
|
#include <AzCore/UnitTest/TestTypes.h>
|
||||||
|
|
||||||
|
#include <AWSNativeSDKInit/AWSLogSystemInterface.h>
|
||||||
|
|
||||||
|
#include <aws/core/utils/logging/LogLevel.h>
|
||||||
|
|
||||||
|
using namespace AWSNativeSDKInit;
|
||||||
|
|
||||||
|
class AWSLogSystemInterfaceTest
|
||||||
|
: public UnitTest::ScopedAllocatorSetupFixture
|
||||||
|
, public AZ::Debug::TraceMessageBus::Handler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool OnPreAssert(const char*, int, const char*, const char*) override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnPreError(const char*, const char*, int, const char*, const char*) override
|
||||||
|
{
|
||||||
|
m_error = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnPreWarning(const char*, const char*, int, const char*, const char*) override
|
||||||
|
{
|
||||||
|
m_warning = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnPrintf(const char*, const char*) override
|
||||||
|
{
|
||||||
|
m_printf = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUp() override
|
||||||
|
{
|
||||||
|
BusConnect();
|
||||||
|
if (!AZ::Interface<AZ::IConsole>::Get())
|
||||||
|
{
|
||||||
|
m_console = AZStd::make_unique<AZ::Console>();
|
||||||
|
m_console->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead());
|
||||||
|
AZ::Interface<AZ::IConsole>::Register(m_console.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() override
|
||||||
|
{
|
||||||
|
if (m_console)
|
||||||
|
{
|
||||||
|
AZ::Interface<AZ::IConsole>::Unregister(m_console.get());
|
||||||
|
m_console.reset();
|
||||||
|
}
|
||||||
|
BusDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool m_error = false;
|
||||||
|
bool m_warning = false;
|
||||||
|
bool m_printf = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
AZStd::unique_ptr<AZ::Console> m_console;
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogFatalMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Fatal, "test", testString);
|
||||||
|
ASSERT_TRUE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_FALSE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogErrorMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Error, "test", testString);
|
||||||
|
ASSERT_TRUE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_FALSE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogWarningMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Warn, "test", testString);
|
||||||
|
ASSERT_FALSE(m_error);
|
||||||
|
ASSERT_TRUE(m_warning);
|
||||||
|
ASSERT_FALSE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogInfoMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString);
|
||||||
|
ASSERT_FALSE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_TRUE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogDebugMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Debug, "test", testString);
|
||||||
|
ASSERT_FALSE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_TRUE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogTraceMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Trace, "test", testString);
|
||||||
|
ASSERT_FALSE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_TRUE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideWarnAndLogInfoMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
AZ::Interface<AZ::IConsole>::Get()->PerformCommand("bg_awsLogLevel 3");
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString);
|
||||||
|
ASSERT_FALSE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_FALSE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideWarnAndLogeErrorMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
AZ::Interface<AZ::IConsole>::Get()->PerformCommand("bg_awsLogLevel 3");
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Error, "test", testString);
|
||||||
|
ASSERT_TRUE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_FALSE(m_printf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideOffAndLogInfoMessage_GetExpectedNotification)
|
||||||
|
{
|
||||||
|
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
|
||||||
|
Aws::OStringStream testString;
|
||||||
|
AZ::Interface<AZ::IConsole>::Get()->PerformCommand("bg_awsLogLevel 0");
|
||||||
|
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString);
|
||||||
|
ASSERT_FALSE(m_error);
|
||||||
|
ASSERT_FALSE(m_warning);
|
||||||
|
ASSERT_FALSE(m_printf);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* 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 <AzTest/AzTest.h>
|
||||||
|
|
||||||
|
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
|
||||||
@@ -140,7 +140,9 @@ TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetIdEr
|
|||||||
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0);
|
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0);
|
||||||
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0);
|
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0);
|
||||||
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1);
|
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1);
|
||||||
|
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||||
m_mockController->RequestAWSCredentialsAsync();
|
m_mockController->RequestAWSCredentialsAsync();
|
||||||
|
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCredentialsForIdentityError)
|
TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCredentialsForIdentityError)
|
||||||
@@ -174,7 +176,9 @@ TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCred
|
|||||||
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(1).WillOnce(testing::Return(outcome));
|
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(1).WillOnce(testing::Return(outcome));
|
||||||
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0);
|
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0);
|
||||||
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1);
|
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1);
|
||||||
|
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||||
m_mockController->RequestAWSCredentialsAsync();
|
m_mockController->RequestAWSCredentialsAsync();
|
||||||
|
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AWSCognitoAuthorizationControllerTest, AddRemoveLogins_Succuess)
|
TEST_F(AWSCognitoAuthorizationControllerTest, AddRemoveLogins_Succuess)
|
||||||
@@ -331,8 +335,10 @@ TEST_F(AWSCognitoAuthorizationControllerTest, GetCredentialsProvider_NoPersisted
|
|||||||
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0);
|
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0);
|
||||||
|
|
||||||
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> actualCredentialsProvider;
|
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> actualCredentialsProvider;
|
||||||
|
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||||
AWSCore::AWSCredentialRequestBus::BroadcastResult(
|
AWSCore::AWSCredentialRequestBus::BroadcastResult(
|
||||||
actualCredentialsProvider, &AWSCore::AWSCredentialRequests::GetCredentialsProvider);
|
actualCredentialsProvider, &AWSCore::AWSCredentialRequests::GetCredentialsProvider);
|
||||||
|
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
|
||||||
EXPECT_TRUE(actualCredentialsProvider == nullptr);
|
EXPECT_TRUE(actualCredentialsProvider == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
set(awsgameliftclient_compile_definition $<IF:$<CONFIG:release>,AWSGAMELIFT_RELEASE,AWSGAMELIFT_DEV>)
|
|
||||||
|
|
||||||
ly_add_target(
|
ly_add_target(
|
||||||
NAME AWSGameLift.Client.Static STATIC
|
NAME AWSGameLift.Client.Static STATIC
|
||||||
NAMESPACE Gem
|
NAMESPACE Gem
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
namespace AWSGameLift
|
namespace AWSGameLift
|
||||||
{
|
{
|
||||||
#if defined(AWSGAMELIFT_DEV)
|
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
|
||||||
AZ_CVAR(AZ::CVarFixedString, cl_gameliftLocalEndpoint, "", nullptr, AZ::ConsoleFunctorFlags::Null, "The local endpoint to test with GameLiftLocal SDK.");
|
AZ_CVAR(AZ::CVarFixedString, cl_gameliftLocalEndpoint, "", nullptr, AZ::ConsoleFunctorFlags::Null, "The local endpoint to test with GameLiftLocal SDK.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ namespace AWSGameLift
|
|||||||
|
|
||||||
// Set up client endpoint or region
|
// Set up client endpoint or region
|
||||||
AZStd::string localEndpoint = "";
|
AZStd::string localEndpoint = "";
|
||||||
#if defined(AWSGAMELIFT_DEV)
|
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
|
||||||
localEndpoint = static_cast<AZ::CVarFixedString>(cl_gameliftLocalEndpoint);
|
localEndpoint = static_cast<AZ::CVarFixedString>(cl_gameliftLocalEndpoint);
|
||||||
#endif
|
#endif
|
||||||
if (!localEndpoint.empty())
|
if (!localEndpoint.empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user