Skip to content

Commit

Permalink
Merge pull request #699 from cantaloupe-project/issue-678
Browse files Browse the repository at this point in the history
Adding 5 retries for purge
  • Loading branch information
DiegoPino authored Sep 11, 2024
2 parents c351b60 + b5efb05 commit f492eac
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
import java.nio.file.Path;
import java.util.Arrays;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.*;

public class S3CacheTest extends AbstractCacheTest {
private static final Logger LOGGER = LoggerFactory.getLogger(S3CacheTest.class);

private enum Service {
AWS("aws"), MINIO("minio");
Expand Down Expand Up @@ -323,10 +327,14 @@ void testPurge() throws Exception {
// purge everything
instance.purge();

// Allow time for purge but not as long as upload
Thread.sleep(ASYNC_WAIT / 2);

// assert that the info has been purged
int tries = 0;
while (tries < 5 && instance.getInfo(identifier).isPresent()) {
LOGGER.debug("Identifier " + identifier + " is still present. Try: " + tries);
// Allow time for purge but not as long as upload
Thread.sleep(ASYNC_WAIT / 2);
tries++;
}
// If reached here then identifier is probably not going to be deleted async
assertFalse(instance.getInfo(identifier).isPresent());

// assert that the image has been purged
Expand Down

0 comments on commit f492eac

Please sign in to comment.