Consistently name test container names

Previously jclouds allocated the initial container pool as
$USERNAME-blobstore-1, 2, etc. and subsequent containers with
$USERNAME-blobstore-$RANDOM.  Use only the former instead.
This commit is contained in:
Andrew Gaul 2015-07-09 14:32:33 -07:00
parent d197a9e0cb
commit de04c69141
2 changed files with 7 additions and 7 deletions

View File

@ -22,7 +22,6 @@ import static org.jclouds.reflect.Reflection2.typeToken;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
@ -82,7 +81,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
String.format(XML_STRING_FORMAT, "emma"));
public static long INCONSISTENCY_WINDOW = 10000;
protected static volatile AtomicInteger containerIndex = new AtomicInteger(0);
protected static final AtomicInteger containerIndex = new AtomicInteger(0);
protected static volatile int containerCount = Integer.parseInt(System.getProperty("test.blobstore.container-count",
"10"));
@ -514,7 +513,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
deleteContainerOrWarnIfUnable(view, container);
}
});
String newScratchContainer = CONTAINER_PREFIX + new SecureRandom().nextLong();
String newScratchContainer = CONTAINER_PREFIX + containerIndex.incrementAndGet();
System.err.printf("*** allocated new container %s...%n", newScratchContainer);
return newScratchContainer;
}

View File

@ -94,7 +94,8 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
public void testCreateContainer() throws Exception {
boolean created = false;
while (!created) {
privateContainer = CONTAINER_PREFIX + new SecureRandom().nextInt();
// testListOwnedContainers requires a unique prefix
privateContainer = CONTAINER_PREFIX + "unique-" + containerIndex.incrementAndGet();
try {
created = getApi().createContainer(privateContainer, withMetadata(ImmutableMultimap.of("foo", "bar")));
} catch (UndeclaredThrowableException e) {
@ -118,7 +119,7 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
public void testCreatePublicContainer() throws Exception {
boolean created = false;
while (!created) {
publicContainer = CONTAINER_PREFIX + new SecureRandom().nextInt();
publicContainer = CONTAINER_PREFIX + containerIndex.incrementAndGet();
try {
created = getApi().createContainer(publicContainer, withPublicAccess(PublicAccess.BLOB));
} catch (UndeclaredThrowableException e) {
@ -342,7 +343,7 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
@Test(timeOut = 5 * 60 * 1000)
public void testBlockOperations() throws Exception {
String blockContainer = CONTAINER_PREFIX + new SecureRandom().nextInt();
String blockContainer = CONTAINER_PREFIX + containerIndex.incrementAndGet();
String blockBlob = "myblockblob-" + new SecureRandom().nextInt();
String A = "A";
String B = "B";
@ -380,7 +381,7 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
@Test
public void testGetSetACL() throws Exception {
AzureBlobClient client = getApi();
String blockContainer = CONTAINER_PREFIX + new SecureRandom().nextInt();
String blockContainer = CONTAINER_PREFIX + containerIndex.incrementAndGet();
client.createContainer(blockContainer);
try {
assertThat(client.getPublicAccessForContainer(blockContainer)).isEqualTo(PublicAccess.PRIVATE);