mirror of https://github.com/apache/jclouds.git
Fixes an intermittently failing swift live test.
This commit is contained in:
parent
d649c90d98
commit
f8ebbfdf8a
|
@ -62,9 +62,11 @@ public class StaticLargeObjectApiLiveTest extends BaseSwiftApiLiveTest<SwiftApi>
|
||||||
ObjectApi objectApi = api.getObjectApi(regionId, containerName);
|
ObjectApi objectApi = api.getObjectApi(regionId, containerName);
|
||||||
|
|
||||||
String etag1s = objectApi.put(name + "/1", newByteSourcePayload(ByteSource.wrap(megOf1s)));
|
String etag1s = objectApi.put(name + "/1", newByteSourcePayload(ByteSource.wrap(megOf1s)));
|
||||||
|
awaitConsistency();
|
||||||
assertMegabyteAndETagMatches(regionId, name + "/1", etag1s);
|
assertMegabyteAndETagMatches(regionId, name + "/1", etag1s);
|
||||||
|
|
||||||
String etag2s = objectApi.put(name + "/2", newByteSourcePayload(ByteSource.wrap(megOf2s)));
|
String etag2s = objectApi.put(name + "/2", newByteSourcePayload(ByteSource.wrap(megOf2s)));
|
||||||
|
awaitConsistency();
|
||||||
assertMegabyteAndETagMatches(regionId, name + "/2", etag2s);
|
assertMegabyteAndETagMatches(regionId, name + "/2", etag2s);
|
||||||
|
|
||||||
List<Segment> segments = ImmutableList.<Segment> builder()
|
List<Segment> segments = ImmutableList.<Segment> builder()
|
||||||
|
@ -76,11 +78,14 @@ public class StaticLargeObjectApiLiveTest extends BaseSwiftApiLiveTest<SwiftApi>
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
awaitConsistency();
|
||||||
String etagOfEtags = api.getStaticLargeObjectApi(regionId, containerName).replaceManifest(
|
String etagOfEtags = api.getStaticLargeObjectApi(regionId, containerName).replaceManifest(
|
||||||
name, segments, ImmutableMap.of("myfoo", "Bar"));
|
name, segments, ImmutableMap.of("myfoo", "Bar"));
|
||||||
|
|
||||||
assertNotNull(etagOfEtags);
|
assertNotNull(etagOfEtags);
|
||||||
|
|
||||||
|
awaitConsistency();
|
||||||
|
|
||||||
SwiftObject bigObject = api.getObjectApi(regionId, containerName).get(name);
|
SwiftObject bigObject = api.getObjectApi(regionId, containerName).get(name);
|
||||||
assertEquals(bigObject.getETag(), etagOfEtags);
|
assertEquals(bigObject.getETag(), etagOfEtags);
|
||||||
assertEquals(bigObject.getPayload().getContentMetadata().getContentLength(), Long.valueOf(2 * 1024 * 1024));
|
assertEquals(bigObject.getPayload().getContentMetadata().getContentLength(), Long.valueOf(2 * 1024 * 1024));
|
||||||
|
|
|
@ -48,6 +48,13 @@ public abstract class BaseSwiftApiLiveTest<A extends SwiftApi> extends BaseApiLi
|
||||||
provider = "openstack-swift";
|
provider = "openstack-swift";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static final int AWAIT_CONSISTENCY_TIMEOUT_SECONDS = Integer.parseInt(System.getProperty(
|
||||||
|
"test.blobstore.await-consistency-timeout-seconds", "10"));
|
||||||
|
|
||||||
|
protected void awaitConsistency() {
|
||||||
|
Uninterruptibles.sleepUninterruptibly(AWAIT_CONSISTENCY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = "live")
|
@BeforeClass(groups = "live")
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
Loading…
Reference in New Issue