diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2018-04-26 12:03:10 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-04-26 20:20:53 +0200 |
commit | 7f484a398b0b93801a6cc7420a5003b4057138be (patch) | |
tree | 5c2b97b52deb677f8ca26196690205ca99e2a555 | |
parent | 557b62ed2730744c4493d164bf6d20a66e10bc49 (diff) | |
download | sonarqube-7f484a398b0b93801a6cc7420a5003b4057138be.tar.gz sonarqube-7f484a398b0b93801a6cc7420a5003b4057138be.zip |
Stop the container even if assertion failed
This is to avoid other tests of the suite to fail, making it harder to spot the root cause
-rw-r--r-- | server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java index af333c9683d..7afde4f1d06 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java @@ -90,47 +90,50 @@ public class ComputeEngineContainerImplTest { .start(new Props(properties)); MutablePicoContainer picoContainer = underTest.getComponentContainer().getPicoContainer(); - assertThat(picoContainer.getComponentAdapters()) - .hasSize( + try { + assertThat(picoContainer.getComponentAdapters()) + .hasSize( + CONTAINER_ITSELF + + 83 // level 4 + + 21 // content of QualityGateModule + + 6 // content of CeConfigurationModule + + 4 // content of CeQueueModule + + 4 // content of CeHttpModule + + 3 // content of CeTaskCommonsModule + + 4 // content of ProjectAnalysisTaskModule + + 7 // content of CeTaskProcessorModule + + 4 // content of ReportAnalysisFailureNotificationModule + + 3 // CeCleaningModule + its content + + 4 // WebhookModule + + 1 // CeDistributedInformation + ); + assertThat(picoContainer.getParent().getComponentAdapters()).hasSize( CONTAINER_ITSELF - + 83 // level 4 - + 21 // content of QualityGateModule - + 6 // content of CeConfigurationModule - + 4 // content of CeQueueModule - + 4 // content of CeHttpModule - + 3 // content of CeTaskCommonsModule - + 4 // content of ProjectAnalysisTaskModule - + 7 // content of CeTaskProcessorModule - + 4 // content of ReportAnalysisFailureNotificationModule - + 3 // CeCleaningModule + its content - + 4 // WebhookModule - + 1 // CeDistributedInformation - ); - assertThat(picoContainer.getParent().getComponentAdapters()).hasSize( - CONTAINER_ITSELF - + 7 // level 3 - ); - assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize( - CONTAINER_ITSELF - + 16 // MigrationConfigurationModule - + 17 // level 2 - ); - assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize( - COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION - + 26 // level 1 - + 53 // content of DaoModule - + 3 // content of EsModule - + 59 // content of CorePropertyDefinitions - + 1 // StopFlagContainer - ); - assertThat( - picoContainer.getComponentAdapters().stream() - .map(ComponentAdapter::getComponentImplementation) - .collect(Collectors.toList())).doesNotContain( - (Class) CeDistributedInformationImpl.class).contains( - (Class) StandaloneCeDistributedInformation.class); - assertThat(picoContainer.getParent().getParent().getParent().getParent()).isNull(); - underTest.stop(); + + 7 // level 3 + ); + assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize( + CONTAINER_ITSELF + + 16 // MigrationConfigurationModule + + 17 // level 2 + ); + assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize( + COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION + + 26 // level 1 + + 53 // content of DaoModule + + 3 // content of EsModule + + 59 // content of CorePropertyDefinitions + + 1 // StopFlagContainer + ); + assertThat( + picoContainer.getComponentAdapters().stream() + .map(ComponentAdapter::getComponentImplementation) + .collect(Collectors.toList())).doesNotContain( + (Class) CeDistributedInformationImpl.class).contains( + (Class) StandaloneCeDistributedInformation.class); + assertThat(picoContainer.getParent().getParent().getParent().getParent()).isNull(); + } finally { + underTest.stop(); + } assertThat(picoContainer.getLifecycleState().isStarted()).isFalse(); assertThat(picoContainer.getLifecycleState().isStopped()).isFalse(); |