src/test/java/org/embulk/input/s3/TestS3FileInputPlugin.java in embulk-input-s3-0.2.16 vs src/test/java/org/embulk/input/s3/TestS3FileInputPlugin.java in embulk-input-s3-0.2.19
- old
+ new
@@ -160,9 +160,31 @@
assertEquals(0, getRecords(config, output).size());
}
}
@Test
+ public void usePath()
+ {
+ ConfigSource config = this.config.deepCopy()
+ .set("path", String.format("%s/sample_01.csv", EMBULK_S3_TEST_PATH_PREFIX))
+ .set("path_prefix", null);
+ ConfigDiff configDiff = runner.transaction(config, new Control(runner, output));
+ assertEquals(String.format("%s/sample_01.csv", EMBULK_S3_TEST_PATH_PREFIX), configDiff.get(String.class, "last_path"));
+ assertRecords(config, output);
+ }
+
+ @Test
+ public void usePathAsHighPriorityThanPathPrefix()
+ {
+ ConfigSource config = this.config.deepCopy()
+ .set("path", String.format("%s/sample_01.csv", EMBULK_S3_TEST_PATH_PREFIX))
+ .set("path_prefix", "foo"); // path_prefix has the bad value, if path_prefix is chosen, expected result will be failed
+ ConfigDiff configDiff = runner.transaction(config, new Control(runner, output));
+ assertEquals(String.format("%s/sample_01.csv", EMBULK_S3_TEST_PATH_PREFIX), configDiff.get(String.class, "last_path"));
+ assertRecords(config, output);
+ }
+
+ @Test
public void configuredEndpoint()
{
S3PluginTask task = config.deepCopy()
.set("endpoint", "s3-ap-southeast-1.amazonaws.com")
.set("region", "ap-southeast-2")