You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2018/09/17 15:25:19 UTC
hbase git commit: HBASE-21160 Assertion in
TestVisibilityLabelsWithDeletes#testDeleteColumnsWithoutAndWithVisibilityLabels
is ignored (liubangchen)
Repository: hbase
Updated Branches:
refs/heads/master 6d7bc0e98 -> 1cf920db4
HBASE-21160 Assertion in TestVisibilityLabelsWithDeletes#testDeleteColumnsWithoutAndWithVisibilityLabels is ignored (liubangchen)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1cf920db
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1cf920db
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1cf920db
Branch: refs/heads/master
Commit: 1cf920db4395926c634ed0946a57dfa52227472f
Parents: 6d7bc0e
Author: tedyu <yu...@gmail.com>
Authored: Mon Sep 17 08:25:11 2018 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Mon Sep 17 08:25:11 2018 -0700
----------------------------------------------------------------------
.../visibility/TestVisibilityLabels.java | 9 ++++----
...ibilityLabelsWithDefaultVisLabelService.java | 23 ++++++++++----------
.../TestVisibilityLabelsWithDeletes.java | 20 -----------------
3 files changed, 16 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/1cf920db/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
index e106434..770bf3e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
@@ -423,6 +423,7 @@ public abstract class TestVisibilityLabels {
try (Connection conn = ConnectionFactory.createConnection(conf)) {
VisibilityClient.setAuths(conn, auths, user);
} catch (Throwable e) {
+ throw new IOException(e);
}
return null;
}
@@ -450,7 +451,7 @@ public abstract class TestVisibilityLabels {
try (Connection conn = ConnectionFactory.createConnection(conf)) {
authsResponse = VisibilityClient.getAuths(conn, user);
} catch (Throwable e) {
- fail("Should not have failed");
+ throw new IOException(e);
}
List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
@@ -475,7 +476,7 @@ public abstract class TestVisibilityLabels {
try {
authsResponse = VisibilityClient.getAuths(conn, user);
} catch (Throwable e) {
- fail("Should not have failed");
+ throw new IOException(e);
}
} catch (Throwable e) {
}
@@ -515,7 +516,7 @@ public abstract class TestVisibilityLabels {
try (Connection conn = ConnectionFactory.createConnection(conf)) {
VisibilityClient.setAuths(conn, auths, user);
} catch (Throwable e) {
- fail("Should not have failed");
+ throw new IOException(e);
}
// Removing the auths for SECRET and CONFIDENTIAL for the user.
// Passing a non existing auth also.
@@ -553,7 +554,7 @@ public abstract class TestVisibilityLabels {
try (Connection conn = ConnectionFactory.createConnection(conf)) {
authsResponse = VisibilityClient.getAuths(conn, user);
} catch (Throwable e) {
- fail("Should not have failed");
+ throw new IOException(e);
}
List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/1cf920db/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
index 0d7ff68..5f8acfb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
@@ -22,7 +22,6 @@ import static org.apache.hadoop.hbase.security.visibility.VisibilityUtils.SYSTEM
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import com.google.protobuf.ByteString;
import java.io.IOException;
@@ -94,7 +93,7 @@ public class TestVisibilityLabelsWithDefaultVisLabelService extends TestVisibili
try (Connection conn = ConnectionFactory.createConnection(conf)) {
response = VisibilityClient.addLabels(conn, labels);
} catch (Throwable e) {
- fail("Should not have thrown exception");
+ throw new IOException(e);
}
List<RegionActionResult> resultList = response.getResultList();
assertEquals(5, resultList.size());
@@ -183,7 +182,7 @@ public class TestVisibilityLabelsWithDefaultVisLabelService extends TestVisibili
try (Connection conn = ConnectionFactory.createConnection(conf)) {
response = VisibilityClient.listLabels(conn, null);
} catch (Throwable e) {
- fail("Should not have thrown exception");
+ throw new IOException(e);
}
// The addLabels() in setup added:
// { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE, COPYRIGHT, ACCENT,
@@ -192,12 +191,12 @@ public class TestVisibilityLabelsWithDefaultVisLabelService extends TestVisibili
// The 'system' label is excluded.
List<ByteString> labels = response.getLabelList();
assertEquals(12, labels.size());
- assertTrue(labels.contains(ByteString.copyFrom(SECRET.getBytes())));
- assertTrue(labels.contains(ByteString.copyFrom(TOPSECRET.getBytes())));
- assertTrue(labels.contains(ByteString.copyFrom(CONFIDENTIAL.getBytes())));
- assertTrue(labels.contains(ByteString.copyFrom("ABC".getBytes())));
- assertTrue(labels.contains(ByteString.copyFrom("XYZ".getBytes())));
- assertFalse(labels.contains(ByteString.copyFrom(SYSTEM_LABEL.getBytes())));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes(SECRET))));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes(TOPSECRET))));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes(CONFIDENTIAL))));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes("ABC"))));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes("XYZ"))));
+ assertFalse(labels.contains(ByteString.copyFrom(Bytes.toBytes(SYSTEM_LABEL))));
return null;
}
};
@@ -214,13 +213,13 @@ public class TestVisibilityLabelsWithDefaultVisLabelService extends TestVisibili
try (Connection conn = ConnectionFactory.createConnection(conf)) {
response = VisibilityClient.listLabels(conn, ".*secret");
} catch (Throwable e) {
- fail("Should not have thrown exception");
+ throw new IOException(e);
}
// Only return the labels that end with 'secret'
List<ByteString> labels = response.getLabelList();
assertEquals(2, labels.size());
- assertTrue(labels.contains(ByteString.copyFrom(SECRET.getBytes())));
- assertTrue(labels.contains(ByteString.copyFrom(TOPSECRET.getBytes())));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes(SECRET))));
+ assertTrue(labels.contains(ByteString.copyFrom(Bytes.toBytes(TOPSECRET))));
return null;
}
};
http://git-wip-us.apache.org/repos/asf/hbase/blob/1cf920db/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
index b0cabed..405a7fa 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
@@ -313,8 +313,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(1, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -334,8 +332,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -366,8 +362,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -386,8 +380,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -417,8 +409,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(1, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -438,8 +428,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -470,8 +458,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -490,8 +476,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -522,8 +506,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
// The delete would not be able to apply it because of visibility mismatch
Result[] next = scanner.next(3);
assertEquals(1, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}
@@ -544,8 +526,6 @@ public class TestVisibilityLabelsWithDeletes extends VisibilityLabelsWithDeletes
Result[] next = scanner.next(3);
// this will alone match
assertEquals(0, next.length);
- } catch (Throwable t) {
- throw new IOException(t);
}
return null;
}