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.tool;
019
020import org.apache.hadoop.hbase.HBaseTestingUtil;
021import org.apache.hadoop.hbase.security.HadoopSecurityEnabledUserProviderForTesting;
022import org.apache.hadoop.hbase.security.UserProvider;
023import org.apache.hadoop.hbase.security.access.PermissionStorage;
024import org.apache.hadoop.hbase.security.access.SecureTestUtil;
025import org.apache.hadoop.hbase.testclassification.LargeTests;
026import org.apache.hadoop.hbase.testclassification.MiscTests;
027import org.junit.jupiter.api.BeforeAll;
028import org.junit.jupiter.api.Disabled;
029import org.junit.jupiter.api.Tag;
030import org.junit.jupiter.api.Test;
031import org.junit.jupiter.api.TestInfo;
032
033/**
034 * Reruns TestBulkLoadHFilesSplitRecovery using BulkLoadHFiles in secure mode. This suite is unable
035 * to verify the security handoff/turnove as miniCluster is running as system user thus has root
036 * privileges and delegation tokens don't seem to work on miniDFS.
037 * <p/>
038 * Thus SecureBulkload can only be completely verified by running integration tests against a secure
039 * cluster. This suite is still invaluable as it verifies the other mechanisms that need to be
040 * supported as part of a LoadIncrementalFiles call.
041 */
042@Tag(MiscTests.TAG)
043@Tag(LargeTests.TAG)
044public class SecureBulkLoadHFilesSplitRecoveryTest extends BulkLoadHFilesSplitRecoveryTestBase {
045
046  // This "overrides" the parent static method
047  // make sure they are in sync
048  @BeforeAll
049  public static void setupCluster() throws Exception {
050    util = new HBaseTestingUtil();
051    // set the always on security provider
052    UserProvider.setUserProviderForTesting(util.getConfiguration(),
053      HadoopSecurityEnabledUserProviderForTesting.class);
054    // setup configuration
055    SecureTestUtil.enableSecurity(util.getConfiguration());
056
057    util.startMiniCluster();
058
059    // Wait for the ACL table to become available
060    util.waitTableEnabled(PermissionStorage.ACL_TABLE_NAME);
061  }
062
063  // Disabling this test as it does not work in secure mode
064  @Test
065  @Disabled
066  public void testBulkLoadPhaseFailure(TestInfo testInfo) {
067  }
068}