directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <>
Subject [jira] [Created] (DIRAPI-317) Non thread-safe tests could lead to errors while running them
Date Fri, 17 Aug 2018 21:41:00 GMT
Emmanuel Lecharny created DIRAPI-317:

             Summary: Non thread-safe tests could lead to errors while running them
                 Key: DIRAPI-317
             Project: Directory Client API
          Issue Type: Bug
    Affects Versions: 2.0.0.AM1
            Reporter: Emmanuel Lecharny
             Fix For: 2.0.0

>From time to time, we might get a test failure, like teh one reported on Jenkins :


This is due to the fact that we are modifying a static variable (the irony ;-) :

public class MultiThreadedTest
    public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( 100, 1000 );

    private static Dn sharedDn;
    public static void setup() throws Exception
        schemaManager = new DefaultSchemaManager();

        referenceDn = new Dn( schemaManager, "dc=example,dc=com" );
        sharedDn = new Dn( schemaManager, "dc=example,dc=com" );
    public void testNormalizeHashCode() throws Exception
        assertEquals( referenceAva.hashCode(), sharedAva.hashCode() );

        sharedRdn = new Rdn( schemaManager, sharedRdn );
        assertEquals( referenceRdn.hashCode(), sharedRdn.hashCode() );

        sharedDn = new Dn( schemaManager, sharedDn );  <------- This is *very* wrong
        assertEquals( referenceDn.hashCode(), sharedDn.hashCode() );

Many of the tests are updating the {{sharedDn}} - and some of the other static declarations
-, which may lead to invalid tests, as all the tests are ran concurrently.

This has to be fixed.

This message was sent by Atlassian JIRA

View raw message