Skip to content

Commit 0c55f6e

Browse files
committed
update
1 parent f163c4d commit 0c55f6e

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
import org.apache.hadoop.conf.Configuration;
2929
import org.apache.hadoop.fs.Path;
3030
import org.apache.hadoop.hbase.HBaseTestingUtility;
31+
import org.apache.hadoop.hbase.HColumnDescriptor;
3132
import org.apache.hadoop.hbase.HConstants;
33+
import org.apache.hadoop.hbase.HTableDescriptor;
3234
import org.apache.hadoop.hbase.TableName;
3335
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
3436
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
@@ -63,7 +65,7 @@ public class TestHBaseFsckEncryption {
6365
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
6466

6567
private Configuration conf;
66-
private TableDescriptor tableDescriptor;
68+
private HTableDescriptor htd;
6769
private Key cfKey;
6870

6971
@BeforeEach
@@ -83,18 +85,15 @@ public void setUp() throws Exception {
8385
TEST_UTIL.startMiniCluster(3);
8486

8587
// Create the table
86-
TableDescriptorBuilder tableDescriptorBuilder =
87-
TableDescriptorBuilder.newBuilder(TableName.valueOf("default", "TestHBaseFsckEncryption"));
88-
ColumnFamilyDescriptor columnFamilyDescriptor =
89-
ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes("cf")).setEncryptionType(algorithm)
90-
.setEncryptionKey(EncryptionUtil.wrapKey(conf,
91-
conf.get(HConstants.CRYPTO_MASTERKEY_NAME_CONF_KEY, User.getCurrent().getShortName()),
92-
cfKey))
93-
.build();
94-
tableDescriptorBuilder.setColumnFamily(columnFamilyDescriptor);
95-
tableDescriptor = tableDescriptorBuilder.build();
96-
TEST_UTIL.getAdmin().createTable(tableDescriptor);
97-
TEST_UTIL.waitTableAvailable(tableDescriptor.getTableName(), 5000);
88+
htd = new HTableDescriptor(TableName.valueOf("default", "TestHBaseFsckEncryption"));
89+
HColumnDescriptor hcd = new HColumnDescriptor("cf");
90+
hcd.setEncryptionType(algorithm);
91+
hcd.setEncryptionKey(EncryptionUtil.wrapKey(conf,
92+
conf.get(HConstants.CRYPTO_MASTERKEY_NAME_CONF_KEY, User.getCurrent().getShortName()),
93+
cfKey));
94+
htd.addFamily(hcd);
95+
TEST_UTIL.getAdmin().createTable(htd);
96+
TEST_UTIL.waitTableAvailable(htd.getTableName(), 5000);
9897
}
9998

10099
@AfterEach
@@ -105,7 +104,7 @@ public void tearDown() throws Exception {
105104
@Test
106105
public void testFsckWithEncryption() throws Exception {
107106
// Populate the table with some data
108-
Table table = TEST_UTIL.getConnection().getTable(tableDescriptor.getTableName());
107+
Table table = TEST_UTIL.getConnection().getTable(htd.getTableName());
109108
try {
110109
byte[] values = { 'A', 'B', 'C', 'D' };
111110
for (int i = 0; i < values.length; i++) {
@@ -119,18 +118,18 @@ public void testFsckWithEncryption() throws Exception {
119118
table.close();
120119
}
121120
// Flush it
122-
TEST_UTIL.getAdmin().flush(tableDescriptor.getTableName());
121+
TEST_UTIL.getAdmin().flush(htd.getTableName());
123122

124123
// Verify we have encrypted store files on disk
125-
final List<Path> paths = findStorefilePaths(tableDescriptor.getTableName());
124+
final List<Path> paths = findStorefilePaths(htd.getTableName());
126125
assertTrue(paths.size() > 0);
127126
for (Path path : paths) {
128127
assertTrue(Bytes.equals(cfKey.getEncoded(), extractHFileKey(path)),
129128
"Store file " + path + " has incorrect key");
130129
}
131130

132131
// Insure HBck doesn't consider them corrupt
133-
HBaseFsck res = HbckTestingUtil.doHFileQuarantine(conf, tableDescriptor.getTableName());
132+
HBaseFsck res = HbckTestingUtil.doHFileQuarantine(conf, htd.getTableName());
134133
assertEquals(0, res.getRetCode());
135134
HFileCorruptionChecker hfcc = res.getHFilecorruptionChecker();
136135
assertEquals(0, hfcc.getCorrupted().size());
@@ -142,7 +141,7 @@ public void testFsckWithEncryption() throws Exception {
142141
private List<Path> findStorefilePaths(TableName tableName) throws Exception {
143142
List<Path> paths = new ArrayList<>();
144143
for (Region region : TEST_UTIL.getRSForFirstRegionInTable(tableName)
145-
.getRegions(tableDescriptor.getTableName())) {
144+
.getRegions(htd.getTableName())) {
146145
for (HStore store : ((HRegion) region).getStores()) {
147146
for (HStoreFile storefile : store.getStorefiles()) {
148147
paths.add(storefile.getPath());

hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIdReadWriteLock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
import org.slf4j.Logger;
4444
import org.slf4j.LoggerFactory;
4545

46-
@HBaseParameterizedTestTemplate
4746
@Tag(MiscTests.TAG)
4847
@Tag(MediumTests.TAG)
48+
@HBaseParameterizedTestTemplate
4949
// Medium as it creates 100 threads; seems better to run it isolated
5050
public class TestIdReadWriteLock {
5151

hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestOutputSinkWriter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
import org.apache.hadoop.fs.Path;
2727
import org.apache.hadoop.hbase.testclassification.MediumTests;
2828
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
29+
import org.apache.hadoop.hbase.testclassification.SmallTests;
2930
import org.junit.jupiter.api.Tag;
3031
import org.junit.jupiter.api.Test;
3132

3233
@Tag(RegionServerTests.TAG)
33-
@Tag(MediumTests.TAG)
34+
@Tag(SmallTests.TAG)
3435
public class TestOutputSinkWriter {
3536

3637
@Test

hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALOpenAfterDNRollingStart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
@Tag(RegionServerTests.TAG)
4040
@Tag(LargeTests.TAG)
41-
@HBaseParameterizedTestTemplate
41+
@HBaseParameterizedTestTemplate(name = "{index}: wal={0}")
4242
public class TestWALOpenAfterDNRollingStart {
4343

4444
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

0 commit comments

Comments
 (0)