[arquillian-issues] [JBoss JIRA] (ARQ-1345) maxTestClassesBeforeRestart causes more restarts than it should

Rich DiCroce (JIRA) jira-events at lists.jboss.org
Thu Mar 7 11:09:43 EST 2013


Rich DiCroce created ARQ-1345:
---------------------------------

             Summary: maxTestClassesBeforeRestart causes more restarts than it should
                 Key: ARQ-1345
                 URL: https://issues.jboss.org/browse/ARQ-1345
             Project: Arquillian
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 1.0.3.Final
            Reporter: Rich DiCroce


ContainerRestarter (package org.jboss.arquillian.container.test.impl.client.container) has a bug in it that causes maxTestClassesBeforeRestart to be evaluated slightly incorrectly. The below code is what the shouldRestart() method currently does:
{code}
      ArquillianDescriptor descriptor = configuration.get(); 
      Integer maxTestClasses = descriptor.engine().getMaxTestClassesBeforeRestart();
      if(maxTestClasses == null)
      {
         return false;
      }
      if(maxTestClasses > -1) 
      {
         if((maxTestClasses -1 ) == testClassesCount)
         {
            testClassesCount = 0;
            return true;
         }
      }
      testClassesCount++;
      return false;
{code}

Because it checks if maxTestClasses - 1 is equal to testClassesCount, the first container restart actually occurs before test #N-1, not test #N. An easy way to see this is to set maxTestClassesBeforeRestart to 1; you will observe that the container is started for the first time, then immediately shut down without anything being deployed, then restarted.

This can be fixed by checking if maxTestClasses == testClassesCount instead of maxTestClasses - 1 == testClassesCount.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the arquillian-issues mailing list