Skip to content

Commit

Permalink
GCS NIO: fix one test to work with the other unit tests (#3454)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-philippe-martin authored and pongad committed Jul 13, 2018
1 parent 7329839 commit d57efcf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public void testInputStreamReads() throws IOException, InterruptedException {
// reading past the end
int eof = is.read(buf, 0, 1);
assertWithMessage("EOF should return -1").that(eof).isEqualTo(-1);
} finally {
// clean up
Files.delete(p);
}
}
}
Expand Down Expand Up @@ -121,6 +124,9 @@ public void testChannelReads() throws IOException, InterruptedException {
buf.clear();
int eof = chan.read(buf);
assertWithMessage("EOF should return -1").that(eof).isEqualTo(-1);
} finally {
// clean up
Files.delete(p);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ public void testListFiles() throws IOException {
got.add(path);
}
assertThat(got).containsExactlyElementsIn(goodPaths);
// clean up
for (Path path : paths) {
Files.delete(path);
}
}
}

Expand All @@ -556,10 +560,12 @@ public void testDeleteRecursive() throws IOException {

@Test
public void testListFilesInRootDirectory() throws IOException {
// We must explicitly set the storageOptions, because the unit tests
// set the fake storage as default but we want to access the real storage.
CloudStorageFileSystem fs = CloudStorageFileSystem.forBucket(
BUCKET, CloudStorageConfiguration.builder().permitEmptyPathComponents(true)
.build());
.build(), storageOptions);

// test absolute path
Path rootPath = fs.getPath("");
List<String> objectNames = new ArrayList<String>();
Expand Down

0 comments on commit d57efcf

Please sign in to comment.