Skip to content

Commit db045d1

Browse files
committed
Merge branch 'master' of github.com:embulk/embulk-input-s3
2 parents 4686d4c + 909a6ae commit db045d1

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

embulk-input-s3/src/main/java/org/embulk/input/s3/FileList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public synchronized boolean add(String path, long size)
129129
return false;
130130
}
131131

132-
if (!pathMatchPattern.matcher(path).matches()) {
132+
if (!pathMatchPattern.matcher(path).find()) {
133133
return false;
134134
}
135135

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)