-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-22382 Refactor tests in TestFromClientSide #385
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f2d99cc
HBASE-22382. Refactored testNull() into multiple tests
anmolnar 8536682
HBASE-22382. Suppress checkstyle warning on testVersionLimits() and t…
anmolnar dfe1d5b
HBASE-22382. Change test naming to camel case
anmolnar ddcd7ef
HBASE-22382. Refactored test to take advantage of JUnit expected exce…
anmolnar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1155,21 +1155,25 @@ public void testSingleRowMultipleFamily() throws Exception { | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testNull() throws Exception { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
|
|
||
| @Test(expected = IOException.class) | ||
| public void testNullTableName() throws IOException { | ||
| // Null table name (should NOT work) | ||
| try { | ||
| TEST_UTIL.createTable((TableName)null, FAMILY); | ||
| fail("Creating a table with null name passed, should have failed"); | ||
| } catch(Exception e) {} | ||
| TEST_UTIL.createTable((TableName)null, FAMILY); | ||
| fail("Creating a table with null name passed, should have failed"); | ||
| } | ||
|
|
||
| @Test(expected = IOException.class) | ||
| public void testNullFamilyName() throws IOException { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
|
|
||
| // Null family (should NOT work) | ||
| try { | ||
| TEST_UTIL.createTable(tableName, new byte[][]{null}); | ||
| fail("Creating a table with a null family passed, should fail"); | ||
| } catch(Exception e) {} | ||
| TEST_UTIL.createTable(tableName, new byte[][]{null}); | ||
| fail("Creating a table with a null family passed, should fail"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testNullRowAndQualifier() throws Exception { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
|
|
||
| try (Table ht = TEST_UTIL.createTable(tableName, FAMILY)) { | ||
|
|
||
|
|
@@ -1201,9 +1205,13 @@ public void testNull() throws Exception { | |
| assertEmptyResult(result); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Use a new table | ||
| try (Table ht = TEST_UTIL.createTable(TableName.valueOf(name.getMethodName() + "2"), FAMILY)) { | ||
| @Test | ||
| public void testNullEmptyQualifier() throws Exception { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
|
|
||
| try (Table ht = TEST_UTIL.createTable(tableName, FAMILY)) { | ||
|
|
||
| // Empty qualifier, byte[0] instead of null (should work) | ||
| try { | ||
|
|
@@ -1232,9 +1240,16 @@ public void testNull() throws Exception { | |
| assertEmptyResult(result); | ||
|
|
||
| } catch (Exception e) { | ||
| throw new IOException("Using a row with null qualifier threw exception, should "); | ||
| throw new IOException("Using a row with null qualifier should not throw exception"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testNullValue() throws IOException { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
|
|
||
| try (Table ht = TEST_UTIL.createTable(tableName, FAMILY)) { | ||
| // Null value | ||
| try { | ||
| Put put = new Put(ROW); | ||
|
|
@@ -1550,6 +1565,7 @@ public void testVersions() throws Exception { | |
| } | ||
|
|
||
| @Test | ||
| @SuppressWarnings("checkstyle:MethodLength") | ||
| public void testVersionLimits() throws Exception { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
| byte [][] FAMILIES = makeNAscii(FAMILY, 3); | ||
|
|
@@ -5965,6 +5981,7 @@ public void testNullWithReverseScan() throws Exception { | |
| } | ||
|
|
||
| @Test | ||
| @SuppressWarnings("checkstyle:MethodLength") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
| public void testDeletesWithReverseScan() throws Exception { | ||
| final TableName tableName = TableName.valueOf(name.getMethodName()); | ||
| byte[][] ROWS = makeNAscii(ROW, 6); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in the future we will also split these methods so let's do not suppress the warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do so. But it seems to me that these tests are doing a sequence of operations which cannot be broken without doing a lot of redundant initialisation logic. I believe that the gain of making these tests smaller doesn't overcome the hit on the efficiency.
To be honest, checkstyle rule for maximizing the size of integration tests doesn't make sense to me.