Skip to content

Commit

Permalink
Test that a single bad Get ruins a whole batch.
Browse files Browse the repository at this point in the history
  • Loading branch information
carterpage committed Jun 3, 2014
1 parent f868cf4 commit 655eafd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/test/java/com/google/cloud/anviltop/hbase/TestGet.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,37 @@ public void testExists() throws IOException {
Assert.assertTrue(exists[i]);
}
}

/**
* Requirement 3.16 - When submitting an array of Get operations, if one fails, they all fail.
*/
@Test
public void testOneBadApple() throws IOException {
// Initialize data
HTableInterface table = connection.getTable(TABLE_NAME);
int numValues = 10;

// Run a control test.
List<Get> gets = new ArrayList<Get>(numValues + 1);
for (int i = 0; i < numValues; ++i) {
Get get = new Get(randomData("key-"));
get.addColumn(COLUMN_FAMILY, randomData("qual-"));
gets.add(get);
}
table.get(gets);

// Now add a poison get.
Get get = new Get(randomData("testRow-"));
get.addColumn(randomData("badFamily-"), randomData("qual-"));
gets.add(get);

boolean throwsException = false;
try {
table.get(gets);
} catch (RetriesExhaustedWithDetailsException e) {
throwsException = true;
Assert.assertEquals(1, e.getNumExceptions());
}
Assert.assertTrue("Expected an exception", throwsException);
}
}

0 comments on commit 655eafd

Please sign in to comment.