In the JBoss AS Codebase (in testsuite/smoke) org.jboss.as.test.embedded.osgi.SimpleArchiveDeployerTestCase has the following code @line 30:
archiveDeployer.undeploy(depname);
OSGiTestHelper.assertBundleState(Bundle.UNINSTALLED, bundle.getState());
However in some cases the bundle state hasn't reached UNINSTALLED yet when the assertion is done. In some cases the state is still RESOLVED.
This causes this test to fail intermittently. Experiments show that this seems to be a timing issue in the test and that the bundle does reach the UNINSTALLED state eventually.
For the moment the assert line above is commented out, but it needs to be fixed properly.