1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.master;
21
22 import static org.junit.Assert.assertEquals;
23
24 import java.io.IOException;
25
26 import org.apache.hadoop.hbase.HBaseTestingUtility;
27 import org.apache.hadoop.hbase.HServerAddress;
28 import org.apache.hadoop.hbase.HServerInfo;
29 import org.apache.hadoop.hbase.MiniHBaseCluster;
30 import org.apache.hadoop.hbase.YouAreDeadException;
31 import org.apache.hadoop.hbase.MiniHBaseCluster.MiniHBaseClusterRegionServer;
32 import org.junit.AfterClass;
33 import org.junit.Before;
34 import org.junit.BeforeClass;
35 import org.junit.Ignore;
36 import org.junit.Test;
37
38 public class BROKE_FIX_TestKillingServersFromMaster {
39 private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
40 private static MiniHBaseCluster cluster;
41
42 @BeforeClass
43 public static void beforeAllTests() throws Exception {
44 TEST_UTIL.startMiniCluster(2);
45 cluster = TEST_UTIL.getHBaseCluster();
46 }
47
48 @AfterClass
49 public static void afterAllTests() throws IOException {
50 TEST_UTIL.shutdownMiniCluster();
51 }
52
53 @Before
54 public void setup() throws IOException {
55 TEST_UTIL.ensureSomeRegionServersAvailable(2);
56 }
57
58
59
60
61
62
63
64 @Ignore @Test (timeout=180000)
65 public void testRsReportsWrongStartCode() throws Exception {
66 MiniHBaseClusterRegionServer firstServer =
67 (MiniHBaseClusterRegionServer)cluster.getRegionServer(0);
68 HServerInfo hsi = firstServer.getServerInfo();
69
70 firstServer.setHServerInfo(new HServerInfo(hsi.getServerAddress(),
71 hsi.getInfoPort(), hsi.getHostname()));
72 cluster.waitOnRegionServer(0);
73 assertEquals(1, cluster.getLiveRegionServerThreads().size());
74 }
75
76
77
78
79
80
81
82 @Ignore @Test (timeout=180000)
83 public void testRsReportsWrongAddress() throws Exception {
84 MiniHBaseClusterRegionServer firstServer =
85 (MiniHBaseClusterRegionServer)cluster.getRegionServer(0);
86 firstServer.getHServerInfo().setServerAddress(
87 new HServerAddress("0.0.0.0", 60010));
88 cluster.waitOnRegionServer(0);
89 assertEquals(1, cluster.getLiveRegionServerThreads().size());
90 }
91
92
93
94
95
96
97 @Ignore @Test (timeout=180000)
98 public void testSendYouAreDead() throws Exception {
99 cluster.addExceptionToSendRegionServer(0, new YouAreDeadException("bam!"));
100 cluster.waitOnRegionServer(0);
101 assertEquals(1, cluster.getLiveRegionServerThreads().size());
102 }
103 }