HDFS-17605. Reduce memory overhead of TestBPOfferService (#6996)

This commit is contained in:
Stephen O'Donnell 2024-08-19 11:35:11 +01:00 committed by GitHub
parent e5b76dc99f
commit df08e0de41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,8 +144,9 @@ public void setupMocks() throws Exception {
mockNN2 = setupNNMock(1); mockNN2 = setupNNMock(1);
// Set up a mock DN with the bare-bones configuration // Set up a mock DN with the bare-bones configuration
// objects, etc. // objects, etc. Set as stubOnly to save memory and avoid Mockito holding
mockDn = Mockito.mock(DataNode.class); // references to each invocation. This can cause OOM in some runs.
mockDn = Mockito.mock(DataNode.class, Mockito.withSettings().stubOnly());
Mockito.doReturn(true).when(mockDn).shouldRun(); Mockito.doReturn(true).when(mockDn).shouldRun();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
File dnDataDir = new File(new File(TEST_BUILD_DATA, "dfs"), "data"); File dnDataDir = new File(new File(TEST_BUILD_DATA, "dfs"), "data");