-
Bug
-
Resolution: Done
-
Major
-
1.0.3.Final
-
None
-
None
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:
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;
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.