Increases initialization timeout

This commit is contained in:
Aleksey Kashapov 2023-10-26 18:59:48 +03:00
parent 38741021dd
commit bdef878eb5
No known key found for this signature in database
GPG Key ID: E7A24E92707DA3D0
4 changed files with 13 additions and 21 deletions

View File

@ -99,7 +99,7 @@ start_clear(Config) ->
{keyring_rotation_lifetime, 1000}, {keyring_rotation_lifetime, 1000},
{keyring_unlock_lifetime, 1000}, {keyring_unlock_lifetime, 1000},
{keyring_rekeying_lifetime, 3000}, {keyring_rekeying_lifetime, 3000},
{keyring_initialize_lifetime, 3000}, {keyring_initialize_lifetime, 10000},
{shareholders, #{ {shareholders, #{
<<"1">> => #{ <<"1">> => #{
owner => <<"ndiezel">>, owner => <<"ndiezel">>,

View File

@ -139,29 +139,17 @@ end_per_group(_, C) ->
-spec init(config()) -> _. -spec init(config()) -> _.
init(C) -> init(C) ->
Threshold = 2, Threshold = 2,
EncryptedMasterKeyShares = kds_keyring_client:start_init(Threshold, root_url(C)),
Shareholders = kds_shareholder:get_all(), Shareholders = kds_shareholder:get_all(),
_ = ?assertEqual(length(EncryptedMasterKeyShares), length(Shareholders)),
EncPrivateKeys = enc_private_keys(C), EncPrivateKeys = enc_private_keys(C),
SigPrivateKeys = sig_private_keys(C), SigPrivateKeys = sig_private_keys(C),
EncryptedMasterKeyShares = kds_keyring_client:start_init(Threshold, root_url(C)),
%% DEBUG
_ = ?assertMatch(
#{
status := not_initialized,
activities := #{
initialization := #{
phase := validation,
validation_shares := #{}
}
}
},
kds_ct_utils:await_initialization_phase(validation, root_url(C), 1000, 100)
),
_ = ?assertEqual(length(EncryptedMasterKeyShares), length(Shareholders)),
DecryptedMasterKeyShares = kds_ct_keyring:decrypt_and_sign_masterkeys( DecryptedMasterKeyShares = kds_ct_keyring:decrypt_and_sign_masterkeys(
EncryptedMasterKeyShares, EncryptedMasterKeyShares,
EncPrivateKeys, EncPrivateKeys,
SigPrivateKeys SigPrivateKeys
), ),
Timeout = genlib_app:env(kds, keyring_initialize_lifetime),
_ = ?assertMatch( _ = ?assertMatch(
#{ #{
status := not_initialized, status := not_initialized,
@ -172,7 +160,7 @@ init(C) ->
} }
} }
}, },
kds_ct_utils:await_initialization_phase(validation, root_url(C), 1000, 100) kds_ct_utils:await_initialization_phase(validation, root_url(C), Timeout, 200)
), ),
ok = validate_init(DecryptedMasterKeyShares, C), ok = validate_init(DecryptedMasterKeyShares, C),
_ = ?assertMatch( _ = ?assertMatch(
@ -205,7 +193,8 @@ init_with_timeout(C) ->
init_with_cancel(C) -> init_with_cancel(C) ->
{Id, DecryptedMasterKeyShare} = partial_init(C), {Id, DecryptedMasterKeyShare} = partial_init(C),
ok = kds_keyring_client:cancel_init(root_url(C)), ok = kds_keyring_client:cancel_init(root_url(C)),
_ = kds_ct_utils:await_initialization_phase(uninitialized, root_url(C), 3000, 200), Timeout = genlib_app:env(kds, keyring_initialize_lifetime),
_ = kds_ct_utils:await_initialization_phase(uninitialized, root_url(C), Timeout, 200),
_ = ?assertEqual( _ = ?assertEqual(
{error, {invalid_activity, {initialization, uninitialized}}}, {error, {invalid_activity, {initialization, uninitialized}}},
kds_keyring_client:validate_init(Id, DecryptedMasterKeyShare, root_url(C)) kds_keyring_client:validate_init(Id, DecryptedMasterKeyShare, root_url(C))

View File

@ -78,7 +78,8 @@ init_check_meta(C) ->
#{keys := #{}, current_key_id := 0}, #{keys := #{}, current_key_id := 0},
kds_keyring_client:get_keyring_meta(root_url(C)) kds_keyring_client:get_keyring_meta(root_url(C))
), ),
_ = kds_ct_utils:await_initialization_phase(uninitialized, root_url(C), 3000, 200), Timeout = genlib_app:env(kds, keyring_initialize_lifetime),
_ = kds_ct_utils:await_initialization_phase(uninitialized, root_url(C), Timeout, 200),
_ = kds_ct_keyring:init(C), _ = kds_ct_keyring:init(C),
_ = kds_ct_utils:await_status(unlocked, root_url(C), 3000, 200), _ = kds_ct_utils:await_status(unlocked, root_url(C), 3000, 200),
_ = ?assertMatch( _ = ?assertMatch(

View File

@ -65,9 +65,11 @@ init_check_keyring(C) ->
{error, {invalid_status, not_initialized}}, {error, {invalid_status, not_initialized}},
get_keyring(C) get_keyring(C)
), ),
_ = kds_ct_utils:await_initialization_phase(uninitialized, management_root_url(C), 3000, 200), Timeout = genlib_app:env(kds, keyring_initialize_lifetime),
_ = kds_ct_utils:await_initialization_phase(uninitialized, management_root_url(C), Timeout, 200),
_ = kds_ct_keyring:init(C), _ = kds_ct_keyring:init(C),
_ = kds_ct_utils:await_status(unlocked, management_root_url(C), 3000, 200), UnlockTimeout = genlib_app:env(kds, keyring_unlock_lifetime),
_ = kds_ct_utils:await_status(unlocked, management_root_url(C), UnlockTimeout, 200),
_ = ?assertMatch( _ = ?assertMatch(
#{ #{
meta := #{current_key_id := 0, version := 1, keys := #{0 := #{retired := false}}}, meta := #{current_key_id := 0, version := 1, keys := #{0 := #{retired := false}}},