You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bb...@apache.org on 2023/12/19 20:48:38 UTC
(hbase) branch master updated: HBASE-28216 Addendum: protect against test order changes
This is an automated email from the ASF dual-hosted git repository.
bbeaudreault pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new 2c078476569 HBASE-28216 Addendum: protect against test order changes
2c078476569 is described below
commit 2c078476569a33b368a4823b7112ce30018c1d80
Author: Bryan Beaudreault <bb...@apache.org>
AuthorDate: Tue Dec 19 15:41:44 2023 -0500
HBASE-28216 Addendum: protect against test order changes
---
.../TestManageTableErasureCodingPolicy.java | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestManageTableErasureCodingPolicy.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestManageTableErasureCodingPolicy.java
index 91880c453a3..34a77229dca 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestManageTableErasureCodingPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestManageTableErasureCodingPolicy.java
@@ -154,9 +154,8 @@ public class TestManageTableErasureCodingPolicy {
@Test
public void testCreateTableErasureCodingSync() throws IOException {
- try (Admin admin = UTIL.getAdmin(); Table table = UTIL.getConnection().getTable(EC_TABLE)) {
- admin.createTable(EC_TABLE_DESC);
- UTIL.loadTable(table, FAMILY);
+ try (Admin admin = UTIL.getAdmin()) {
+ recreateTable(admin, EC_TABLE_DESC);
UTIL.flush(EC_TABLE);
Path rootDir = CommonFSUtils.getRootDir(UTIL.getConfiguration());
DistributedFileSystem dfs = (DistributedFileSystem) FileSystem.get(UTIL.getConfiguration());
@@ -164,6 +163,17 @@ public class TestManageTableErasureCodingPolicy {
}
}
+ private void recreateTable(Admin admin, TableDescriptor desc) throws IOException {
+ if (admin.tableExists(desc.getTableName())) {
+ admin.disableTable(desc.getTableName());
+ admin.deleteTable(desc.getTableName());
+ }
+ admin.createTable(desc);
+ try (Table table = UTIL.getConnection().getTable(desc.getTableName())) {
+ UTIL.loadTable(table, FAMILY);
+ }
+ }
+
@Test
public void testModifyTableErasureCodingSync() throws IOException, InterruptedException {
try (Admin admin = UTIL.getAdmin()) {
@@ -230,14 +240,7 @@ public class TestManageTableErasureCodingPolicy {
DistributedFileSystem dfs = (DistributedFileSystem) FileSystem.get(UTIL.getConfiguration());
// recreate EC test table and load it
- if (admin.tableExists(EC_TABLE)) {
- admin.disableTable(EC_TABLE);
- admin.deleteTable(EC_TABLE);
- }
- admin.createTable(EC_TABLE_DESC);
- try (Table table = UTIL.getConnection().getTable(EC_TABLE)) {
- UTIL.loadTable(table, FAMILY);
- }
+ recreateTable(admin, EC_TABLE_DESC);
// Take a snapshot, then clone it into a new table
admin.snapshot(snapshotName, EC_TABLE);