HBASE-21160 Assertion in TestVisibilityLabelsWithDeletes#testDeleteColumnsWithoutAndWithVisibilityLabels is ignored (liubangchen)
This commit is contained in:
parent
6d7bc0e98b
commit
1cf920db43
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue