Skip to content

Commit

Permalink
increase the wait timeout to fetch the master key (#3151) (#3176)
Browse files Browse the repository at this point in the history
* increase the wait timeout to fetch the master key

Signed-off-by: Jing Zhang <[email protected]>

* fix UTs

Signed-off-by: Jing Zhang <[email protected]>

---------

Signed-off-by: Jing Zhang <[email protected]>
(cherry picked from commit c7e564c)

Co-authored-by: Jing Zhang <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and jngz-es authored Oct 28, 2024
1 parent ac95c01 commit 45fdd80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ private void initMasterKey() {
}));

try {
latch.await(1, SECONDS);
boolean completed = latch.await(3, SECONDS);
if (!completed) {
throw new MLException("Fetching master key timed out.");
}
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ public void decrypt() {

@Test
public void encrypt_NullMasterKey_NullMasterKey_MasterKeyNotExistInIndex() {
exceptionRule.expect(ResourceNotFoundException.class);
exceptionRule.expectMessage(MASTER_KEY_NOT_READY_ERROR);
exceptionRule.expect(MLException.class);
exceptionRule.expectMessage("Fetching master key timed out.");

doAnswer(invocation -> {
ActionListener<GetResponse> listener = invocation.getArgument(1);
Expand Down Expand Up @@ -517,8 +517,8 @@ public void decrypt_NoResponseToInitConfigIndex() {

@Test
public void decrypt_MLConfigIndexNotFound() {
exceptionRule.expect(ResourceNotFoundException.class);
exceptionRule.expectMessage(MASTER_KEY_NOT_READY_ERROR);
exceptionRule.expect(MLException.class);
exceptionRule.expectMessage("Fetching master key timed out.");

Metadata metadata = new Metadata.Builder().indices(ImmutableMap.of()).build();
when(clusterState.metadata()).thenReturn(metadata);
Expand Down

0 comments on commit 45fdd80

Please sign in to comment.