Skip to content
Merged
Changes from all 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 @@ -25,6 +25,8 @@
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hadoop.hdds.client.StandaloneReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
Expand Down Expand Up @@ -66,6 +68,8 @@ public class TestKeyDeletingService {
public TemporaryFolder folder = new TemporaryFolder();
private OzoneManagerProtocol writeClient;
private OzoneManager om;
private static final Logger LOG =
LoggerFactory.getLogger(TestKeyDeletingService.class);

private OzoneConfiguration createConfAndInitValues() throws IOException {
OzoneConfiguration conf = new OzoneConfiguration();
Expand Down Expand Up @@ -121,7 +125,7 @@ public void checkIfDeleteServiceisDeletingKeys()
keyManager.getPendingDeletionKeys(Integer.MAX_VALUE).size(), 0);
}

@Test(timeout = 30000)
@Test(timeout = 40000)
public void checkIfDeleteServiceWithFailingSCM()
throws IOException, TimeoutException, InterruptedException,
AuthenticationException {
Expand All @@ -139,8 +143,22 @@ public void checkIfDeleteServiceWithFailingSCM()
createAndDeleteKeys(keyManager, keyCount, 1);
KeyDeletingService keyDeletingService =
(KeyDeletingService) keyManager.getDeletingService();
Assert.assertEquals(
keyManager.getPendingDeletionKeys(Integer.MAX_VALUE).size(), keyCount);
GenericTestUtils.waitFor(
() -> {
try {
int numPendingDeletionKeys =
keyManager.getPendingDeletionKeys(Integer.MAX_VALUE).size();
if (numPendingDeletionKeys != keyCount) {
LOG.info("Expected {} keys to be pending deletion, but got {}",
keyCount, numPendingDeletionKeys);
return false;
}
return true;
} catch (IOException e) {
LOG.error("Error while getting pending deletion keys.", e);
return false;
}
}, 100, 2000);
// Make sure that we have run the background thread 5 times more
GenericTestUtils.waitFor(
() -> keyDeletingService.getRunCount().get() >= 5,
Expand Down