mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Copilot
11 hours ago 877c029e25bfd1b5e0071a3daf31d29e7f9ac9c3
Fix race condition in ChangelogBackendTestCase flaky test (#617)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
3 files modified
18 ■■■■■ changed files
opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapMessages.java 8 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/LoggerConfigManager.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java 2 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapMessages.java
@@ -12,6 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.forgerock.opendj.ldap.spi;
@@ -106,6 +107,13 @@
        private LdapResponseMessage(final byte messageType, final int messageId, final Response content) {
            super(messageType, messageId, content);
        }
        @Override
        public String toString() {
            return "LdapResponseMessage(messageType=" + getMessageType()
                    + ", messageId=" + getMessageId()
                    + ", content=" + getContent() + ")";
        }
    }
    private static abstract class LdapMessageEnvelope<T> {
opendj-server-legacy/src/main/java/org/opends/server/core/LoggerConfigManager.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2006-2008 Sun Microsystems, Inc.
 * Portions Copyright 2013-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.core;
@@ -109,8 +110,13 @@
      {
        SLF4JBridgeHandler.removeHandlersForRootLogger();
        // This is needed to avoid major performance issue. See: http://www.slf4j.org/legacy.html#jul-to-slf4j
        // Limit Grizzly JUL logging to FINE to prevent a ClassCastException in
        // FilterChainContext.toString() (Grizzly bug) when debug logging is enabled.
        // Grizzly 3.0.1 DefaultFilterChain.executeFilter() checks isLoggable(FINEST) but
        // its FilterChainContext.toString() incorrectly casts the message to char[].
        LogManager.getLogManager().readConfiguration(
                new ByteArrayInputStream((".level=" + newLevel).getBytes()));
                new ByteArrayInputStream(
                        (".level=" + newLevel + "\norg.glassfish.grizzly.level=FINE").getBytes()));
        SLF4JBridgeHandler.install();
        currentJulLogLevel = newLevel;
      }
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -590,6 +590,8 @@
    // write 4 more changes starting from changenumber 5, and search them
    testName = "Multiple/5";
    csns = generateAndPublishUpdateMsgForEachOperationType(testName, false);
    // Wait until all 8 changes are indexed before searching
    assertChangelogAttributesInRootDSE(1, 8);
    searchChangesForEachOperationTypeUsingChangeNumberMode(5, csns, testName);
    // search from the provided change number: 6 (should be the add msg)