From 3cc8bed31505fb0d39a0b2630b696cfe529ff32b Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Sat, 11 Jul 2026 07:43:03 +0000
Subject: [PATCH] Fix flaky BindOperationTestCase subtree auth-info tests (#727)
---
opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java | 41 +++++++++++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
index da60729..d1f8c43 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
@@ -45,9 +45,11 @@
import org.opends.server.types.Control;
import org.opends.server.types.Operation;
import org.opends.server.types.OperationType;
+import org.opends.server.util.TestTimer;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import static java.util.concurrent.TimeUnit.*;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
@@ -1527,7 +1529,16 @@
};
assertEquals(LDAPDelete.run(nullPrintStream(), System.err, args), 0);
- assertNull(DirectoryServer.getAuthenticatedUsers().get(userDN));
+ // AuthenticatedUsers is a POST_RESPONSE plugin: the registry is updated
+ // after the client already received the response, so poll briefly.
+ newAuthInfoTimer().repeatUntilSuccess(new TestTimer.CallableVoid()
+ {
+ @Override
+ public void call() throws Exception
+ {
+ assertNull(DirectoryServer.getAuthenticatedUsers().get(userDN));
+ }
+ });
}
finally
{
@@ -1591,9 +1602,18 @@
};
assertEquals(LDAPModify.run(nullPrintStream(), System.err, args), 0);
- DN newUserDN = DN.valueOf("uid=test,ou=users,dc=example,dc=com");
- assertNotNull(DirectoryServer.getAuthenticatedUsers().get(newUserDN));
- assertEquals(DirectoryServer.getAuthenticatedUsers().get(newUserDN).size(), 1);
+ final DN newUserDN = DN.valueOf("uid=test,ou=users,dc=example,dc=com");
+ // AuthenticatedUsers is a POST_RESPONSE plugin: the registry is updated
+ // after the client already received the response, so poll briefly.
+ newAuthInfoTimer().repeatUntilSuccess(new TestTimer.CallableVoid()
+ {
+ @Override
+ public void call() throws Exception
+ {
+ assertNotNull(DirectoryServer.getAuthenticatedUsers().get(newUserDN));
+ assertEquals(DirectoryServer.getAuthenticatedUsers().get(newUserDN).size(), 1);
+ }
+ });
}
finally
{
@@ -1602,6 +1622,19 @@
}
/**
+ * Timer to await the asynchronous {@link AuthenticatedUsers} registry
+ * update: it is performed by a POST_RESPONSE plugin, i.e. after the client
+ * already received the operation response.
+ */
+ private TestTimer newAuthInfoTimer()
+ {
+ return new TestTimer.Builder()
+ .maxSleep(10, SECONDS)
+ .sleepTimes(100, MILLISECONDS)
+ .toTimer();
+ }
+
+ /**
* Tests to ensure that the "ignore" password policy state update policy
* works as expected.
*
--
Gitblit v1.10.0