Skip to content

Commit dd3fa5b

Browse files
committed
Add a test for path_match_pattern option
1 parent a62e5c6 commit dd3fa5b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

embulk-input-s3/src/test/java/org/embulk/input/s3/TestS3FileInputPlugin.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,22 @@ public void useTotalFileCountLimit()
119119
public void usePathMatchPattern()
120120
throws Exception
121121
{
122-
ConfigSource config = this.config.deepCopy().set("path_match_pattern", "/match/");
123-
ConfigDiff configDiff = runner.transaction(config, new Control(runner, output));
122+
{ // match pattern
123+
ConfigSource config = this.config.deepCopy().set("path_match_pattern", "/sample_01");
124+
ConfigDiff configDiff = runner.transaction(config, new Control(runner, output));
124125

125-
assertNull(configDiff.get(String.class, "last_path"));
126-
assertEquals(0, getRecords(config, output).size());
126+
assertEquals(EMBULK_S3_TEST_PATH_PREFIX + "/sample_01.csv", configDiff.get(String.class, "last_path"));
127+
assertRecords(config, output);
128+
}
129+
130+
output = new MockPageOutput();
131+
{ // not match pattern
132+
ConfigSource config = this.config.deepCopy().set("path_match_pattern", "/match/");
133+
ConfigDiff configDiff = runner.transaction(config, new Control(runner, output));
134+
135+
assertNull(configDiff.get(String.class, "last_path"));
136+
assertEquals(0, getRecords(config, output).size());
137+
}
127138
}
128139

129140
static class Control

0 commit comments

Comments
 (0)