HBASE-12563 After Starting up mini hbase cluster, Real Configuration of Cluster never set to HBaseTestingUtility (Talat UYARER)
This commit is contained in:
parent
1350055fcd
commit
9be143691c
|
@ -917,6 +917,10 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
|
||||||
Configuration c = new Configuration(this.conf);
|
Configuration c = new Configuration(this.conf);
|
||||||
this.hbaseCluster =
|
this.hbaseCluster =
|
||||||
new MiniHBaseCluster(c, numMasters, numSlaves, masterClass, regionserverClass);
|
new MiniHBaseCluster(c, numMasters, numSlaves, masterClass, regionserverClass);
|
||||||
|
// Cluster confguration should set HbaseTestingUtility Conf
|
||||||
|
MiniHBaseCluster miniHBaseCluster = (MiniHBaseCluster) this.hbaseCluster;
|
||||||
|
this.conf = miniHBaseCluster.getMaster().getConfiguration();
|
||||||
|
|
||||||
// Don't leave here till we've done a successful scan of the hbase:meta
|
// Don't leave here till we've done a successful scan of the hbase:meta
|
||||||
Table t = new HTable(c, TableName.META_TABLE_NAME);
|
Table t = new HTable(c, TableName.META_TABLE_NAME);
|
||||||
ResultScanner s = t.getScanner(new Scan());
|
ResultScanner s = t.getScanner(new Scan());
|
||||||
|
@ -928,7 +932,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
|
||||||
|
|
||||||
getHBaseAdmin(); // create immediately the hbaseAdmin
|
getHBaseAdmin(); // create immediately the hbaseAdmin
|
||||||
LOG.info("Minicluster is up");
|
LOG.info("Minicluster is up");
|
||||||
return (MiniHBaseCluster)this.hbaseCluster;
|
return miniHBaseCluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase;
|
package org.apache.hadoop.hbase;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
|
@ -49,7 +50,6 @@ public class TestInfoServers {
|
||||||
// The info servers do not run in tests by default.
|
// The info servers do not run in tests by default.
|
||||||
// Set them to ephemeral ports so they will start
|
// Set them to ephemeral ports so they will start
|
||||||
UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 0);
|
UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 0);
|
||||||
UTIL.getConfiguration().setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
|
|
||||||
|
|
||||||
//We need to make sure that the server can be started as read only.
|
//We need to make sure that the server can be started as read only.
|
||||||
UTIL.getConfiguration().setBoolean("hbase.master.ui.readonly", true);
|
UTIL.getConfiguration().setBoolean("hbase.master.ui.readonly", true);
|
||||||
|
@ -61,6 +61,25 @@ public class TestInfoServers {
|
||||||
UTIL.shutdownMiniCluster();
|
UTIL.shutdownMiniCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for checking master info port of cluster whether same with the port of
|
||||||
|
* TestHBaseTestingUtility's getConfiguration .
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMasterInfoServerPort() throws Exception {
|
||||||
|
String confPort = UTIL.getConfiguration().get(HConstants.MASTER_INFO_PORT);
|
||||||
|
String masterPort =
|
||||||
|
UTIL.getHBaseCluster().getMaster().getConfiguration().get(HConstants.MASTER_INFO_PORT);
|
||||||
|
String regionPort =
|
||||||
|
UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer().getConfiguration()
|
||||||
|
.get(HConstants.MASTER_INFO_PORT);
|
||||||
|
|
||||||
|
assertEquals(confPort, masterPort);
|
||||||
|
assertEquals(confPort, regionPort);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -68,11 +87,11 @@ public class TestInfoServers {
|
||||||
public void testInfoServersRedirect() throws Exception {
|
public void testInfoServersRedirect() throws Exception {
|
||||||
// give the cluster time to start up
|
// give the cluster time to start up
|
||||||
new HTable(UTIL.getConfiguration(), TableName.META_TABLE_NAME).close();
|
new HTable(UTIL.getConfiguration(), TableName.META_TABLE_NAME).close();
|
||||||
int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort();
|
String port = UTIL.getConfiguration().get(HConstants.MASTER_INFO_PORT);
|
||||||
assertContainsContent(new URL("http://localhost:" + port +
|
assertContainsContent(new URL("http://localhost:" + port +
|
||||||
"/index.html"), "master-status");
|
"/index.html"), "master-status");
|
||||||
port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer().
|
port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer().
|
||||||
getInfoServer().getPort();
|
getConfiguration().get(HConstants.REGIONSERVER_INFO_PORT);
|
||||||
assertContainsContent(new URL("http://localhost:" + port +
|
assertContainsContent(new URL("http://localhost:" + port +
|
||||||
"/index.html"), "rs-status");
|
"/index.html"), "rs-status");
|
||||||
}
|
}
|
||||||
|
@ -88,11 +107,11 @@ public class TestInfoServers {
|
||||||
public void testInfoServersStatusPages() throws Exception {
|
public void testInfoServersStatusPages() throws Exception {
|
||||||
// give the cluster time to start up
|
// give the cluster time to start up
|
||||||
new HTable(UTIL.getConfiguration(), TableName.META_TABLE_NAME).close();
|
new HTable(UTIL.getConfiguration(), TableName.META_TABLE_NAME).close();
|
||||||
int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort();
|
String port = UTIL.getConfiguration().get(HConstants.MASTER_INFO_PORT);
|
||||||
assertContainsContent(new URL("http://localhost:" + port +
|
assertContainsContent(new URL("http://localhost:" + port +
|
||||||
"/master-status"), "meta");
|
"/master-status"), "meta");
|
||||||
port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer().
|
port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer().
|
||||||
getInfoServer().getPort();
|
getConfiguration().get(HConstants.REGIONSERVER_INFO_PORT);
|
||||||
assertContainsContent(new URL("http://localhost:" + port +
|
assertContainsContent(new URL("http://localhost:" + port +
|
||||||
"/rs-status"), "meta");
|
"/rs-status"), "meta");
|
||||||
}
|
}
|
||||||
|
@ -103,7 +122,7 @@ public class TestInfoServers {
|
||||||
byte[] cf = Bytes.toBytes("d");
|
byte[] cf = Bytes.toBytes("d");
|
||||||
UTIL.createTable(tableName, cf);
|
UTIL.createTable(tableName, cf);
|
||||||
new HTable(UTIL.getConfiguration(), tableName).close();
|
new HTable(UTIL.getConfiguration(), tableName).close();
|
||||||
int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort();
|
String port = UTIL.getConfiguration().get(HConstants.MASTER_INFO_PORT);
|
||||||
assertDoesNotContainContent(
|
assertDoesNotContainContent(
|
||||||
new URL("http://localhost:" + port + "/table.jsp?name=" + tableName + "&action=split&key="),
|
new URL("http://localhost:" + port + "/table.jsp?name=" + tableName + "&action=split&key="),
|
||||||
"Table action request accepted");
|
"Table action request accepted");
|
||||||
|
|
Loading…
Reference in New Issue