Reduces parallelism to make test work better with slower connections Adjusts test timing to work properly and reliably

This commit is contained in:
Zack Shoylev 2013-08-12 16:18:26 -05:00
parent 1013986585
commit cb9a6b9413
1 changed files with 6 additions and 3 deletions

View File

@ -44,6 +44,7 @@ import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@ -86,6 +87,7 @@ import com.google.common.io.Files;
import com.google.common.io.InputSupplier; import com.google.common.io.InputSupplier;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.Uninterruptibles;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -147,7 +149,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
final String container = getContainerName(); final String container = getContainerName();
try { try {
Map<Integer, ListenableFuture<?>> responses = Maps.newHashMap(); Map<Integer, ListenableFuture<?>> responses = Maps.newHashMap();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 3; i++) {
responses.put(i, this.exec.submit(new Callable<Void>() { responses.put(i, this.exec.submit(new Callable<Void>() {
@ -325,10 +327,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String name = "apples"; String name = "apples";
Date before = new Date(System.currentTimeMillis() - 1000); Date before = new Date(System.currentTimeMillis() - 5000);
addObjectAndValidateContent(container, name); addObjectAndValidateContent(container, name);
Date after = new Date(System.currentTimeMillis() + 1000); Date after = new Date(System.currentTimeMillis() + 5000);
Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
view.getBlobStore().getBlob(container, name, ifUnmodifiedSince(after)); view.getBlobStore().getBlob(container, name, ifUnmodifiedSince(after));
validateContent(container, name); validateContent(container, name);