Skip to content
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager;
import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
import org.apache.hadoop.ozone.recon.spi.impl.OzoneManagerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.spi.impl.ReconDBProvider;
import org.apache.hadoop.ozone.recon.spi.impl.StorageContainerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTaskOBS;
import org.apache.hadoop.ozone.recon.tasks.GlobalStatsValue;
Expand All @@ -109,6 +110,8 @@ public class TestOmDBInsightEndPoint extends AbstractReconSqlDBTest {
private ReconOMMetadataManager reconOMMetadataManager;
private ReconNamespaceSummaryManager reconNamespaceSummaryManager;
private OMDBInsightEndpoint omdbInsightEndpoint;
private OzoneStorageContainerManager ozoneStorageContainerManager;
private ReconDBProvider reconDBProvider;
private Pipeline pipeline;
private Random random = new Random();
private OzoneConfiguration ozoneConfiguration;
Expand Down Expand Up @@ -316,8 +319,9 @@ public void setUp() throws Exception {
reconTestInjector.getInstance(ReconContainerMetadataManager.class);
omdbInsightEndpoint = reconTestInjector.getInstance(
OMDBInsightEndpoint.class);
OzoneStorageContainerManager ozoneStorageContainerManager =
ozoneStorageContainerManager =
reconTestInjector.getInstance(OzoneStorageContainerManager.class);
reconDBProvider = reconTestInjector.getInstance(ReconDBProvider.class);
ReconPipelineManager reconPipelineManager = (ReconPipelineManager)
ozoneStorageContainerManager.getPipelineManager();
pipeline = getRandomPipeline();
Expand Down Expand Up @@ -350,6 +354,12 @@ public void tearDown() throws Exception {
if (reconOMMetadataManager != null) {
reconOMMetadataManager.stop();
}
if (ozoneStorageContainerManager != null) {
ozoneStorageContainerManager.stop();
}
if (reconDBProvider != null) {
reconDBProvider.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ArafatKhan2198 for updating the patch.

ReconTestInjector is created withContainerDB in @BeforeEach of some other tests. Don't they need to close it?

Examples:

  • TestClusterStateEndpoint
  • TestDeletedKeysSearchEndpoint
  • TestOpenKeysSearchEndpoint

(There may be more.)

Also, it would be better to add ReconTestInjector.close() to clean up all resources it created, and let tests call that single method instead of storing and closing reconDBProvider, which is otherwise not directly used in the test.

}
}

@SuppressWarnings("methodlength")
Expand Down