Skip to content

Commit c5be873

Browse files
ywangdtvernum
andauthored
[Test] Adjust assertions ReloadSecureSettings test for FIPS jvm (#66965)
When the JVM is configured to be in FIPS mode, the reload security settings API returns a different error message that is specific to FIPS when given an empty password. This PR adjust the assertions so that they are matched correspondingly. Co-authored-by: Tim Vernum <[email protected]>
1 parent 495d29f commit c5be873

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

x-pack/qa/password-protected-keystore/src/test/java/org/elasticsearch/password_protected_keystore/ReloadSecureSettingsWithPasswordProtectedKeystoreRestIT.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
1717
import static org.hamcrest.Matchers.anyOf;
18+
import static org.hamcrest.Matchers.containsString;
1819
import static org.hamcrest.Matchers.equalTo;
1920
import static org.hamcrest.Matchers.instanceOf;
2021
import static org.hamcrest.Matchers.nullValue;
@@ -65,7 +66,6 @@ public void testReloadSecureSettingsWithIncorrectPassword() throws Exception {
6566
}
6667

6768
@SuppressWarnings("unchecked")
68-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/66951")
6969
public void testReloadSecureSettingsWithEmptyPassword() throws Exception {
7070
final Request request = new Request("POST", "_nodes/reload_secure_settings");
7171
final Response response = client().performRequest(request);
@@ -80,8 +80,13 @@ public void testReloadSecureSettingsWithEmptyPassword() throws Exception {
8080
assertThat(node.get("reload_exception"), instanceOf(Map.class));
8181
assertThat(ObjectPath.eval("reload_exception.reason", node), anyOf(
8282
equalTo("Provided keystore password was incorrect"),
83-
equalTo("Keystore has been corrupted or tampered with")));
84-
assertThat(ObjectPath.eval("reload_exception.type", node), equalTo("security_exception"));
83+
equalTo("Keystore has been corrupted or tampered with"),
84+
containsString("Error generating an encryption key from the provided password") // FIPS
85+
));
86+
assertThat(ObjectPath.eval("reload_exception.type", node),
87+
// Depends on exact security provider (eg Sun vs BCFIPS)
88+
anyOf(equalTo("security_exception"), equalTo("general_security_exception"))
89+
);
8590
}
8691
}
8792

0 commit comments

Comments
 (0)