Delete containers after integration tests

Also return newly allocated containers to the pool.
This commit is contained in:
Andrew Gaul 2013-09-04 15:12:26 -07:00
parent f6cf6a19b8
commit b4454b6151
4 changed files with 17 additions and 6 deletions

View File

@ -50,6 +50,7 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.util.Strings2;
import org.testng.ITestContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeSuite;
@ -101,6 +102,15 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
view.close();
view = null;
}
@AfterSuite(groups = { "integration", "live" })
protected void destroyResources() throws Exception {
setupContext();
deleteEverything(view);
view.close();
view = null;
}
protected Iterable<Module> setupModules() {
return ImmutableSet.<Module> of(getLoggingModule(), createHttpModule());
@ -499,7 +509,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
}
});
String newScratchContainer = CONTAINER_PREFIX + new SecureRandom().nextLong();
System.err.printf("*** allocated new container %s...%n", container);
System.err.printf("*** allocated new container %s...%n", newScratchContainer);
return newScratchContainer;
}

View File

@ -52,6 +52,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
}
@Test(groups = { "integration", "live" })
// TODO: the test name does not describe its behavior
public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException {
String containerName = getContainerName();
try {
@ -275,7 +276,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
view.getBlobStore().deleteContainer(containerName);
assertNotExists(containerName);
} finally {
recycleContainer(containerName);
recycleContainerAndAddToPool(containerName);
}
}
@ -287,7 +288,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
assertNotExists(containerName);
} finally {
// this container is now deleted, so we can't reuse it directly
recycleContainer(containerName);
recycleContainerAndAddToPool(containerName);
}
}

View File

@ -76,7 +76,7 @@ public class BaseContainerLiveTest extends BaseBlobStoreIntegrationTest {
} finally {
// this container is now public, so we can't reuse it directly
recycleContainer(containerName);
recycleContainerAndAddToPool(containerName);
}
}
@ -129,7 +129,7 @@ public class BaseContainerLiveTest extends BaseBlobStoreIntegrationTest {
} finally {
// this container is now public, so we can't reuse it directly
recycleContainer(containerName);
recycleContainerAndAddToPool(containerName);
}
}

View File

@ -68,7 +68,7 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
});
} finally {
recycleContainer(containerName);
recycleContainerAndAddToPool(containerName);
}
}
}