Skip to content

Commit ff1e6a3

Browse files
committed
Add fallback for missing PBKDF2WithHmacSHA512 check
Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
1 parent 1f86bd8 commit ff1e6a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

server/src/test/java/org/opensearch/common/settings/ConsistentSettingsServiceTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
import org.opensearch.cluster.ClusterStateUpdateTask;
3737
import org.opensearch.cluster.service.ClusterService;
3838
import org.opensearch.test.OpenSearchTestCase;
39+
import org.junit.Assume;
3940
import org.junit.Before;
4041

42+
import javax.crypto.SecretKeyFactory;
43+
44+
import java.security.NoSuchAlgorithmException;
4145
import java.util.Arrays;
4246
import java.util.Locale;
4347
import java.util.concurrent.atomic.AtomicReference;
@@ -55,6 +59,12 @@ public class ConsistentSettingsServiceTests extends OpenSearchTestCase {
5559

5660
@Before
5761
public void init() throws Exception {
62+
try {
63+
SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
64+
} catch (NoSuchAlgorithmException e) {
65+
Assume.assumeNoException("PBKDF2WithHmacSHA512 algorithm is not available", e);
66+
}
67+
5868
clusterState.set(ClusterState.EMPTY_STATE);
5969
clusterService = mock(ClusterService.class);
6070
Mockito.doAnswer((Answer) invocation -> { return clusterState.get(); }).when(clusterService).state();

0 commit comments

Comments
 (0)