private void cleanup() throws CosmosException {
    // Note: retry decisions are made at CloudBlobStore level.  Configure Cosmos with no retries.
    ThrottlingRetryOptions throttlingRetryOptions = new ThrottlingRetryOptions();
    throttlingRetryOptions.setMaxRetryAttemptsOnThrottledRequests(0);
    CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder().endpoint(azureCloudConfig.cosmosEndpoint)
        .key(azureCloudConfig.cosmosKey)
        .throttlingRetryOptions(throttlingRetryOptions)
        .consistencyLevel(com.azure.cosmos.ConsistencyLevel.SESSION);
    if (azureCloudConfig.cosmosDirectHttps) {
      logger.info("Using CosmosDB DirectHttps connection mode");
      cosmosClientBuilder.directMode(new DirectConnectionConfig());
    } else {
      cosmosClientBuilder.gatewayMode(new GatewayConnectionConfig());
    }
    CosmosAsyncClient cosmosAsyncClient = cosmosClientBuilder.buildAsyncClient();

    Set<CosmosContainerDeletionEntry> entries = cloudDestination.getCosmosDataAccessor().getDeprecatedContainers(100);
    AtomicBoolean error = new AtomicBoolean(false);
    while (!entries.isEmpty() && !error.get()) {
      entries.stream().forEach(entry -> {
        try {
          cloudRequestAgent.doWithRetries(() -> CosmosDataAccessor.executeCosmosAction(
              () -> cosmosAsyncClient.getDatabase(azureCloudConfig.cosmosDatabase)
                  .getContainer(azureCloudConfig.cosmosDeletedContainerCollection)
                  .deleteItem(entry.getId(), new com.azure.cosmos.models.PartitionKey(entry.getId()))
                  .block(), null), "Test Cleanup", entry.getId());
        } catch (CloudStorageException ex) {
          logger.warn("Failed to delete container deprecation entry {}. Unable to cleanup", entry);
          error.set(true);
        }
      });
      entries = cloudDestination.getCosmosDataAccessor().getDeprecatedContainers(100);
    }
  }
Cleanup entries in the cosmos db container deletion table.
@throws CosmosException in case of any exception.
ambry-cloud/src/test/java/com/github/ambry/cloud/azure/AzureContainerCompactorIntegrationTest.java