Repository: jclouds Updated Branches: refs/heads/master 97c77541e -> 6feacb1ee
Fixes for jclouds openstack swift tests. The ContainerApiLiveTest class has tests that mostly assume that a single test container always exists. They collide on changes to the state of the container. Some of the tests, though, assume the container does _not_ exist and attempt to create it and subsequently delete it. The change in this patch makes their behavior uniform with respect to that test container: assume it exists and if the test tries to delete it or mutate it, delete the container and create it at the end of the test. The fix in ObjectApi is for the Object GET requests. Currently, jclouds passes "format=json", which is not a supported query parameter for object GET. Lastly, ObjectApiLiveTest that test server-side copy should ignore the X-Openstack-Request-ID header, as its value will change between the two requests. Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/6feacb1e Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/6feacb1e Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/6feacb1e Branch: refs/heads/master Commit: 6feacb1ee5f104ccd7dacf1f3f95c7aa5109c45e Parents: 97c7754 Author: Timur Alperovich <[email protected]> Authored: Thu Sep 7 13:25:04 2017 -0700 Committer: Timur Alperovich <[email protected]> Committed: Thu Sep 7 13:25:50 2017 -0700 ---------------------------------------------------------------------- .../org/jclouds/openstack/swift/v1/features/ObjectApi.java | 1 - .../openstack/swift/v1/features/ContainerApiLiveTest.java | 8 +++++--- .../openstack/swift/v1/features/ObjectApiLiveTest.java | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/6feacb1e/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/ObjectApi.java ---------------------------------------------------------------------- diff --git a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/ObjectApi.java b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/ObjectApi.java index eb1492d..3164421 100644 --- a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/ObjectApi.java +++ b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/ObjectApi.java @@ -172,7 +172,6 @@ public interface ObjectApi { @Path("/{objectName}") @ResponseParser(ParseObjectFromResponse.class) @Fallback(NullOnNotFoundOr404.class) - @QueryParams(keys = "format", values = "json") @Nullable SwiftObject get(@PathParam("objectName") String objectName); http://git-wip-us.apache.org/repos/asf/jclouds/blob/6feacb1e/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ContainerApiLiveTest.java ---------------------------------------------------------------------- diff --git a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ContainerApiLiveTest.java b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ContainerApiLiveTest.java index 89fd0e4..9f73d7d 100644 --- a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ContainerApiLiveTest.java +++ b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ContainerApiLiveTest.java @@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableMultimap; /** * Provides live tests for the {@link ContainerApi}. */ -@Test(groups = "live", testName = "ContainerApiLiveTest") +@Test(groups = "live", testName = "ContainerApiLiveTest", singleThreaded = true) public class ContainerApiLiveTest extends BaseSwiftApiLiveTest { private String name = getClass().getSimpleName(); @@ -65,6 +65,7 @@ public class ContainerApiLiveTest extends BaseSwiftApiLiveTest { assertEquals(container.getMetadata().get("web-error"), "__error.html"); assertTrue(getApi().getContainerApi(regionId).deleteIfEmpty(name)); + assertTrue(getApi().getContainerApi(regionId).create(name)); } } @@ -133,20 +134,21 @@ public class ContainerApiLiveTest extends BaseSwiftApiLiveTest { assertEquals(updatedContainer.getMetadata().get("web-error"), "__error.html"); assertTrue(getApi().getContainerApi(regionId).deleteIfEmpty(name)); + assertTrue(getApi().getContainerApi(regionId).create(name)); } } public void testUpdateContainer() throws Exception { for (String regionId : regions) { ContainerApi containerApi = getApi().getContainerApi(regionId); - assertThat(containerApi.create(name)).isTrue(); - + // The container should exist, as it was created in the setup() method assertThat(containerApi.get(name).getAnybodyRead().get()).isFalse(); containerApi.update(name, new UpdateContainerOptions().anybodyRead()); assertThat(containerApi.get(name).getAnybodyRead().get()).isTrue(); assertThat(containerApi.deleteIfEmpty(name)).isTrue(); + assertThat(containerApi.create(name)).isTrue(); } } http://git-wip-us.apache.org/repos/asf/jclouds/blob/6feacb1e/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java ---------------------------------------------------------------------- diff --git a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java index 7212365..98a546e 100644 --- a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java +++ b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java @@ -214,6 +214,7 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest { if (header.getKey().equals("Last-Modified"))continue; if (header.getKey().equals("X-Trans-Id"))continue; if (header.getKey().equals("X-Timestamp"))continue; + if (header.getKey().equals("X-Openstack-Request-Id"))continue; assertTrue(destHeaders.containsEntry(header.getKey(), header.getValue()), "Could not find: " + header); } assertEquals(destSwiftObject.getPayload().getContentMetadata().getContentDisposition(), "attachment; filename=\"updatedname.txt\"");
