Skip to content
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 @@ -244,7 +244,6 @@ public void testGroupLookupBase() throws Exception {
* If the realm's CA path is monitored for changes and the underlying SSL context is reloaded, then we will get two different outcomes
* (one failure, one success) depending on which file content is in place.
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/68995")
public void testSslTrustIsReloaded() throws Exception {
assumeFalse("NPE thrown in BCFIPS JSSE - addressed in " +
"https://github.com/bcgit/bc-java/commit/5aed687e17a3cd63f34373cafe92699b90076fb6#diff-8e5d8089bc0d504d93194a1e484d3950R179",
Expand All @@ -264,8 +263,11 @@ public void testSslTrustIsReloaded() throws Exception {
.put(buildLdapSettings(ldapUrl, userTemplates, groupSearchBase, LdapSearchScope.SUB_TREE))
.build();

// !!!make sure that the file size on disk for the two pem CAs is different!!!
// otherwise, the resource watcher has to rely on the last modified timestamp to detect changes,
// and the resolution for that can be as low as a second, and the test would spuriously fail
final Path realCa = getDataPath("/org/elasticsearch/xpack/security/authc/ldap/support/ldap-ca.crt");
final Path fakeCa = getDataPath("/org/elasticsearch/xpack/security/authc/ldap/support/smb_ca.crt");
final Path fakeCa = getDataPath("/org/elasticsearch/xpack/security/authc/ldap/support/ad.crt");

final Environment environment = TestEnvironment.newEnvironment(settings);
RealmConfig config = new RealmConfig(REALM_IDENTIFIER, settings,
Expand All @@ -278,6 +280,7 @@ public void testSslTrustIsReloaded() throws Exception {
new SSLConfigurationReloader(environment, resourceWatcher, SSLService.getSSLConfigurations(environment.settings()).values())
.setSSLService(sslService);
Files.copy(fakeCa, ldapCaPath, StandardCopyOption.REPLACE_EXISTING);
// resourceWatcher looks at the file size and last access timestamp to detect changes
resourceWatcher.notifyNow(ResourceWatcherService.Frequency.HIGH);

UncategorizedExecutionException e =
Expand Down