Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIO: Enabled blocked tests. Fixed testCantCreateWithoutUserProject test. #4182

Merged
merged 4 commits into from
Dec 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand Down Expand Up @@ -157,7 +156,6 @@ private static void fillRequesterPaysFile(Storage storage, String fname, int siz
}

// Start of tests related to the "requester pays" feature
@Ignore("blocked by #3448")
@Test
public void testFileExistsRequesterPaysNoUserProject() throws IOException {
CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, "");
Expand Down Expand Up @@ -187,16 +185,15 @@ public void testFileExistsRequesterPaysWithAutodetect() throws IOException {
Files.exists(path);
}

@Ignore("blocked by #3448")
@Test
public void testCantCreateWithoutUserProject() throws IOException {
CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, "");
Path path = testBucket.getPath(SML_FILE);
Path path = testBucket.getPath(TMP_FILE);
try {
// fails
Files.write(path, "I would like to write".getBytes());
Assert.fail("It should have thrown an exception.");
} catch (StorageException ex) {
} catch (IOException ex) {
assertIsRequesterPaysException("testCantCreateWithoutUserProject", ex);
}
}
Expand All @@ -209,7 +206,6 @@ public void testCanCreateWithUserProject() throws IOException {
Files.write(path, "I would like to write, please?".getBytes());
}

@Ignore("blocked by #3448")
@Test
public void testCantReadWithoutUserProject() throws IOException {
CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, "");
Expand All @@ -231,7 +227,6 @@ public void testCanReadWithUserProject() throws IOException {
Files.readAllBytes(path);
}

@Ignore("blocked by #3448")
@Test
public void testCantCopyWithoutUserProject() throws IOException {
CloudStorageFileSystem testRPBucket = getRequesterPaysBucket(false, "");
Expand Down Expand Up @@ -324,6 +319,12 @@ private void assertIsRequesterPaysException(String message, StorageException ex)
ex.getMessage().contains("Bucket is requester pays bucket but no user project provided"));
}

private void assertIsRequesterPaysException(String message, IOException ioex) {
Assert.assertTrue(message, ioex.getMessage().startsWith("400"));
Assert.assertTrue(
message,
ioex.getMessage().contains("Bucket is requester pays bucket but no user project provided"));
}
// End of tests related to the "requester pays" feature

@Test
Expand Down