Skip to content

Commit

Permalink
[FLINK-10765][test] Include s3p schema in S3 test
Browse files Browse the repository at this point in the history
This closes apache#7032.
  • Loading branch information
StefanRRichter committed Nov 8, 2018
1 parent c8b2ee2 commit c5e227b
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

import static com.facebook.presto.hive.PrestoS3FileSystem.S3_USE_INSTANCE_CREDENTIALS;
Expand All @@ -53,8 +57,17 @@
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html#ConsistencyModel">consistency guarantees</a>
* and what the {@link com.facebook.presto.hive.PrestoS3FileSystem} offers.
*/
@RunWith(Parameterized.class)
public class PrestoS3FileSystemITCase extends TestLogger {

@Parameterized.Parameter
public String scheme;

@Parameterized.Parameters(name = "Scheme = {0}")
public static List<String> parameters() {
return Arrays.asList("s3", "s3p");
}

private static final String BUCKET = System.getenv("ARTIFACTS_AWS_BUCKET");

private static final String TEST_DATA_DIR = "tests-" + UUID.randomUUID();
Expand All @@ -71,7 +84,7 @@ public static void checkIfCredentialsArePresent() {

@Test
public void testConfigKeysForwarding() throws Exception {
final Path path = new Path("s3:https://" + BUCKET + '/' + TEST_DATA_DIR);
final Path path = new Path(scheme + ":https://" + BUCKET + '/' + TEST_DATA_DIR);

// access without credentials should fail
{
Expand Down Expand Up @@ -145,7 +158,7 @@ public void testSimpleFileWriteAndRead() throws Exception {

FileSystem.initialize(conf);

final Path path = new Path("s3:https://" + BUCKET + '/' + TEST_DATA_DIR + "/test.txt");
final Path path = new Path(scheme + ":https://" + BUCKET + '/' + TEST_DATA_DIR + "/test.txt");
final FileSystem fs = path.getFileSystem();

try {
Expand Down Expand Up @@ -178,7 +191,7 @@ public void testDirectoryListing() throws Exception {

FileSystem.initialize(conf);

final Path directory = new Path("s3:https://" + BUCKET + '/' + TEST_DATA_DIR + "/testdir/");
final Path directory = new Path(scheme + ":https://" + BUCKET + '/' + TEST_DATA_DIR + "/testdir/");
final FileSystem fs = directory.getFileSystem();

// directory must not yet exist
Expand Down

0 comments on commit c5e227b

Please sign in to comment.