001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.util; 019 020import static org.junit.jupiter.api.Assertions.assertEquals; 021import static org.junit.jupiter.api.Assertions.assertFalse; 022 023import org.apache.hadoop.hbase.HBaseTestingUtil; 024import org.apache.hadoop.hbase.TableName; 025import org.apache.hadoop.hbase.replication.ReplicationStorageFactory; 026import org.apache.hadoop.hbase.testclassification.MediumTests; 027import org.apache.hadoop.hbase.testclassification.MiscTests; 028import org.apache.hadoop.hbase.util.hbck.HbckTestingUtil; 029import org.junit.jupiter.api.AfterEach; 030import org.junit.jupiter.api.BeforeEach; 031import org.junit.jupiter.api.Tag; 032import org.junit.jupiter.api.Test; 033import org.junit.jupiter.api.TestInfo; 034 035@Tag(MiscTests.TAG) 036@Tag(MediumTests.TAG) 037public class TestHBaseFsckWithoutTableHbaseReplication { 038 039 private static final HBaseTestingUtil UTIL = new HBaseTestingUtil(); 040 041 @BeforeEach 042 public void setUp(TestInfo testInfo) throws Exception { 043 UTIL.getConfiguration().setBoolean("hbase.write.hbck1.lock.file", false); 044 TableName tableName = 045 TableName.valueOf("replication_" + testInfo.getTestMethod().get().getName()); 046 UTIL.getConfiguration().set(ReplicationStorageFactory.REPLICATION_QUEUE_TABLE_NAME, 047 tableName.getNameAsString()); 048 UTIL.startMiniCluster(1); 049 } 050 051 @AfterEach 052 public void tearDown() throws Exception { 053 UTIL.shutdownMiniCluster(); 054 } 055 056 @Test 057 public void test(TestInfo testInfo) throws Exception { 058 TableName tableName = 059 TableName.valueOf("replication_" + testInfo.getTestMethod().get().getName()); 060 assertFalse(UTIL.getAdmin().tableExists(tableName)); 061 HBaseFsck hBaseFsck = HbckTestingUtil.doFsck(UTIL.getConfiguration(), true); 062 assertEquals(0, hBaseFsck.getRetCode()); 063 } 064}