http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/HBaseTestUtils.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/HBaseTestUtils.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/HBaseTestUtils.groovy deleted file mode 100644 index 590e5a1..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/HBaseTestUtils.groovy +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.hadoop.hbase.HBaseConfiguration -import org.apache.hadoop.hbase.HConstants -import org.apache.hadoop.hbase.ServerName -import org.apache.hadoop.hbase.client.HBaseAdmin -import org.apache.hadoop.hbase.client.HConnection -import org.apache.hadoop.hbase.client.HConnectionManager -import org.apache.hadoop.hbase.client.RetriesExhaustedException -import org.apache.slider.common.SliderKeys -import org.apache.slider.api.ClusterDescription -import org.apache.slider.core.exceptions.SliderException -import org.apache.slider.core.exceptions.WaitTimeoutException -import org.apache.slider.test.SliderTestUtils -import org.apache.slider.common.tools.ConfigHelper -import org.apache.slider.common.tools.Duration -import org.apache.slider.client.SliderClient - -/** - * Static HBase test utils - */ -@Slf4j -@CompileStatic -class HBaseTestUtils extends SliderTestUtils { - - /** - * Create an (unshared) HConnection talking to the hbase service that - * Slider should be running - * @param sliderClient slider client - * @param clustername the name of the Slider cluster - * @return the connection - */ - public static HConnection createHConnection(Configuration clientConf) { - HConnection hbaseConnection = HConnectionManager.createConnection( - clientConf); - return hbaseConnection - } - - /** - * get a string representation of an HBase cluster status - * @param status cluster status - * @return a summary for printing - */ - public static String hbaseStatusToString(ClusterStatus status) { - StringBuilder builder = new StringBuilder(); - builder << "Cluster " << status.clusterId; - builder << " @ " << status.master << " version " << status.HBaseVersion; - builder << "\nlive [\n" - if (!status.servers.empty) { - status.servers.each() { ServerName name -> - builder << " Server " << name << " :" << status.getLoad(name) << "\n" - } - } else { - } - builder << "]\n" - if (status.deadServers > 0) { - builder << "\n dead servers=${status.deadServers}" - } - return builder.toString() - } - - public static ClusterStatus getHBaseClusterStatus(SliderClient sliderClient) { - Configuration clientConf = createHBaseConfiguration(sliderClient) - return getHBaseClusterStatus(clientConf) - } - - public static ClusterStatus getHBaseClusterStatus(Configuration clientConf) { - try { - HConnection hbaseConnection1 = createHConnection(clientConf) - HConnection hbaseConnection = hbaseConnection1; - HBaseAdmin hBaseAdmin = new HBaseAdmin(hbaseConnection); - ClusterStatus hBaseClusterStatus = hBaseAdmin.clusterStatus; - return hBaseClusterStatus; - } catch (NoSuchMethodError e) { - throw new Exception("Using an incompatible version of HBase!", e); - } - } - - /** - * Create an HBase config to work with - * @param sliderClient slider client - * @param clustername cluster - * @return an hbase config extended with the custom properties from the - * cluster, including the binding to the HBase cluster - */ - public static Configuration createHBaseConfiguration(SliderClient sliderClient) { - Configuration siteConf = fetchClientSiteConfig(sliderClient); - Configuration conf = HBaseConfiguration.create(siteConf); - // patch in some timeouts - conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 10) - conf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 5000) - - //fixed time of 1 s per attempt, not any multiplicative pause - conf.setInt(HConstants.HBASE_CLIENT_PAUSE, 100) - conf.setInt("hbase.client.retries.longer.multiplier", 1) - return conf - } - - /** - * Ask the AM for the site configuration -then dump it - * @param sliderClient - * @param clustername - */ - public static void dumpHBaseClientConf(SliderClient sliderClient) { - Configuration conf = fetchClientSiteConfig(sliderClient); - describe("AM-generated site configuration"); - ConfigHelper.dumpConf(conf); - } - - /** - * Create a full HBase configuration by merging the AM data with - * the rest of the local settings. This is the config that would - * be used by any clients - * @param sliderClient slider client - * @param clustername name of the cluster - */ - public static void dumpFullHBaseConf(SliderClient sliderClient) { - Configuration conf = createHBaseConfiguration(sliderClient); - describe("HBase site configuration from AM"); - ConfigHelper.dumpConf(conf); - } - - /** - * Wait for the hbase master to be live (or past it in the lifecycle) - * @param clustername cluster - * @param spintime time to wait - * @return true if the cluster came out of the sleep time live - * @throws IOException - * @throws org.apache.slider.core.exceptions.SliderException - */ - public static boolean spinForClusterStartup( - SliderClient sliderClient, - long spintime, - String role = "master") - throws WaitTimeoutException, IOException, SliderException { - int state = sliderClient.waitForRoleInstanceLive(role, spintime); - return state == ClusterDescription.STATE_LIVE; - } - - public static ClusterStatus basicHBaseClusterStartupSequence( - SliderClient sliderClient, int startupTime, int startupToLiveTime ) { - int state = sliderClient.waitForRoleInstanceLive(SliderKeys.COMPONENT_AM, - startupTime); - assert state == ClusterDescription.STATE_LIVE; - state = sliderClient.waitForRoleInstanceLive(HBaseKeys.ROLE_MASTER, - startupTime); - assert state == ClusterDescription.STATE_LIVE; - //sleep for a bit to give things a chance to go live - assert spinForClusterStartup( - sliderClient, - startupToLiveTime, - HBaseKeys.MASTER); - - //grab the conf from the status and verify the ZK binding matches - - ClusterStatus clustat = getHBaseClusterStatus(sliderClient); - describe("HBASE CLUSTER STATUS \n " + hbaseStatusToString(clustat)); - return clustat; - } - - /** - * Spin waiting for the RS count to match expected - * @param sliderClient client - * @param clustername cluster name - * @param regionServerCount RS count - * @param timeout timeout - */ - public static ClusterStatus waitForHBaseRegionServerCount( - SliderClient sliderClient, - String clustername, - int regionServerCount, - int timeout) { - Duration duration = new Duration(timeout); - duration.start(); - ClusterStatus clustat = null; - Configuration clientConf = createHBaseConfiguration(sliderClient) - while (true) { - clustat = getHBaseClusterStatus(clientConf); - int workerCount = clustat.servers.size(); - if (workerCount >= regionServerCount) { - break; - } - if (duration.limitExceeded) { - describe("Cluster region server count of $regionServerCount not met:"); - log.info(hbaseStatusToString(clustat)); - ClusterDescription status = sliderClient.getClusterDescription( - clustername); - fail("Expected $regionServerCount YARN region servers," + - " but after $timeout millis saw $workerCount in ${hbaseStatusToString(clustat)}" + - " \n ${prettyPrint(status.toJsonString())}"); - } - log.info( - "Waiting for $regionServerCount region servers -got $workerCount"); - Thread.sleep(1000); - } - return clustat; - } - - /** - * Probe to test for the HBasemaster being found - * @param clientConf client configuration - * @return true if the master was found in the hbase cluster status - */ - public static boolean isHBaseMasterFound(Configuration clientConf) { - HConnection hbaseConnection - hbaseConnection = createHConnection(clientConf) - HBaseAdmin hBaseAdmin = new HBaseAdmin(hbaseConnection); - boolean masterFound - try { - ClusterStatus hBaseClusterStatus = hBaseAdmin.getClusterStatus(); - masterFound = true; - } catch (RetriesExhaustedException e) { - masterFound = false; - } - return masterFound - } - - /** - * attempt to talk to the hbase master; expect a failure - * @param clientConf client config - */ - public static void assertNoHBaseMaster( - SliderClient sliderClient, - Configuration clientConf) { - boolean masterFound = isHBaseMasterFound(clientConf) - if (masterFound) { - def text = "HBase master is unexpectedly running" - dumpClusterStatus(sliderClient, text); - fail(text) - } - } - - /** - * attempt to talk to the hbase master; expect success - * @param clientConf client config - */ - public static void assertHBaseMasterFound(Configuration clientConf) { - boolean masterFound = isHBaseMasterFound(clientConf) - if (!masterFound) { - fail("HBase master not running") - } - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/HBaseMiniClusterTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/HBaseMiniClusterTestBase.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/HBaseMiniClusterTestBase.groovy deleted file mode 100644 index 7712a83..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/HBaseMiniClusterTestBase.groovy +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.hadoop.hbase.client.HConnection -import org.apache.slider.api.ClusterDescription -import org.apache.slider.api.ClusterNode -import org.apache.slider.api.ResourceKeys -import org.apache.slider.client.SliderClient -import org.apache.slider.core.main.ServiceLauncher -import org.apache.slider.providers.hbase.HBaseTestUtils -import org.apache.slider.test.YarnZKMiniClusterTestBase -import org.junit.internal.AssumptionViolatedException - -import static org.apache.slider.common.params.Arguments.* -import static org.apache.slider.test.SliderTestUtils.* -import static org.apache.slider.common.SliderXMLConfKeysForTesting.* -import static org.apache.slider.providers.hbase.HBaseKeys.* -/** - * test base for all hbase clusters - */ -@CompileStatic -@Slf4j -public abstract class HBaseMiniClusterTestBase extends YarnZKMiniClusterTestBase { - - public int hbaseClusterStartupTime = hbaseLaunchWaitTime - - /** - * The time to sleep before trying to talk to the HBase Master and - * expect meaningful results. - */ - public int hbaseClusterStartupToLiveTime = hbaseClusterStartupTime - - public static final String HREGION = "HRegion" - public static final String HMASTER = "HMaster" - public static final String HB_HEAP = "256" - - - @Override - public String getTestConfigurationPath() { - return "src/main/resources/" + HBASE_CONF_RESOURCE; - } - - @Override - void setup() { - super.setup() - def testConf = testConfiguration - assumeBoolOption(testConf, KEY_TEST_HBASE_ENABLED, true) - assumeArchiveDefined(); - assumeApplicationHome(); - } - - /** - * Teardown kills region servers - */ - @Override - void teardown() { - super.teardown(); - if (teardownKillall) { - try { - killAllRegionServers(); - killAllMasterServers(); - } catch (AssumptionViolatedException e) { - log.info e.toString(); - } - } - } - - /** - * Kill all the region servers - * <code> - * jps -l | grep HRegion | awk '{print $1}' | kill -9 - * </code> - */ - public void killAllRegionServers() { - killJavaProcesses(HREGION, SIGKILL); - } - - /** - * Kill all master servers - */ - public void killAllMasterServers() { - killJavaProcesses(HMASTER, SIGKILL); - } - - /** - * Stop all the region servers - * <code> - * jps -l | grep HRegion | awk '{print $1}' | kill -19 - * </code> - */ - public void stopAllRegionServers() { - killJavaProcesses(HREGION, SIGTERM); - } - - - public static void assertHBaseMasterNotStopped(SliderClient sliderClient, - String clustername) { - String[] nodes = sliderClient.listNodeUUIDsByRole(ROLE_MASTER); - int masterNodeCount = nodes.length; - assert masterNodeCount > 0; - ClusterNode node = sliderClient.getNode(nodes[0]); - if (node.state >= ClusterDescription.STATE_STOPPED) { - //stopped, not what is wanted - log.error("HBase master has stopped"); - log.error(node.toString()); - fail("HBase master has stopped " + node.diagnostics); - } - } - - /** - * Create an (unshared) HConnection talking to the hbase service that - * Slider should be running - * @param sliderClient slider client - * @param clustername the name of the Slider cluster - * @return the connection - */ - public static HConnection createHConnection(Configuration clientConf) { - return HBaseTestUtils.createHConnection(clientConf) - } - - /** - * get a string representation of an HBase cluster status - * @param status cluster status - * @return a summary for printing - */ - public static String hbaseStatusToString(ClusterStatus status) { - return HBaseTestUtils.hbaseStatusToString(status) - } - - public static ClusterStatus getHBaseClusterStatus(SliderClient sliderClient) { - return HBaseTestUtils.getHBaseClusterStatus(sliderClient) - } - - public String getApplicationHomeKey() { - return KEY_TEST_HBASE_HOME - } - - public String getArchiveKey() { - return KEY_TEST_HBASE_TAR - } - - /** - * Create an HBase config to work with - * @param sliderClient slider client - * @param clustername cluster - * @return an hbase config extended with the custom properties from the - * cluster, including the binding to the HBase cluster - */ - public static Configuration createHBaseConfiguration(SliderClient sliderClient) { - return HBaseTestUtils.createHBaseConfiguration(sliderClient) - } - - /** - * Create a full cluster with a master & the requested no. of region servers - * @param clustername cluster name - * @param workers # of nodes - * @param extraArgs list of extra args to add to the creation command - * @param deleteExistingData should the data of any existing cluster - * of this name be deleted - * @param blockUntilRunning block until the AM is running - * @return launcher which will have executed the command. - */ - public ServiceLauncher<SliderClient> createHBaseCluster(String clustername, - int workers, - List<String> extraArgs, - boolean deleteExistingData, - boolean blockUntilRunning) { - def masters = 1 - return createHBaseCluster( - clustername, - masters, - workers, - extraArgs, - deleteExistingData, - blockUntilRunning) - } - - /** - * Create a full cluster with a master & the requested no. of region servers - * @param clustername cluster name - * @param masters #of masters - * @param workers # of nodes - * @param extraArgs list of extra args to add to the creation command - * @param deleteExistingData should the data of any existing cluster - * of this name be deleted - * @param blockUntilRunning block until the AM is running - * @return launcher which will have executed the command. - */ - public ServiceLauncher<SliderClient> createHBaseCluster( - String clustername, - int masters, - int workers, - List<String> extraArgs, - boolean deleteExistingData, - boolean blockUntilRunning) { - Map<String, Integer> roles = [ - (ROLE_MASTER): masters, - (ROLE_WORKER): workers, - ]; - hbaseArgs(extraArgs) - - return createCluster(clustername, - roles, - extraArgs, - deleteExistingData, - blockUntilRunning, - [:]) - } - - public List<String> hbaseArgs(List<String> extraArgs) { - extraArgs << ARG_RES_COMP_OPT << ROLE_MASTER << ResourceKeys.YARN_MEMORY << - YRAM - extraArgs << ARG_RES_COMP_OPT << ROLE_WORKER << ResourceKeys.YARN_MEMORY << - YRAM - extraArgs << ARG_PROVIDER << PROVIDER_HBASE; - return extraArgs; - } - - /** - * Create an AM without a master - * @param clustername AM name - * @param size # of nodes - * @param deleteExistingData should any existing cluster data be deleted - * @param blockUntilRunning block until the AM is running - * @return launcher which will have executed the command. - */ - public ServiceLauncher<SliderClient> createMasterlessAM(String clustername, int size, boolean deleteExistingData, boolean blockUntilRunning) { - Map<String, Integer> roles = [ - (ROLE_MASTER): 0, - (ROLE_WORKER): size, - ]; - return createCluster(clustername, - roles, - hbaseArgs([]), - deleteExistingData, - blockUntilRunning, - [:]) - } - - public ClusterStatus basicHBaseClusterStartupSequence(SliderClient sliderClient) { - return HBaseTestUtils.basicHBaseClusterStartupSequence(sliderClient, - hbaseClusterStartupTime, - hbaseClusterStartupToLiveTime) - } - - /** - * Spin waiting for the RS count to match expected - * @param sliderClient client - * @param clustername cluster name - * @param regionServerCount RS count - * @param timeout timeout - */ - public static ClusterStatus waitForHBaseRegionServerCount(SliderClient sliderClient, - String clustername, - int regionServerCount, - int timeout) { - - return HBaseTestUtils.waitForHBaseRegionServerCount(sliderClient, - clustername, - regionServerCount, - timeout) - } - - public boolean flexHBaseClusterTestRun( - String clustername, - int masters, - int masterFlexTarget, - int workers, - int workerFlexTarget, - boolean testHBaseAfter) { - clustername = buildClustername(clustername); - SliderClient sliderClient = startHBaseCluster(clustername, masters, workers) - - //now flex - return flexCluster( - sliderClient, - clustername, - masterFlexTarget, - workerFlexTarget, - testHBaseAfter) - - } - - public SliderClient startHBaseCluster( - String clustername, - int masters, - int workers) { - clustername = createMiniCluster(clustername, configuration, - 1, - true); - //now launch the cluster - SliderClient sliderClient; - ServiceLauncher<SliderClient> launcher = createCluster(clustername, - [ - (ROLE_MASTER): masters, - (ROLE_WORKER): workers, - ], - hbaseArgs([]), - true, - true, - [:]); - sliderClient = launcher.service; - - basicHBaseClusterStartupSequence(sliderClient); - - describe("Waiting for initial worker count of $workers"); - - //verify the #of roles is as expected - //get the hbase status - waitForWorkerInstanceCount( - sliderClient, - workers, - hbaseClusterStartupToLiveTime); - waitForSliderMasterCount( - sliderClient, - masters, - hbaseClusterStartupToLiveTime); - - log.info( - "Slider worker count at $workers, waiting for region servers to match"); - waitForHBaseRegionServerCount( - sliderClient, - clustername, - workers, - hbaseClusterStartupToLiveTime); - sliderClient - } - - public boolean flexCluster( - SliderClient sliderClient, - String clustername, - int masterFlexTarget, - int workerFlexTarget, - boolean testHBaseAfter) { - describe( - "Flexing masters -> $masterFlexTarget ; workers -> ${workerFlexTarget}"); - boolean flexed; - flexed = 0 == sliderClient.flex(clustername, - [ - (ROLE_WORKER): workerFlexTarget, - (ROLE_MASTER): masterFlexTarget - ] - ); - waitForWorkerInstanceCount( - sliderClient, - workerFlexTarget, - hbaseClusterStartupToLiveTime); - waitForSliderMasterCount(sliderClient, masterFlexTarget, - hbaseClusterStartupToLiveTime); - - if (testHBaseAfter) { - waitForHBaseRegionServerCount(sliderClient, clustername, workerFlexTarget, - hbaseClusterStartupToLiveTime); - } - flexed - } - - /** - * Spin waiting for the Slider worker count to match expected - * @param sliderClient client - * @param desiredCount RS count - * @param timeout timeout - */ - public static ClusterDescription waitForWorkerInstanceCount(SliderClient sliderClient, - int desiredCount, - int timeout) { - return waitForRoleCount(sliderClient, ROLE_WORKER, desiredCount, timeout) - } - - public static ClusterDescription waitForSliderMasterCount(SliderClient sliderClient, - int desiredCount, - int timeout) { - return waitForRoleCount(sliderClient, ROLE_MASTER, desiredCount, timeout) - } - - - /** - * attempt to talk to the hbase master; expect a failure - * @param clientConf client config - */ - public void assertNoHBaseMaster( - SliderClient sliderClient, Configuration clientConf) { - HBaseTestUtils.assertNoHBaseMaster(sliderClient, clientConf) - } - - /** - * attempt to talk to the hbase master; expect success - * @param clientConf client config - */ - public void assertHBaseMasterFound(Configuration clientConf) { - HBaseTestUtils.assertHBaseMasterFound(clientConf) - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestFreezeThawClusterFromArchive.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestFreezeThawClusterFromArchive.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestFreezeThawClusterFromArchive.groovy deleted file mode 100644 index 09a87a9..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestFreezeThawClusterFromArchive.groovy +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.archives - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.slider.api.ClusterDescription -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.apache.slider.core.main.ServiceLauncher -import org.junit.Test - -/** - * Test of RM creation. This is so the later test's prereq's can be met - */ -@CompileStatic -@Slf4j -class TestFreezeThawClusterFromArchive extends HBaseMiniClusterTestBase { - - - @Test - public void testFreezeThawClusterFromArchive() throws Throwable { - int regionServerCount = 1 - String clustername = createMiniCluster("", configuration, 1, true) - switchToImageDeploy = true - ServiceLauncher<SliderClient> launcher = createHBaseCluster(clustername, regionServerCount, [], true, true) - SliderClient sliderClient = launcher.service - ClusterDescription status = sliderClient.getClusterDescription(clustername) - log.info("${status.toJsonString()}") - - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - waitForHBaseRegionServerCount(sliderClient, clustername, regionServerCount, - hbaseClusterStartupToLiveTime) - - - clusterActionFreeze(sliderClient, clustername, "test stop") - describe("Restarting cluster") - killAllRegionServers(); - - //now let's start the cluster up again - ServiceLauncher<SliderClient> launcher2 = thawCluster(clustername, [], true); - SliderClient newCluster = launcher2.service - basicHBaseClusterStartupSequence(newCluster) - - //get the hbase status - waitForHBaseRegionServerCount(newCluster, clustername, regionServerCount, - hbaseClusterStartupToLiveTime) - - } - - - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchive.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchive.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchive.groovy deleted file mode 100644 index 22fa4c7..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchive.groovy +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -package org.apache.slider.providers.hbase.minicluster.archives - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.apache.slider.core.main.ServiceLauncher -import org.junit.Test - -/** - * create a live cluster from the image - */ -@CompileStatic -@Slf4j -class TestLiveClusterFromArchive extends HBaseMiniClusterTestBase { - - @Test - public void testLiveClusterFromArchive() throws Throwable { - int regionServerCount = 1 - String clustername = testClusterName - createMiniCluster(clustername, - configuration, - regionServerCount + 1, - 1, - 1, - true, - startHDFS()) - - //now launch the cluster - setupImageToDeploy() - ServiceLauncher<SliderClient> launcher = createHBaseCluster(clustername, regionServerCount, [], true, true) - - SliderClient sliderClient = launcher.service - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - //get the hbase status - waitForHBaseRegionServerCount(sliderClient, clustername, regionServerCount, hbaseClusterStartupToLiveTime) - waitForWorkerInstanceCount(sliderClient, regionServerCount, hbaseClusterStartupToLiveTime) - - clusterActionFreeze(sliderClient, clustername,"end of run") - } - - public void setupImageToDeploy() { - switchToImageDeploy = true - } - - public String getTestClusterName() { - return "testliveclusterfromarchive" - } - - public boolean startHDFS() { - return false - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchiveOnHDFS.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchiveOnHDFS.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchiveOnHDFS.groovy deleted file mode 100644 index cecee3f..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/archives/TestLiveClusterFromArchiveOnHDFS.groovy +++ /dev/null @@ -1,45 +0,0 @@ - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.archives - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -/** - * Test of RM creation. This is so the later test's prereq's can be met - */ -@CompileStatic -@Slf4j -class TestLiveClusterFromArchiveOnHDFS extends TestLiveClusterFromArchive { - - @Override - String getTestClusterName() { - "testliveclusterfromarchiveonhdfs" - } - - @Override - boolean startHDFS() { - true - } - - @Override - void setupImageToDeploy() { - enableTestRunAgainstUploadedArchive(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/build/TestBuildThawClusterM1W1.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/build/TestBuildThawClusterM1W1.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/build/TestBuildThawClusterM1W1.groovy deleted file mode 100644 index 0f3e06b..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/build/TestBuildThawClusterM1W1.groovy +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.build - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.HBaseKeys -import org.apache.slider.common.params.SliderActions -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.apache.hadoop.yarn.api.records.ApplicationReport -import org.apache.slider.core.main.ServiceLauncher -import org.junit.Test - -import static org.apache.slider.common.params.Arguments.ARG_PROVIDER - -@CompileStatic -@Slf4j - -class TestBuildThawClusterM1W1 extends HBaseMiniClusterTestBase { - - @Test - public void test_build_thaw_cluster_m1_w1() throws Throwable { - String clustername = createMiniCluster("", configuration, 1, true) - - describe "verify that a built cluster can be thawed" - - ServiceLauncher<SliderClient> launcher = createOrBuildCluster( - SliderActions.ACTION_BUILD, - clustername, - [ - (HBaseKeys.ROLE_MASTER): 1, - (HBaseKeys.ROLE_WORKER): 1, - ], - [ - ARG_PROVIDER, HBaseKeys.PROVIDER_HBASE - ], - true, - false, - [:]) - SliderClient sliderClient = launcher.service - addToTeardown(sliderClient); - def serviceRegistryClient = sliderClient.yarnAppListClient - ApplicationReport report = serviceRegistryClient.findInstance(clustername) - assert report == null; - - //start time - ServiceLauncher<SliderClient> l2 = thawCluster(clustername, [], true) - SliderClient thawed = l2.service - addToTeardown(thawed); - waitForClusterLive(thawed) - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestFailedRegionService.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestFailedRegionService.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestFailedRegionService.groovy deleted file mode 100644 index fe739c4..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestFailedRegionService.groovy +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.failures - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.slider.api.ClusterDescription -import org.apache.slider.api.RoleKeys -import org.apache.slider.providers.hbase.HBaseKeys -import org.apache.slider.client.SliderClient -import org.apache.slider.common.params.ActionKillContainerArgs -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.apache.slider.core.main.ServiceLauncher -import org.junit.Test - -/** - * test create a live region service - */ -@CompileStatic -@Slf4j -class TestFailedRegionService extends HBaseMiniClusterTestBase { - - @Test - public void testFailedRegionService() throws Throwable { - testRegionService("", true) - } - - @Test - public void testStoppedRegionService() throws Throwable { - testRegionService("", false) - } - - private void testRegionService(String testName, boolean toKill) { - String action = toKill ? "kill" : "stop" - int regionServerCount = 2 - String clustername = createMiniCluster(testName, configuration, 1, 1, 1, true, true) - describe("Create a single region service cluster then " + action + " the RS"); - - //now launch the cluster - ServiceLauncher<SliderClient> launcher = createHBaseCluster(clustername, regionServerCount, [], true, true) - SliderClient sliderClient = launcher.service - addToTeardown(sliderClient); - ClusterDescription status = sliderClient.getClusterDescription(clustername) - - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - status = waitForWorkerInstanceCount(sliderClient, regionServerCount, hbaseClusterStartupToLiveTime) - //get the hbase status - ClusterStatus hbaseStat = waitForHBaseRegionServerCount(sliderClient, clustername, regionServerCount, hbaseClusterStartupToLiveTime) - - log.info("Initial cluster status : ${hbaseStatusToString(hbaseStat)}"); - describe("running processes") - lsJavaProcesses() - describe("about to " + action + " servers") - if (toKill) { - killAllRegionServers() - } else { - stopAllRegionServers() - } - - //sleep a bit - sleep(toKill ? 15000 : 30000); - lsJavaProcesses() - - describe("waiting for recovery") - - //and expect a recovery - status = waitForWorkerInstanceCount(sliderClient, regionServerCount, hbaseClusterStartupToLiveTime) - - //now we expect the failure count to be two - - - hbaseStat = waitForHBaseRegionServerCount(sliderClient, clustername, regionServerCount, hbaseClusterStartupToLiveTime) - - status = sliderClient.clusterDescription - assert status.roles[HBaseKeys.ROLE_WORKER][RoleKeys.ROLE_FAILED_INSTANCES] == "2" - - log.info("Updated cluster status : ${hbaseStatusToString(hbaseStat)}"); - - //now attempt it by container kill command - def workers = status.instances[HBaseKeys.ROLE_WORKER] - assert workers.size() == 2 - def worker1 = workers[0] - ActionKillContainerArgs args = new ActionKillContainerArgs(); - args.id = worker1 - assert 0 == sliderClient.actionKillContainer(clustername, args) - sleep(15000) - waitForWorkerInstanceCount( - sliderClient, - regionServerCount, - hbaseClusterStartupToLiveTime) - status = sliderClient.clusterDescription - assert status.roles[HBaseKeys.ROLE_WORKER][RoleKeys.ROLE_FAILED_INSTANCES] == "3" - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseAM.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseAM.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseAM.groovy deleted file mode 100644 index 6d3a12b..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseAM.groovy +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.failures - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.hadoop.hbase.HConstants -import org.apache.hadoop.hbase.client.HConnection -import org.apache.hadoop.yarn.api.records.ApplicationReport -import org.apache.hadoop.yarn.api.records.YarnApplicationState -import org.apache.hadoop.yarn.conf.YarnConfiguration -import org.apache.slider.core.main.ServiceLauncher -import org.apache.slider.common.SliderXmlConfKeys -import org.apache.slider.api.ClusterDescription -import org.apache.slider.api.StatusKeys -import org.apache.slider.providers.hbase.HBaseKeys -import org.apache.slider.client.SliderClient -import org.apache.slider.common.params.ActionAMSuicideArgs -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test -import static org.apache.slider.test.SliderTestUtils.log - -/** - * test create a live region service - */ -@CompileStatic -@Slf4j -class TestKilledHBaseAM extends HBaseMiniClusterTestBase { - - @Test - public void testKilledHBaseAM() throws Throwable { - - int regionServerCount = 1 - - - def conf = configuration - // patch the configuration for AM restart - conf.setInt(SliderXmlConfKeys.KEY_AM_RESTART_LIMIT, 3) - - conf.set(YarnConfiguration.RM_SCHEDULER, FIFO_SCHEDULER); - String clustername = createMiniCluster("", conf, 1, 1, 1, true, false) - describe(" Kill the AM, expect cluster to die"); - - //now launch the cluster - ServiceLauncher<SliderClient> launcher = createHBaseCluster( - clustername, - regionServerCount, - [], - true, - true) - SliderClient sliderClient = launcher.service - addToTeardown(sliderClient); - ClusterDescription status = sliderClient.getClusterDescription(clustername) - - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - - status = waitForWorkerInstanceCount( - sliderClient, - regionServerCount, - hbaseClusterStartupToLiveTime) - //get the hbase status - ClusterStatus hbaseStat = waitForHBaseRegionServerCount( - sliderClient, - clustername, - regionServerCount, - hbaseClusterStartupToLiveTime) - - log.info("Initial cluster status : ${hbaseStatusToString(hbaseStat)}"); - - String hbaseMasterContainer = status.instances[HBaseKeys.ROLE_MASTER][0] - - Configuration clientConf = createHBaseConfiguration(sliderClient) - clientConf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); - HConnection hbaseConnection - hbaseConnection = createHConnection(clientConf) - - - - describe("running processes") - lsJavaProcesses() - describe("killing AM") - - ActionAMSuicideArgs args = new ActionAMSuicideArgs() - args.message = "test AM" - args.waittime = 1000 - args.exitcode = 1 - sliderClient.actionAmSuicide(clustername, args) - - killAllRegionServers(); - waitWhileClusterLive(sliderClient); - // give yarn some time to notice - sleep(10000) - - // await cluster startup - ApplicationReport report = sliderClient.applicationReport - assert report.yarnApplicationState != YarnApplicationState.FAILED; - - - def restartTime = 60000 - status = waitForWorkerInstanceCount( - sliderClient, - regionServerCount, - restartTime) - - dumpClusterDescription("post-restart status", status) - String restarted = status.getInfo( - StatusKeys.INFO_CONTAINERS_AM_RESTART) - assert restarted != null - assert Integer.parseInt(restarted) == 1 - assert null != status.instances[HBaseKeys.ROLE_MASTER] - assert 1 == status.instances[HBaseKeys.ROLE_MASTER].size() - assert hbaseMasterContainer == status.instances[HBaseKeys.ROLE_MASTER][0] - - waitForHBaseRegionServerCount( - sliderClient, - clustername, - regionServerCount, - restartTime) - - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseMaster.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseMaster.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseMaster.groovy deleted file mode 100644 index 1e19d71..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestKilledHBaseMaster.groovy +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.failures - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.hadoop.hbase.HConstants -import org.apache.hadoop.hbase.ServerName -import org.apache.slider.api.ClusterDescription -import org.apache.slider.providers.hbase.HBaseKeys -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.apache.slider.core.main.ServiceLauncher -import org.junit.Test - -/** - * test create a live region service - */ -@CompileStatic -@Slf4j -class TestKilledHBaseMaster extends HBaseMiniClusterTestBase { - - @Test - public void testKilledHBaseMaster() throws Throwable { - int regionServerCount = 1 - String clustername = createMiniCluster( - "", configuration, 1, 1, 1, true, true) - describe("Kill the hbase master and expect a restart"); - - //now launch the cluster - ServiceLauncher<SliderClient> launcher = createHBaseCluster(clustername, regionServerCount, [], true, true) - SliderClient sliderClient = launcher.service - addToTeardown(sliderClient); - ClusterDescription status = sliderClient.getClusterDescription(clustername) - - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - - status = waitForWorkerInstanceCount(sliderClient, regionServerCount, hbaseClusterStartupToLiveTime) - //get the hbase status - ClusterStatus hbaseStat = waitForHBaseRegionServerCount(sliderClient, clustername, regionServerCount, hbaseClusterStartupToLiveTime) - ServerName master = hbaseStat.master - log.info("HBase master providing status information at {}", - hbaseStat.master) - - Configuration clientConf = createHBaseConfiguration(sliderClient) - clientConf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 10); - killAllMasterServers(); - status = waitForRoleCount( - sliderClient, HBaseKeys.ROLE_MASTER, 1, hbaseClusterStartupToLiveTime) - hbaseStat = waitForHBaseRegionServerCount( - sliderClient, - clustername, - regionServerCount, - hbaseClusterStartupToLiveTime) - - ServerName master2 = hbaseStat.master - log.info("HBase master providing status information again at {}", - master2) - assert master2 != master - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestRegionServerFailureThreshold.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestRegionServerFailureThreshold.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestRegionServerFailureThreshold.groovy deleted file mode 100644 index eb44ae0..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/failures/TestRegionServerFailureThreshold.groovy +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.failures - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.hadoop.yarn.api.records.ApplicationReport -import org.apache.hadoop.yarn.api.records.FinalApplicationStatus -import org.apache.slider.api.ResourceKeys -import org.apache.slider.core.main.ServiceLauncher -import org.apache.slider.common.SliderExitCodes -import org.apache.slider.api.ClusterDescription -import org.apache.slider.core.exceptions.BadClusterStateException -import org.apache.slider.core.exceptions.ErrorStrings -import org.apache.slider.common.params.Arguments -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -import static org.apache.slider.providers.hbase.HBaseKeys.ROLE_WORKER - -/** - * test that if a container is killed too many times, - * the AM stays down - */ -@CompileStatic -@Slf4j - -class TestRegionServerFailureThreshold extends HBaseMiniClusterTestBase { - - @Test - public void testRegionServerFailureThreshold() throws Throwable { - failureThresholdTestRun("", true, 2, 5) - } - - /** - * Sets the failure threshold then runs the #of kill attempts - * @param testName - * @param toKill - * @param threshold - * @param killAttempts - */ - private void failureThresholdTestRun( - String testName, - boolean toKill, - int threshold, - int killAttempts) { - String action = toKill ? "kill" : "stop" - int regionServerCount = 1 - String clustername = createMiniCluster(testName, configuration, 1, 1, 1, true, true) - describe( - "Create a single region service HBase instance" + - "then $action the RS $killAttempts times with a threshold of $threshold"); - - //now launch the cluster - def globalThreshold = threshold - 1 - ServiceLauncher<SliderClient> launcher = createHBaseCluster( - clustername, - regionServerCount, - [ - Arguments.ARG_RES_COMP_OPT, - ROLE_WORKER, - ResourceKeys.CONTAINER_FAILURE_THRESHOLD, - Integer.toString(threshold), - - Arguments.ARG_RESOURCE_OPT, - ResourceKeys.CONTAINER_FAILURE_THRESHOLD, - Integer.toString(globalThreshold) - ], - true, - true) - SliderClient client = launcher.service - addToTeardown(client); - def aggregateConf = client.loadPersistedClusterDescription(clustername) - log.info aggregateConf.toString() - - def resourceOperations = aggregateConf.resourceOperations - def failureOptValue = resourceOperations.globalOptions.getMandatoryOptionInt( - ResourceKeys.CONTAINER_FAILURE_THRESHOLD) - assert globalThreshold == failureOptValue - def workerThreshold = resourceOperations.getComponentOptInt(ROLE_WORKER, - ResourceKeys.CONTAINER_FAILURE_THRESHOLD, 0) - assert threshold == workerThreshold - ClusterDescription status = client.getClusterDescription(clustername) - - ClusterStatus clustat = basicHBaseClusterStartupSequence(client) - ClusterStatus hbaseStat - try { - for (restarts in 1..killAttempts) { - status = waitForWorkerInstanceCount( - client, - regionServerCount, - hbaseClusterStartupToLiveTime) - //get the hbase status -/* - hbaseStat = waitForHBaseRegionServerCount( - client, - clustername, - regionServerCount, - HBASE_CLUSTER_STARTUP_TO_LIVE_TIME) - - log.info("Initial cluster status : ${hbaseStatusToString(hbaseStat)}"); -*/ - describe("running processes") - lsJavaProcesses() - describe("about to " + action + " servers") - if (toKill) { - killAllRegionServers() - } else { - stopAllRegionServers() - } - - //sleep a bit - sleep(toKill ? 15000 : 25000); - - describe("waiting for recovery") - - //and expect a recovery - if (restarts <= threshold) { - - def restartTime = 1000 - status = waitForWorkerInstanceCount( - client, - regionServerCount, - restartTime) - hbaseStat = waitForHBaseRegionServerCount( - client, - clustername, - regionServerCount, - restartTime) - } else { - //expect the cluster to have failed - try { - def finalCD = client.getClusterDescription(clustername) - describe( "failure threshold ignored") - dumpClusterDescription("expected the cluster to have failed", finalCD) - describe "stopping cluster" - maybeStopCluster( - client, - "", - "stopping cluster that isn't failing correctly") - - - fail("AM had not failed after $restarts worker kills") - - } catch (BadClusterStateException e) { - assertExceptionDetails(e, - SliderExitCodes.EXIT_BAD_STATE, - ErrorStrings.E_APPLICATION_NOT_RUNNING) - //success - break; - } - } - } - } catch (BadClusterStateException e) { - assertExceptionDetails(e, - SliderExitCodes.EXIT_BAD_STATE, - ErrorStrings.E_APPLICATION_NOT_RUNNING) - } - ApplicationReport report = client.applicationReport - log.info(report.diagnostics) - assert report.finalApplicationStatus == FinalApplicationStatus.FAILED - assert report.diagnostics.contains(ErrorStrings.E_UNSTABLE_CLUSTER) - - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex0To1.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex0To1.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex0To1.groovy deleted file mode 100644 index ec8d264..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex0To1.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@Slf4j -class TestClusterFlex0To1 extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlex0To1() throws Throwable { - assert flexHBaseClusterTestRun("", 1, 1, 0, 1, false) - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To1.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To1.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To1.groovy deleted file mode 100644 index c1265de..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To1.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j - -class TestClusterFlex1To1 extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlex1To1() throws Throwable { - assert flexHBaseClusterTestRun( - "", - 1, - 1, - 1, - 1, - true) - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To2.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To2.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To2.groovy deleted file mode 100644 index be38c3d..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex1To2.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j -class TestClusterFlex1To2 extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlex1To2() throws Throwable { - assert flexHBaseClusterTestRun( - "", - 1, - 1, - 1, - 2, - true) - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2DownTo1.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2DownTo1.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2DownTo1.groovy deleted file mode 100644 index e36e067..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2DownTo1.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j -class TestClusterFlex2DownTo1 extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlex2DownTo1() throws Throwable { - assert flexHBaseClusterTestRun( - "", - 1, 1, - 2, - 1, - false) - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2To5.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2To5.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2To5.groovy deleted file mode 100644 index 683c02a..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlex2To5.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j -class TestClusterFlex2To5 extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlex2To5() throws Throwable { - assert flexHBaseClusterTestRun( - "", - 1, - 1, - 2, - 5, - true) - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownMultiple.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownMultiple.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownMultiple.groovy deleted file mode 100644 index 97a9b35..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownMultiple.groovy +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j -class TestClusterFlexDownMultiple extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlexDownMultiple() throws Throwable { - def clusterName = createClusterName(); - SliderClient sliderClient = startHBaseCluster(clusterName, 1, 3) - - assert flexCluster( - sliderClient, - clusterName, - 1, - 2, - true) - - assert flexCluster( - sliderClient, - clusterName, - 1, - 1, - true) - - - - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownToZero.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownToZero.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownToZero.groovy deleted file mode 100644 index c43c5bd..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexDownToZero.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j -class TestClusterFlexDownToZero extends HBaseMiniClusterTestBase { - - @Test - public void testClusterFlexDownToZero() throws Throwable { - assert flexHBaseClusterTestRun( - "", - 1, - 1, - 1, - 0, - false) - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexHMasterFlex1To2.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexHMasterFlex1To2.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexHMasterFlex1To2.groovy deleted file mode 100644 index 298f40f..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/flexing/TestClusterFlexHMasterFlex1To2.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.flexing - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Create a master against the File:// fs - */ -@CompileStatic -@Slf4j -class TestClusterFlexHMasterFlex1To2 extends HBaseMiniClusterTestBase { - - @Test - public void testClusterMasterFlex1To2() throws Throwable { - assert flexHBaseClusterTestRun( - "", - 1, - 2, - 1, - 1, - true) - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeReconfigureThawLiveRegionService.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeReconfigureThawLiveRegionService.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeReconfigureThawLiveRegionService.groovy deleted file mode 100644 index d01716b..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeReconfigureThawLiveRegionService.groovy +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.freezethaw - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.fs.FileSystem as HadoopFS -import org.apache.hadoop.fs.Path -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.hadoop.yarn.conf.YarnConfiguration -import org.apache.slider.api.InternalKeys -import org.apache.slider.core.main.ServiceLauncher -import org.apache.slider.api.ClusterDescription -import org.apache.slider.core.build.InstanceIO -import org.apache.slider.providers.hbase.HBaseKeys -import org.apache.slider.common.tools.ConfigHelper -import org.apache.slider.common.tools.SliderFileSystem -import org.apache.slider.common.tools.SliderUtils -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.junit.Test - -/** - * Test of RM creation. This is so the later test's prereq's can be met - */ -@CompileStatic -@Slf4j -class TestFreezeReconfigureThawLiveRegionService - extends HBaseMiniClusterTestBase { - - @Test - public void testFreezeReconfigureThawLiveRegionService() throws Throwable { - int regionServerCount = 4 - int nodemanagers = 3 - YarnConfiguration conf = configuration - //one vcore per node - conf.setInt("yarn.nodemanager.resource.cpu-vcores", 1) - String clustername = createMiniCluster("", conf, nodemanagers, true) - describe( - "Create a $regionServerCount node cluster, stop it, patch the configuration files," + - " start it and verify that it came back with the new settings") - - ServiceLauncher<SliderClient> launcher = createHBaseCluster( - clustername, - regionServerCount, - [], - true, - true) - SliderClient sliderClient = launcher.service - addToTeardown(sliderClient); - ClusterDescription status = sliderClient.getClusterDescription(clustername) - log.info("${status.toJsonString()}") - - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - clustat = waitForHBaseRegionServerCount( - sliderClient, - clustername, - regionServerCount, - hbaseClusterStartupToLiveTime) - describe("Cluster status") - log.info(hbaseStatusToString(clustat)); - - - clusterActionFreeze(sliderClient, clustername) - killAllRegionServers(); - - //reconfigure time - - //get the location of the cluster - HadoopFS dfs = HadoopFS.get(new URI(fsDefaultName), miniCluster.config) - SliderFileSystem sliderFileSystem = new SliderFileSystem(dfs, miniCluster.config) - Path clusterDir = sliderFileSystem.buildClusterDirPath(clustername); - def instanceDefinition = InstanceIO.loadInstanceDefinitionUnresolved( - sliderFileSystem, - clusterDir) - - def snapshotPath = instanceDefinition.internalOperations.get( - InternalKeys.INTERNAL_SNAPSHOT_CONF_PATH) - assert snapshotPath != null - - Path confdir = new Path(snapshotPath); - Path hbaseSiteXML = new Path(confdir, HBaseKeys.SITE_XML) - Configuration originalConf = ConfigHelper.loadTemplateConfiguration( - dfs, - hbaseSiteXML, - ""); - //patch - String patchedText = "patched-after-freeze" - originalConf.setBoolean(patchedText, true); - //save - ConfigHelper.saveConfig(dfs, hbaseSiteXML, originalConf); - - //now let's start the cluster up again - ServiceLauncher<SliderClient> launcher2 = thawCluster(clustername, [], true); - SliderClient thawed = launcher2.service - clustat = basicHBaseClusterStartupSequence(thawed) - - //get the options - ClusterDescription stat = thawed.clusterDescription - Map<String, String> properties = stat.clientProperties - log.info("Cluster properties: \n" + SliderUtils.stringifyMap(properties)); - assert properties[patchedText] == "true"; - - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5d405543/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeThawLiveRegionService.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeThawLiveRegionService.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeThawLiveRegionService.groovy deleted file mode 100644 index 9a0e1db..0000000 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/freezethaw/TestFreezeThawLiveRegionService.groovy +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.providers.hbase.minicluster.freezethaw - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.hbase.ClusterStatus -import org.apache.slider.common.SliderKeys -import org.apache.slider.common.SliderExitCodes -import org.apache.slider.api.ClusterDescription -import org.apache.slider.api.RoleKeys -import org.apache.slider.core.exceptions.SliderException -import org.apache.slider.common.params.Arguments -import org.apache.slider.client.SliderClient -import org.apache.slider.providers.hbase.minicluster.HBaseMiniClusterTestBase -import org.apache.slider.core.main.ServiceLauncher -import org.junit.Test - -/** - * Test of RM creation. This is so the later test's prereq's can be met - */ -@CompileStatic -@Slf4j -class TestFreezeThawLiveRegionService extends HBaseMiniClusterTestBase { - - @Test - public void testFreezeThawLiveRegionService() throws Throwable { - int regionServerCount = 2 - String clustername = createMiniCluster("", configuration, 1, true) - describe("Create a cluster, stop it, start it and verify that it came back ") - //use a smaller AM HEAP to include it in the test cycle - ServiceLauncher launcher = createHBaseCluster(clustername, regionServerCount, - [ - Arguments.ARG_COMP_OPT, SliderKeys.COMPONENT_AM, RoleKeys.JVM_HEAP, "96M", - ], - true, true) - SliderClient sliderClient = launcher.service - addToTeardown(sliderClient); - ClusterDescription status = sliderClient.getClusterDescription(clustername) - log.info("${status.toJsonString()}") - - ClusterStatus clustat = basicHBaseClusterStartupSequence(sliderClient) - - clustat = waitForHBaseRegionServerCount(sliderClient, clustername, regionServerCount, - hbaseClusterStartupToLiveTime) - describe("Cluster status") - log.info(hbaseStatusToString(clustat)); - - - //verify you can't start a new cluster with that name - try { - ServiceLauncher<SliderClient> launcher3 = createHBaseCluster(clustername, regionServerCount, [], false, false) - SliderClient cluster3 = launcher3.service - fail("expected a failure, got ${cluster3}") - } catch (SliderException e) { - assert e.exitCode == SliderExitCodes.EXIT_APPLICATION_IN_USE; - } - - - clusterActionFreeze(sliderClient, clustername) - killAllRegionServers(); - //now let's start the cluster up again - ServiceLauncher launcher2 = thawCluster(clustername, [], true); - SliderClient newCluster = launcher2.service as SliderClient - basicHBaseClusterStartupSequence(newCluster) - - //get the hbase status - waitForHBaseRegionServerCount(newCluster, clustername, regionServerCount, - hbaseClusterStartupToLiveTime) - - //finally, attempt to start it while it is running - //now let's start the cluster up again - try { - ServiceLauncher launcher3 = thawCluster(clustername, [], true); - SliderClient cluster3 = launcher3.service as SliderClient - fail("expected a failure, got ${cluster3}") - } catch (SliderException e) { - assert e.exitCode == SliderExitCodes.EXIT_APPLICATION_IN_USE - } - } - - - - -}
