Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: kms delay #758

Merged
merged 3 commits into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include <json-c/json.h>
#include <json-c/json_object.h>
#include <unistd.h>

#include "credential_reusing_client_supplier.h"
#include "testing.h"
Expand Down Expand Up @@ -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,
Expand All @@ -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) {
Expand Down