diff --git a/integration-tests/source/GTestMain.cpp b/integration-tests/source/GTestMain.cpp index 301485b6..61b752a6 100644 --- a/integration-tests/source/GTestMain.cpp +++ b/integration-tests/source/GTestMain.cpp @@ -17,6 +17,7 @@ static constexpr char FLEET_PROVISIONING_RUNTIME_CONFIG_FILE[] = static constexpr char CLI_THING_NAME[] = "--thing-name"; static constexpr char CLI_REGION[] = "--region"; static constexpr char CLI_PORT[] = "--port"; +static constexpr char CLI_LOCAL_PROXY_PATH[] = "--localproxy"; static constexpr char CLI_CLEAN_UP[] = "--clean-up"; static constexpr char CLI_SKIP_ST[] = "--skip-st"; static constexpr char CLI_HELP[] = "--help"; @@ -24,6 +25,7 @@ static constexpr char CLI_HELP[] = "--help"; std::string THING_NAME; std::string REGION = "us-east-1"; std::string PORT = "5555"; +std::string LOCAL_PROXY_PATH = "/localproxy"; bool CLEAN_UP = false; bool SKIP_FP = false; bool SKIP_ST = false; @@ -65,6 +67,7 @@ void PrintHelp() printf("--thing-name Thing Group ARN to run the tests against\n"); printf("--region The AWS Region to run the tests. Example: us-east-1\n"); printf("--port The local port to run Local Proxy.\n"); + printf("--localproxy Path to local proxy binary for Secure Tunneling tests.\n"); printf("--skip-st Skip Secure Tunneling integration tests\n"); printf( "--clean-up (Caution) Pass this flag kill to Device Client on the devices delete the provisioned IoT " @@ -91,6 +94,10 @@ bool parseCliArgs(int argc, char **argv) { PORT = argv[++i]; } + else if (currentArg == CLI_LOCAL_PROXY_PATH) + { + LOCAL_PROXY_PATH = argv[++i]; + } else if (currentArg == CLI_SKIP_ST) { SKIP_ST = true; diff --git a/integration-tests/source/IntegrationTestResourceHandler.cpp b/integration-tests/source/IntegrationTestResourceHandler.cpp index 661f1509..418aa2af 100644 --- a/integration-tests/source/IntegrationTestResourceHandler.cpp +++ b/integration-tests/source/IntegrationTestResourceHandler.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -299,11 +300,24 @@ void IntegrationTestResourceHandler::CloseTunnel(const string &tunnelId) ioTSecureTunnelingClient.CloseTunnel(request); } -std::string IntegrationTestResourceHandler::GetTargetArn(const std::string &target) +std::string IntegrationTestResourceHandler::GetTargetArn(const std::string &thingName) { + std::string arn; + DescribeThingRequest request; - request.SetThingName(target); - return iotClient.DescribeThing(request).GetResult().GetThingArn(); + request.SetThingName(thingName); + + DescribeThingOutcome outcome = iotClient.DescribeThing(request); + + if (!outcome.IsSuccess()) + { + printf("Failed to Describe Thing: %s\n%s\n", thingName.c_str(), outcome.GetError().GetMessage().c_str()); + } + else + { + arn = outcome.GetResult().GetThingArn(); + } + return arn; } std::string IntegrationTestResourceHandler::GetResourceId(const std::string &resource) { diff --git a/integration-tests/source/IntegrationTestResourceHandler.h b/integration-tests/source/IntegrationTestResourceHandler.h index 7b650419..03dfb4ad 100644 --- a/integration-tests/source/IntegrationTestResourceHandler.h +++ b/integration-tests/source/IntegrationTestResourceHandler.h @@ -26,7 +26,7 @@ class IntegrationTestResourceHandler void CleanUpThingAndCert(const std::string &thingName); std::string GetTimeStamp(); Aws::IoT::Model::JobExecutionStatus GetJobExecutionStatusWithRetry(const std::string &jobId); - std::string GetTargetArn(const std::string &target); + std::string GetTargetArn(const std::string &thingName); protected: Aws::IoT::IoTClient iotClient; diff --git a/integration-tests/source/tunneling/SecureTunnelingIntegrationTests.cpp b/integration-tests/source/tunneling/SecureTunnelingIntegrationTests.cpp index 3f121acc..81b3e181 100644 --- a/integration-tests/source/tunneling/SecureTunnelingIntegrationTests.cpp +++ b/integration-tests/source/tunneling/SecureTunnelingIntegrationTests.cpp @@ -22,8 +22,8 @@ extern string THING_NAME; extern string PORT; extern string REGION; extern bool SKIP_ST; +extern string LOCAL_PROXY_PATH; -const string LOCAL_PROXY_PATH = "/localproxy"; const string TEST_TUNNEL_PATH = "/test-tunnel.sh"; class TestSecureTunnelingFixture : public ::testing::Test @@ -67,6 +67,7 @@ class TestSecureTunnelingFixture : public ::testing::Test } else { + printf("Skipping Secure Tunneling Tests\n"); GTEST_SKIP(); } }