Skip to content

Commit

Permalink
Merge 529cbd7 into 4f8b1cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jkff committed Apr 20, 2017
2 parents 4f8b1cc + 529cbd7 commit addcbcb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public String validateOutputFilePrefixSupported(String filePrefix) {
public String verifyPath(String path) {
GcsPath gcsPath = getGcsPath(path);
checkArgument(gcsPath.isAbsolute(), "Must provide absolute paths for Dataflow");
checkArgument(!gcsPath.getObject().isEmpty(),
"Missing object or bucket in path: '%s', did you mean: 'gs://some-bucket/%s'?",
gcsPath, gcsPath.getBucket());
checkArgument(!gcsPath.getObject().contains("//"),
"Dataflow Service does not allow objects with consecutive slashes");
return gcsPath.toResourceName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ public void testInvalidFilePattern() {
validator.validateInputFilePatternSupported("/local/path");
}

@Test
public void testFilePatternMissingBucket() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage(
"Missing object or bucket in path: 'gs://input/', "
+ "did you mean: 'gs://some-bucket/input'?");
validator.validateInputFilePatternSupported("gs://input");
}

@Test
public void testWhenBucketDoesNotExist() throws Exception {
when(mockGcsUtil.bucketAccessible(any(GcsPath.class))).thenReturn(false);
Expand All @@ -84,4 +93,13 @@ public void testInvalidOutputPrefix() {
"Expected a valid 'gs://' path but was given '/local/path'");
validator.validateOutputFilePrefixSupported("/local/path");
}

@Test
public void testOutputPrefixMissingBucket() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage(
"Missing object or bucket in path: 'gs://output/', "
+ "did you mean: 'gs://some-bucket/output'?");
validator.validateOutputFilePrefixSupported("gs://output");
}
}

0 comments on commit addcbcb

Please sign in to comment.