diff --git a/src/aws-cpp-sdk-core/include/aws/core/utils/Outcome.h b/src/aws-cpp-sdk-core/include/aws/core/utils/Outcome.h index 70e9e4be262..440ff1fd987 100644 --- a/src/aws-cpp-sdk-core/include/aws/core/utils/Outcome.h +++ b/src/aws-cpp-sdk-core/include/aws/core/utils/Outcome.h @@ -101,6 +101,7 @@ namespace Aws result = o.result; error = o.error; success = o.success; + retryCount = o.retryCount; } return *this; @@ -109,7 +110,8 @@ namespace Aws Outcome(Outcome&& o) : // Required to force Move Constructor result(std::move(o.result)), error(std::move(o.error)), - success(o.success) + success(o.success), + retryCount(std::move(o.retryCount)) { } @@ -120,6 +122,7 @@ namespace Aws result = std::move(o.result); error = std::move(o.error); success = o.success; + retryCount = std::move(o.retryCount); } return *this; @@ -160,10 +163,20 @@ namespace Aws return this->success; } + /** + * Returns how many times the retry happened before getting this outcome. + */ + inline unsigned int GetRetryCount() const { return retryCount; } + /** + * Sets the retry count. + */ + inline void SetRetryCount(const unsigned int iRetryCount) { retryCount = iRetryCount; } + private: R result; E error; - bool success; + bool success = false; + unsigned int retryCount = 0; }; } // namespace Utils diff --git a/src/aws-cpp-sdk-core/source/client/AWSClient.cpp b/src/aws-cpp-sdk-core/source/client/AWSClient.cpp index 5d8a7a9e8a4..c67d5311cf2 100644 --- a/src/aws-cpp-sdk-core/source/client/AWSClient.cpp +++ b/src/aws-cpp-sdk-core/source/client/AWSClient.cpp @@ -278,6 +278,7 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri, httpRequest->SetEventStreamRequest(request.IsEventStreamRequest()); outcome = AttemptOneRequest(httpRequest, request, signerName, signerRegion, signerServiceNameOverride); + outcome.SetRetryCount(retries); if (retries == 0) { m_retryStrategy->RequestBookkeeping(outcome); @@ -422,6 +423,7 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri, }; outcome = AttemptOneRequest(httpRequest, signerName, requestName, signerRegion, signerServiceNameOverride); + outcome.SetRetryCount(retries); if (retries == 0) { m_retryStrategy->RequestBookkeeping(outcome); diff --git a/tests/aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp b/tests/aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp index c827a7b5e5c..8b606f36d36 100644 --- a/tests/aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp +++ b/tests/aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp @@ -99,19 +99,28 @@ namespace void EnsureUniqueBucketNames() { - AppendUUID(BASE_CREATE_BUCKET_TEST_NAME); - AppendUUID(BASE_DNS_UNFRIENDLY_TEST_NAME); - AppendUUID(BASE_LOCATION_BUCKET_TEST_NAME); - AppendUUID(BASE_OBJECTS_BUCKET_NAME); - AppendUUID(BASE_OBJECTS_DEFAULT_CTOR_BUCKET_NAME); - AppendUUID(BASE_PUT_OBJECTS_BUCKET_NAME); - AppendUUID(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME); - AppendUUID(BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME); - AppendUUID(BASE_PUT_MULTIPART_BUCKET_NAME); - AppendUUID(BASE_ERRORS_TESTING_BUCKET); - AppendUUID(BASE_EVENT_STREAM_TEST_BUCKET_NAME); - AppendUUID(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME); - AppendUUID(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME); + Aws::Vector> TEST_BUCKETS = + { + std::ref(BASE_CREATE_BUCKET_TEST_NAME), + std::ref(BASE_DNS_UNFRIENDLY_TEST_NAME), + std::ref(BASE_LOCATION_BUCKET_TEST_NAME), + std::ref(BASE_OBJECTS_BUCKET_NAME), + std::ref(BASE_OBJECTS_DEFAULT_CTOR_BUCKET_NAME), + std::ref(BASE_PUT_OBJECTS_BUCKET_NAME), + std::ref(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME), + std::ref(BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME), + std::ref(BASE_PUT_MULTIPART_BUCKET_NAME), + std::ref(BASE_ERRORS_TESTING_BUCKET), + std::ref(BASE_EVENT_STREAM_TEST_BUCKET_NAME), + std::ref(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME), + std::ref(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME) + }; + + for (auto& testBucketName : TEST_BUCKETS) + { + AppendUUID(testBucketName); + SCOPED_TRACE(Aws::String("EnsureUniqueBucketNames: ") + testBucketName.get()); + } } class RetryFiveTimesRetryStrategy: public Aws::Client::RetryStrategy @@ -357,6 +366,7 @@ namespace static Aws::String PreparePresignedUrlTest() { Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -409,6 +419,7 @@ namespace static void CleanUpPresignedUrlTest() { Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlDelete = Client->GeneratePresignedUrl(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_DELETE); std::shared_ptr deleteRequest = CreateHttpRequest(presignedUrlDelete, HttpMethod::HTTP_DELETE, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); std::shared_ptr deleteResponse = m_HttpClient->MakeRequest(deleteRequest); @@ -425,6 +436,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestBucketOperationsErrorWithMissingRequiredFields) { Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); HeadBucketRequest headBucketRequest; HeadBucketOutcome headBucketOutcome = Client->HeadBucket(headBucketRequest); ASSERT_FALSE(headBucketOutcome.IsSuccess()); @@ -438,8 +450,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestBucketCreationAndListing) { - Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -477,6 +489,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestBucketLocation) { Aws::String fullBucketName = CalculateBucketName(BASE_LOCATION_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); CreateBucketConfiguration bucketConfiguration; @@ -505,8 +518,8 @@ namespace // S3 CRT Client could not handle these special characters in key name right now. TEST_F(BucketAndObjectOperationTest, TestPutWithSpecialCharactersInKeyName) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -531,8 +544,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperations) { - Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -605,8 +618,8 @@ namespace //Create Client with default constructor Client = Aws::MakeShared(ALLOCATION_TAG); - Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_DEFAULT_CTOR_BUCKET_NAME); - + const Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_DEFAULT_CTOR_BUCKET_NAME); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -675,8 +688,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestKeysWithCrazyCharacterSets) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -742,6 +755,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrls) { Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlPut = Client->GeneratePresignedUrl(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_PUT); std::shared_ptr putRequest = CreateHttpRequest(presignedUrlPut, HttpMethod::HTTP_PUT, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); DoPresignedUrlTest(fullBucketName, putRequest); @@ -751,6 +765,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsAndCustomizedHeaders) { Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::Http::HeaderValueCollection collections; collections.emplace("TestKey1", "TestVal1"); collections.emplace("TestKey2", "TestVal2"); @@ -768,6 +783,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSES3) { Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlPut = Client->GeneratePresignedUrlWithSSES3(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_PUT); std::shared_ptr putRequest = CreateHttpRequest(presignedUrlPut, HttpMethod::HTTP_PUT, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); putRequest->SetHeaderValue(Aws::S3Crt::SSEHeaders::SERVER_SIDE_ENCRYPTION, @@ -779,6 +795,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSES3AndCustomizedHeaders) { Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::Http::HeaderValueCollection collections; collections.emplace("TestKey1", "TestVal1"); collections.emplace("TestKey2", "TestVal2"); @@ -798,6 +815,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSEKMS) { Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlPut = Client->GeneratePresignedUrlWithSSEKMS(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_PUT); //Using default KMS key in this AWS account std::shared_ptr putRequest = CreateHttpRequest(presignedUrlPut, HttpMethod::HTTP_PUT, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); putRequest->SetHeaderValue(Aws::S3Crt::SSEHeaders::SERVER_SIDE_ENCRYPTION, @@ -810,6 +828,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSEKMSAndCustomizedHeaders) { Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::Http::HeaderValueCollection collections; collections.emplace("TestKey1", "TestVal1"); collections.emplace("TestKey2", "TestVal2"); @@ -828,8 +847,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestThatErrorsParse) { - Aws::String fullBucketName = CalculateBucketName(BASE_ERRORS_TESTING_BUCKET.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_ERRORS_TESTING_BUCKET.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); ListObjectsRequest listObjectsRequest; listObjectsRequest.SetBucket("abcdedoikengi"); @@ -860,6 +879,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestNotModifiedIsSuccess) { Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -895,6 +915,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestVirtualAddressingWithUnfriendlyBucketName) { Aws::String fullBucketName = CalculateBucketName(BASE_DNS_UNFRIENDLY_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -928,6 +949,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestCopyingFromKeysWithUnicodeCharacters) { Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -962,6 +984,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationWithEventStream) { Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1041,6 +1064,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestSelectObjectOperationWithEventStreamFailWithRetry) { Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1116,6 +1140,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestEventStreamWithLargeFile) { Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1221,6 +1246,7 @@ namespace TEST_F(BucketAndObjectOperationTest, TestErrorsInEventStream) { Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1290,8 +1316,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestEmptyBody) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); diff --git a/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp b/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp index f67f31c6ab5..54859198b5d 100644 --- a/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp +++ b/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp @@ -114,24 +114,32 @@ namespace void EnsureUniqueBucketNames() { - AppendUUID(BASE_CREATE_BUCKET_TEST_NAME); - AppendUUID(BASE_DNS_UNFRIENDLY_TEST_NAME); - AppendUUID(BASE_LOCATION_BUCKET_TEST_NAME); - AppendUUID(BASE_OBJECTS_BUCKET_NAME); - AppendUUID(BASE_OBJECTS_NEWLINE_BUCKET_NAME); - AppendUUID(BASE_PUT_OBJECTS_BUCKET_NAME); - AppendUUID(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME); - AppendUUID(BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME); - AppendUUID(BASE_PUT_MULTIPART_BUCKET_NAME); - AppendUUID(BASE_OBJECT_LOCK_BUCKET_NAME); - AppendUUID(BASE_ERRORS_TESTING_BUCKET); - AppendUUID(BASE_INTERRUPT_TESTING_BUCKET); - AppendUUID(BASE_EVENT_STREAM_TEST_BUCKET_NAME); - AppendUUID(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME); - AppendUUID(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME); - AppendUUID(BASE_CHECKSUMS_BUCKET_NAME); - AppendUUID(BASE_CROSS_REGION_BUCKET_NAME); - AppendUUID(BASE_ENDPOINT_OVERRIDE_BUCKET_NAME); + Aws::Vector> TEST_BUCKETS = + { + std::ref(BASE_CREATE_BUCKET_TEST_NAME), + std::ref(BASE_DNS_UNFRIENDLY_TEST_NAME), + std::ref(BASE_LOCATION_BUCKET_TEST_NAME), + std::ref(BASE_OBJECTS_BUCKET_NAME), + std::ref(BASE_OBJECTS_NEWLINE_BUCKET_NAME), + std::ref(BASE_PUT_OBJECTS_BUCKET_NAME), + std::ref(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME), + std::ref(BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME), + std::ref(BASE_PUT_MULTIPART_BUCKET_NAME), + std::ref(BASE_OBJECT_LOCK_BUCKET_NAME), + std::ref(BASE_ERRORS_TESTING_BUCKET), + std::ref(BASE_INTERRUPT_TESTING_BUCKET), + std::ref(BASE_EVENT_STREAM_TEST_BUCKET_NAME), + std::ref(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME), + std::ref(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME), + std::ref(BASE_CHECKSUMS_BUCKET_NAME), + std::ref(BASE_CROSS_REGION_BUCKET_NAME), + std::ref(BASE_ENDPOINT_OVERRIDE_BUCKET_NAME), + }; + + for (auto& testBucketName : TEST_BUCKETS) + { + AppendUUID(testBucketName); + } } class RetryFiveTimesRetryStrategy: public Aws::Client::RetryStrategy @@ -500,7 +508,8 @@ namespace void DoTestObjectOperationsWithPresignedUrlsWithSSEC(bool withCustomizedHeaders) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); std::shared_ptr objectStream = Aws::MakeShared("BucketAndObjectOperationTest"); *objectStream << "Test Object"; objectStream->flush(); @@ -659,7 +668,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestInterrupt) { - Aws::String fullBucketName = CalculateBucketName(BASE_INTERRUPT_TESTING_BUCKET.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_INTERRUPT_TESTING_BUCKET.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -712,7 +722,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestBucketOperationsErrorWithMissingRequiredFields) { - Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); HeadBucketRequest headBucketRequest; HeadBucketOutcome headBucketOutcome = Client->HeadBucket(headBucketRequest); ASSERT_FALSE(headBucketOutcome.IsSuccess()); @@ -726,7 +737,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestBucketCreationAndListing) { - Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); @@ -764,7 +776,8 @@ namespace //Create a bucket somewhere other than US Standard and ensure the location is correctly shown later TEST_F(BucketAndObjectOperationTest, TestBucketLocation) { - Aws::String fullBucketName = CalculateBucketName(BASE_LOCATION_BUCKET_TEST_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_LOCATION_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); CreateBucketConfiguration bucketConfiguration; @@ -792,7 +805,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestPutWithSpecialCharactersInKeyName) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); @@ -818,8 +832,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestKeysWithNewlineCharacterSets) { - Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_NEWLINE_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_NEWLINE_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -887,8 +901,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperations) { - Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -974,8 +988,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestKeysWithCrazyCharacterSets) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME.c_str()); - + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1040,7 +1054,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrls) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlPut = Client->GeneratePresignedUrl(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_PUT); std::shared_ptr putRequest = CreateHttpRequest(presignedUrlPut, HttpMethod::HTTP_PUT, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); DoPresignedUrlTest(fullBucketName, putRequest); @@ -1049,7 +1064,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsAndCustomizedHeaders) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::Http::HeaderValueCollection collections; collections.emplace("TestKey1", "TestVal1"); collections.emplace("TestKey2", "TestVal2"); @@ -1066,7 +1082,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSES3) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlPut = Client->GeneratePresignedUrlWithSSES3(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_PUT); std::shared_ptr putRequest = CreateHttpRequest(presignedUrlPut, HttpMethod::HTTP_PUT, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); putRequest->SetHeaderValue(Aws::S3::SSEHeaders::SERVER_SIDE_ENCRYPTION, @@ -1077,7 +1094,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSES3AndCustomizedHeaders) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::Http::HeaderValueCollection collections; collections.emplace("TestKey1", "TestVal1"); collections.emplace("TestKey2", "TestVal2"); @@ -1096,7 +1114,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSEKMS) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::String presignedUrlPut = Client->GeneratePresignedUrlWithSSEKMS(fullBucketName, TEST_OBJ_KEY, HttpMethod::HTTP_PUT); //Using default KMS key in this AWS account std::shared_ptr putRequest = CreateHttpRequest(presignedUrlPut, HttpMethod::HTTP_PUT, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod); putRequest->SetHeaderValue(Aws::S3::SSEHeaders::SERVER_SIDE_ENCRYPTION, @@ -1108,7 +1127,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationsWithPresignedUrlsWithSSEKMSAndCustomizedHeaders) { - Aws::String fullBucketName = PreparePresignedUrlTest(); + const Aws::String fullBucketName = PreparePresignedUrlTest(); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::Http::HeaderValueCollection collections; collections.emplace("TestKey1", "TestVal1"); collections.emplace("TestKey2", "TestVal2"); @@ -1139,7 +1159,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestMultiPartObjectOperations) { const char* multipartKeyName = "MultiPartKey"; - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_MULTIPART_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_MULTIPART_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1363,7 +1384,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestThatErrorsParse) { - Aws::String fullBucketName = CalculateBucketName(BASE_ERRORS_TESTING_BUCKET.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_ERRORS_TESTING_BUCKET.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); ListObjectsRequest listObjectsRequest; listObjectsRequest.SetBucket("abcdedoikengi"); @@ -1399,7 +1421,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestNotModifiedIsSuccess) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1434,7 +1457,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestVirtualAddressingWithUnfriendlyBucketName) { - Aws::String fullBucketName = CalculateBucketName(BASE_DNS_UNFRIENDLY_TEST_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_DNS_UNFRIENDLY_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1463,7 +1487,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestCopyingFromKeysWithUnicodeCharacters) { - Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_CREATE_BUCKET_TEST_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1497,7 +1522,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectLock) { - Aws::String fullBucketName = CalculateBucketName(BASE_OBJECT_LOCK_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_OBJECT_LOCK_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1543,7 +1569,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestObjectOperationWithEventStream) { - Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_TEST_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1620,7 +1647,8 @@ namespace // This test is to test failed event stream request will not cause crash during retry. TEST_F(BucketAndObjectOperationTest, TestSelectObjectOperationWithEventStreamFailWithRetry) { - Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_TEST_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1694,7 +1722,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestEventStreamWithLargeFile) { - Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1799,7 +1828,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestErrorsInEventStream) { - Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); @@ -1869,7 +1899,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestFlexibleChecksums) { - Aws::String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); @@ -1951,7 +1982,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestMultipartFlexibleChecksums) { const char* multipartKeyName = "MultiPartKey"; - Aws::String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); @@ -2033,7 +2065,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestCrossRegionOperations) { - Aws::String fullBucketName = CalculateBucketName(BASE_CROSS_REGION_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_CROSS_REGION_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); @@ -2065,7 +2098,8 @@ namespace TEST_F(BucketAndObjectOperationTest, TestCustomEndpointOverride) { - Aws::String fullBucketName = CalculateBucketName(BASE_ENDPOINT_OVERRIDE_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_ENDPOINT_OVERRIDE_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); Aws::StringStream ss; // Traditional bucket name with virtual addressing @@ -2349,7 +2383,8 @@ namespace } TEST_F(BucketAndObjectOperationTest, TestEmptyBody) { - Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); diff --git a/tests/testing-resources/include/aws/testing/AwsTestHelpers.h b/tests/testing-resources/include/aws/testing/AwsTestHelpers.h index 1c95b400af8..89c4c446be0 100644 --- a/tests/testing-resources/include/aws/testing/AwsTestHelpers.h +++ b/tests/testing-resources/include/aws/testing/AwsTestHelpers.h @@ -16,10 +16,12 @@ #define AWS_ASSERT_SUCCESS(awsCppSdkOutcome) \ ASSERT_TRUE(awsCppSdkOutcome.IsSuccess()) << "Error details: " << awsCppSdkOutcome.GetError() \ + << "\nRetries: " << awsCppSdkOutcome.GetRetryCount() \ << "\nNow timestamp: " << Aws::Utils::DateTime::Now().ToGmtString(Aws::Utils::DateFormat::ISO_8601_BASIC) #define AWS_EXPECT_SUCCESS(awsCppSdkOutcome) \ EXPECT_TRUE(awsCppSdkOutcome.IsSuccess()) << "Error details: " << awsCppSdkOutcome.GetError() \ + << "\nRetries: " << awsCppSdkOutcome.GetRetryCount() \ << "\nNow timestamp: " << Aws::Utils::DateTime::Now().ToGmtString(Aws::Utils::DateFormat::ISO_8601_BASIC) /**