Skip to content

Commit

Permalink
Adding CI artifacts to gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
sdavtaker committed Mar 21, 2021
1 parent f6228b5 commit 92f5622
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Release
*.iml
tags

# CI Artifacts
BuildSpec.json
BuildSpec.zip

#vim swap file
*.swp

Expand Down
28 changes: 18 additions & 10 deletions aws-cpp-sdk-core-tests/http/HttpClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <future>
#include <chrono>

#ifdef ENABLE_CURL_CLIENT
#if defined(ENABLE_CURL_CLIENT) && ! defined(__ANDROID__)
#include <curl/curl.h>
#endif

Expand All @@ -23,10 +23,10 @@ using namespace Aws::Utils;
using namespace Aws::Client;

#ifndef NO_HTTP_CLIENT
static const Aws::String randomUri = "http://some.unknown1234xxx.test.aws";
static const Aws::String randomDomain = "some.unknown1234xxx.test.aws";
static const char randomUri[] = "http://some.unknown1234xxx.test.aws";
static const char randomDomain[] = "some.unknown1234xxx.test.aws";

#ifdef ENABLE_CURL_CLIENT
#if defined(ENABLE_CURL_CLIENT) && ! defined(__ANDROID__)
static void assertErrorMessageIsPrefixedWithCurlErrorCode(int curlErrorCode, const Aws::String& errorMessage){
Aws::StringStream ss;
ss << "curlCode: ";
Expand All @@ -41,32 +41,30 @@ static void assertErrorMessageIsPrefixedWithCurlErrorCode(int curlErrorCode, con
}
}
}
#endif //ENABLE_CURL_CLIENT
#endif //ENABLE_CURL_CLIENT AND NOT ANDROID

static void makeRandomHttpRequest(std::shared_ptr<HttpClient> httpClient, bool expectProxyError)
{
auto request = CreateHttpRequest(randomUri,HttpMethod::HTTP_GET, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
auto request = CreateHttpRequest(Aws::String(randomUri),HttpMethod::HTTP_GET, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
auto response = httpClient->MakeRequest(request);
ASSERT_NE(nullptr, response);
//Modified the tests so that we catch an edge case where ISP's would try to get a response to the weird url
//by doing a search instead of failing, we've had 2 issues where they get forbidden instead: #1305 & #1051
if(expectProxyError)
{
ASSERT_TRUE(response->HasClientError());
AWS_LOGSTREAM_DEBUG("HTTP_CLIENT_TEST_NEW", "Has error: " << response->GetClientErrorMessage());
ASSERT_EQ(CoreErrors::NETWORK_CONNECTION, response->GetClientErrorType());
ASSERT_EQ(Aws::Http::HttpResponseCode::REQUEST_NOT_MADE, response->GetResponseCode());
#ifdef ENABLE_CURL_CLIENT
#if defined(ENABLE_CURL_CLIENT) && ! defined(__ANDROID__)
assertErrorMessageIsPrefixedWithCurlErrorCode(CURLE_OPERATION_TIMEDOUT, response->GetClientErrorMessage());
#endif
}
else
{
if (response->HasClientError()) {
AWS_LOGSTREAM_DEBUG("HTTP_CLIENT_TEST_OLD", "Has error: " << response->GetClientErrorMessage());
ASSERT_EQ(CoreErrors::NETWORK_CONNECTION, response->GetClientErrorType());
ASSERT_EQ(Aws::Http::HttpResponseCode::REQUEST_NOT_MADE, response->GetResponseCode());
#ifdef ENABLE_CURL_CLIENT
#if defined(ENABLE_CURL_CLIENT) && ! defined(__ANDROID__)
assertErrorMessageIsPrefixedWithCurlErrorCode(CURLE_COULDNT_RESOLVE_HOST, response->GetClientErrorMessage());
#endif
}
Expand Down Expand Up @@ -102,6 +100,16 @@ TEST(HttpClientTest, TestRandomURLWithProxy)
}

TEST(HttpClientTest, TestRandomURLWithProxyAndDeclaredAsNonProxyHost)
{
ClientConfiguration configuration = makeClientConfigurationWithProxy();
configuration.nonProxyHosts = Aws::Utils::Array<Aws::String>(2);
configuration.nonProxyHosts[0] = "test.aws";
configuration.nonProxyHosts[1] = "test.non.filtered.aws";
auto httpClient = CreateHttpClient(configuration);
makeRandomHttpRequest(httpClient, false);
}

TEST(HttpClientTest, TestRandomURLWithProxyAndDeclaredParentDomainAsNonProxyHost)
{
ClientConfiguration configuration = makeClientConfigurationWithProxy();
configuration.nonProxyHosts = Aws::Utils::Array<Aws::String>(2);
Expand Down

0 comments on commit 92f5622

Please sign in to comment.