Skip to content

Commit

Permalink
NIO: Enabled blocked tests. Fixed testCantCreateWithoutUserProject te…
Browse files Browse the repository at this point in the history
…st. (#4182)

* 3448: Ublocked tests. Fixed testCantCreateWithoutUserProject test.

* 3448: Fixed code format.

* 3448: Fixed code format issue
  • Loading branch information
andrey-qlogic authored and chingor13 committed Dec 10, 2018
1 parent a6a2302 commit a9a7044
Showing 1 changed file with 8 additions and 7 deletions.
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

0 comments on commit a9a7044

Please sign in to comment.