directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <>
Subject Random errors in tests
Date Fri, 18 Dec 2015 08:33:24 GMT
Hi guys,

I'm sure you have already experienced this issue. From time to time (not
frequently), when running integration tests, I get such an error :


Time elapsed: 0.016 sec  <<< ERROR!
The 'objectClass' AttributeType and values must both be String or binary

I don't think we should freak out, as this problems pretty much boils
down to a static variable being initialized many times in tests that are
run concurrently :

public class RefinementEvaluatorTest
    private static AttributeType OBJECT_CLASS_AT;
    public static void init() throws Exception
        OBJECT_CLASS_AT = schemaManager.getAttributeType( "objectClass" );

At this point, we can fix that by making this variable non static and
initialize it in a @Before method instead of doing so in a @Before class.

Otherwise, the root cause is that we do this check :

                    boolean isHR =

                    if ( isHR != isHumanReadable() )
                        String message = "The '" +
attributeType.getName() + "' AttributeType and values must "
                            + "both be String or binary";
                        LOG.error( message );
                        throw new LdapInvalidAttributeValueException(
ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );

and it's perfectly plausible that between the initialization of the isHr
variable and the test, we have a new initialization of the
attributeType, resetting the isHr flag.

Just wznted to let you know...

View raw message