Skip to content
Permalink
Browse files

Merge pull request #9 from jenkinsci/JENKINS-50591

[JENKINS-50591][JCLOUDS-1401] Add test that shows jclouds issue
  • Loading branch information...
carlossg committed Apr 6, 2018
2 parents eef7980 + 4392c8c commit 3a5d4d308c0de4d519c5927477abf280e6b58196
Showing with 34 additions and 0 deletions.
  1. +34 −0 src/test/java/io/jenkins/plugins/artifact_manager_s3/JCloudsBlobStoreTest.java
@@ -25,24 +25,35 @@
package io.jenkins.plugins.artifact_manager_s3;

import static org.hamcrest.Matchers.*;
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.*;
import static org.junit.Assert.*;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.rest.internal.InvokeHttpMethod;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.LoggerRule;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.S3ObjectSummary;

import jenkins.util.VirtualFile;
import shaded.com.google.common.collect.ImmutableSet;

@@ -232,4 +243,27 @@ public void toURI() throws Exception {
newJCloudsBlobStore("xxx#?:$&'\"<>čॐ").toURI());
}

@Ignore("blocked by jClouds issue")
@Test
@Issue({ "JENKINS-50591", "JCLOUDS-1401" })
public void testAmpersand() throws Exception {
String key = getPrefix() + "xxx#?:&$'\"<>čॐ";

try {
blobStore.putBlob(getContainer(), blobStore.blobBuilder(key).payload("test").build());

final AmazonS3 s3 = AmazonS3ClientBuilder.defaultClient();
ListObjectsV2Result result = s3.listObjectsV2(getContainer(), key);
List<S3ObjectSummary> objects = result.getObjectSummaries();
assertThat(objects, not(empty()));

// fails with
// org.jclouds.rest.AuthorizationException: The request signature we calculated does not match the signature
// you provided. Check your key and signing method.
PageSet<? extends StorageMetadata> list = blobStore.list(getContainer(), prefix(key));
assertThat(list, not(empty()));
} finally {
blobStore.removeBlob(getContainer(), key);
}
}
}

0 comments on commit 3a5d4d3

Please sign in to comment.
You can’t perform that action at this time.