1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.hadoop.hbase;
20
21 import org.apache.hadoop.hbase.util.ChaosMonkey;
22 import org.junit.After;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.junit.experimental.categories.Category;
26
27 /**
28 * A system test which does large data ingestion and verify using {@link LoadTestTool},
29 * while killing the region servers and the master(s) randomly. You can configure how long
30 * should the load test run by using "hbase.IntegrationTestDataIngestWithChaosMonkey.runtime"
31 * configuration parameter.
32 */
33 @Category(IntegrationTests.class)
34 public class IntegrationTestDataIngestWithChaosMonkey extends IngestIntegrationTestBase {
35
36 private static final int NUM_SLAVES_BASE = 4; //number of slaves for the smallest cluster
37
38 // run for 5 min by default
39 private static final long DEFAULT_RUN_TIME = 5 * 60 * 1000;
40
41 private ChaosMonkey monkey;
42
43 @Before
44 public void setUp() throws Exception {
45 super.setUp(NUM_SLAVES_BASE);
46 monkey = new ChaosMonkey(util, ChaosMonkey.EVERY_MINUTE_RANDOM_ACTION_POLICY);
47 monkey.start();
48 }
49
50 @After
51 public void tearDown() throws Exception {
52 if (monkey != null) {
53 monkey.stop("test has finished, that's why");
54 monkey.waitForStop();
55 }
56 super.tearDown();
57 }
58
59 @Test
60 public void testDataIngest() throws Exception {
61 runIngestTest(DEFAULT_RUN_TIME, 2500, 10, 100, 20);
62 }
63 }