diff --git a/aws-encryption-sdk-cpp/tests/test_vectors/static_test_vectors.cpp b/aws-encryption-sdk-cpp/tests/test_vectors/static_test_vectors.cpp index f6c2fe3ee..9ab6549a9 100644 --- a/aws-encryption-sdk-cpp/tests/test_vectors/static_test_vectors.cpp +++ b/aws-encryption-sdk-cpp/tests/test_vectors/static_test_vectors.cpp @@ -34,6 +34,7 @@ #include #include +#include #include "credential_reusing_client_supplier.h" #include "testing.h" @@ -435,6 +436,14 @@ static int run_test_decryption( return result; } +static void kms_delay(test_type test_type_idx) { + static int tenth_second_in_millis = 100; + if ((test_type_idx == AWS_CRYPTOSDK_KMS) || (test_type_idx == AWS_CRYPTOSDK_KMS_MRK_AWARE) || + (test_type_idx == AWS_CRYPTOSDK_KMS_MRK_AWARE_DISCOVERY)) { + usleep(tenth_second_in_millis); + } +} + static int process_test_scenarios( struct aws_allocator *alloc, struct expected_outcome expected, @@ -459,6 +468,7 @@ static int process_test_scenarios( bool not_supported; struct aws_cryptosdk_keyring *kr = keyring_for_master_key_spec( alloc, json_obj_mk_obj, keys_obj, test_type_idx, not_supported, client_supplier); + kms_delay(test_type_idx); if (!kr) { if (expected.success) { if (not_supported) {