mirror of https://github.com/apache/jclouds.git
Delete containers after integration tests
Also return newly allocated containers to the pool.
This commit is contained in:
parent
0930b638e3
commit
8bdded3222
|
@ -50,6 +50,7 @@ import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.util.Strings2;
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.ITestContext;
|
import org.testng.ITestContext;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
|
|
||||||
|
@ -102,6 +103,15 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
|
||||||
view = null;
|
view = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterSuite(groups = { "integration", "live" })
|
||||||
|
protected void destroyResources() throws Exception {
|
||||||
|
setupContext();
|
||||||
|
deleteEverything(view);
|
||||||
|
|
||||||
|
view.close();
|
||||||
|
view = null;
|
||||||
|
}
|
||||||
|
|
||||||
protected Iterable<Module> setupModules() {
|
protected Iterable<Module> setupModules() {
|
||||||
return ImmutableSet.<Module> of(getLoggingModule(), createHttpModule());
|
return ImmutableSet.<Module> of(getLoggingModule(), createHttpModule());
|
||||||
}
|
}
|
||||||
|
@ -499,7 +509,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
String newScratchContainer = CONTAINER_PREFIX + new SecureRandom().nextLong();
|
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;
|
return newScratchContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { "integration", "live" })
|
@Test(groups = { "integration", "live" })
|
||||||
|
// TODO: the test name does not describe its behavior
|
||||||
public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException {
|
public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException {
|
||||||
String containerName = getContainerName();
|
String containerName = getContainerName();
|
||||||
try {
|
try {
|
||||||
|
@ -275,7 +276,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
view.getBlobStore().deleteContainer(containerName);
|
view.getBlobStore().deleteContainer(containerName);
|
||||||
assertNotExists(containerName);
|
assertNotExists(containerName);
|
||||||
} finally {
|
} finally {
|
||||||
recycleContainer(containerName);
|
recycleContainerAndAddToPool(containerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +288,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
assertNotExists(containerName);
|
assertNotExists(containerName);
|
||||||
} finally {
|
} finally {
|
||||||
// this container is now deleted, so we can't reuse it directly
|
// this container is now deleted, so we can't reuse it directly
|
||||||
recycleContainer(containerName);
|
recycleContainerAndAddToPool(containerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class BaseContainerLiveTest extends BaseBlobStoreIntegrationTest {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
// this container is now public, so we can't reuse it directly
|
// 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 {
|
} finally {
|
||||||
// this container is now public, so we can't reuse it directly
|
// this container is now public, so we can't reuse it directly
|
||||||
recycleContainer(containerName);
|
recycleContainerAndAddToPool(containerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
recycleContainer(containerName);
|
recycleContainerAndAddToPool(containerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue