Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions hbase-backup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.HFileTestUtil;
import org.junit.jupiter.api.BeforeAll;

import org.apache.hbase.thirdparty.com.google.common.base.Throwables;

Expand All @@ -47,10 +46,8 @@ public class IncrementalBackupRestoreTestBase extends TestBackupBase {
private static final byte[] BULKLOAD_START_KEY = new byte[] { 0x00 };
private static final byte[] BULKLOAD_END_KEY = new byte[] { Byte.MAX_VALUE };

@BeforeAll
public static void setUp() throws Exception {
static {
provider = "multiwal";
TestBackupBase.setUp();
}

protected void checkThrowsCFMismatch(IOException ex, List<TableName> tables) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
import org.apache.hadoop.hbase.wal.WALFactory;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -120,7 +117,6 @@ public IncrementalTableBackupClientForTest(Connection conn, String backupId,
}

@BeforeEach
@Before
public void ensurePreviousBackupTestsAreCleanedUp() throws Exception {
// Every operation here may not be necessary for any given test,
// some often being no-ops. the goal is to help ensure atomicity
Expand Down Expand Up @@ -348,7 +344,6 @@ public static void setUpHelper() throws Exception {
* @throws Exception if starting the mini cluster or setting up the tables fails
*/
@BeforeAll
@BeforeClass
public static void setUp() throws Exception {
TEST_UTIL = new HBaseTestingUtil();
conf1 = TEST_UTIL.getConfiguration();
Expand All @@ -366,7 +361,6 @@ private static void populateFromMasterConfig(Configuration masterConf, Configura
}

@AfterAll
@AfterClass
public static void tearDown() throws Exception {
try {
SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getAdmin());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,22 @@
*/
package org.apache.hadoop.hbase.backup;

import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.IOException;
import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.collect.Lists;

@Category(LargeTests.class)
@Tag(LargeTests.TAG)
public class TestBackupBoundaryTests extends TestBackupBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestBackupBoundaryTests.class);

private static final Logger LOG = LoggerFactory.getLogger(TestBackupBoundaryTests.class);

/**
Expand Down Expand Up @@ -66,33 +62,39 @@ public void testFullBackupMultipleEmpty() throws Exception {
* Verify that full backup fails on a single table that does not exist.
* @throws Exception if doing the full backup fails
*/
@Test(expected = IOException.class)
@Test
public void testFullBackupSingleDNE() throws Exception {
LOG.info("test full backup fails on a single table that does not exist");
List<TableName> tables = toList("tabledne");
fullTableBackup(tables);
assertThrows(IOException.class, () -> {
LOG.info("test full backup fails on a single table that does not exist");
List<TableName> tables = toList("tabledne");
fullTableBackup(tables);
});
}

/**
* Verify that full backup fails on multiple tables that do not exist.
* @throws Exception if doing the full backup fails
*/
@Test(expected = IOException.class)
@Test
public void testFullBackupMultipleDNE() throws Exception {
LOG.info("test full backup fails on multiple tables that do not exist");
List<TableName> tables = toList("table1dne", "table2dne");
fullTableBackup(tables);
assertThrows(IOException.class, () -> {
LOG.info("test full backup fails on multiple tables that do not exist");
List<TableName> tables = toList("table1dne", "table2dne");
fullTableBackup(tables);
});
}

/**
* Verify that full backup fails on tableset containing real and fake tables.
* @throws Exception if doing the full backup fails
*/
@Test(expected = IOException.class)
@Test
public void testFullBackupMixExistAndDNE() throws Exception {
LOG.info("create full backup fails on tableset containing real and fake table");
assertThrows(IOException.class, () -> {
LOG.info("create full backup fails on tableset containing real and fake table");

List<TableName> tables = toList(table1.getNameAsString(), "tabledne");
fullTableBackup(tables);
List<TableName> tables = toList(table1.getNameAsString(), "tabledne");
fullTableBackup(tables);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,22 @@
*/
package org.apache.hadoop.hbase.backup;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.util.ToolRunner;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category(SmallTests.class)
@Tag(SmallTests.TAG)
public class TestBackupCommandLineTool {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestBackupCommandLineTool.class);

private final static String USAGE_DESCRIBE = "Usage: hbase backup describe <backup_id>";
private final static String USAGE_CREATE = "Usage: hbase backup create";
private final static String USAGE_HISTORY = "Usage: hbase backup history";
Expand All @@ -50,7 +44,7 @@ public class TestBackupCommandLineTool {

Configuration conf;

@Before
@BeforeEach
public void setUpBefore() throws Exception {
conf = HBaseConfiguration.create();
conf.setBoolean(BackupRestoreConstants.BACKUP_ENABLE_KEY, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,32 @@
*/
package org.apache.hadoop.hbase.backup;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.List;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.EnvironmentEdge;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.util.ToolRunner;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
import org.apache.hbase.thirdparty.com.google.common.collect.Sets;

@Category(LargeTests.class)
@Tag(LargeTests.TAG)
public class TestBackupDelete extends TestBackupBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestBackupDelete.class);

private static final Logger LOG = LoggerFactory.getLogger(TestBackupDelete.class);

/**
Expand Down Expand Up @@ -138,7 +132,7 @@ public long currentTime() {
assertTrue(ret == 0);
} catch (Exception e) {
LOG.error("failed", e);
Assert.fail(e.getMessage());
fail(e.getMessage());
}
String output = baos.toString();
LOG.info(baos.toString());
Expand All @@ -154,7 +148,7 @@ public long currentTime() {
assertTrue(ret == 0);
} catch (Exception e) {
LOG.error("failed", e);
Assert.fail(e.getMessage());
fail(e.getMessage());
}
output = baos.toString();
LOG.info(baos.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,27 @@
*/
package org.apache.hadoop.hbase.backup;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.util.BackupUtils;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.collect.Lists;

@Category(LargeTests.class)
@Tag(LargeTests.TAG)
public class TestBackupDeleteRestore extends TestBackupBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestBackupDeleteRestore.class);

private static final Logger LOG = LoggerFactory.getLogger(TestBackupDeleteRestore.class);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
*/
package org.apache.hadoop.hbase.backup;

import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
Expand All @@ -42,10 +41,9 @@
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.util.ToolRunner;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -56,13 +54,9 @@
* TestBackupSmallTests is where tests that don't require bring machines up/down should go All other
* tests should have their own classes and extend this one
*/
@Category(LargeTests.class)
@Tag(LargeTests.TAG)
public class TestBackupDeleteWithFailures extends TestBackupBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestBackupDeleteWithFailures.class);

private static final Logger LOG = LoggerFactory.getLogger(TestBackupDeleteWithFailures.class);

public enum Failure {
Expand Down Expand Up @@ -117,7 +111,7 @@ public void postDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx
* Setup Cluster with appropriate configurations before running tests.
* @throws Exception if starting the mini cluster or setting up the tables fails
*/
@BeforeClass
@BeforeAll
public static void setUp() throws Exception {
TEST_UTIL = new HBaseTestingUtil();
conf1 = TEST_UTIL.getConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,28 @@
*/
package org.apache.hadoop.hbase.backup;

import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
import org.apache.hadoop.hbase.backup.impl.BackupCommands;
import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.util.ToolRunner;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.collect.Lists;

@Category(LargeTests.class)
@Tag(LargeTests.TAG)
public class TestBackupDescribe extends TestBackupBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestBackupDescribe.class);

private static final Logger LOG = LoggerFactory.getLogger(TestBackupDescribe.class);

/**
Expand Down
Loading