You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by to...@apache.org on 2011/05/04 19:54:50 UTC
svn commit: r1099542 - in /hbase/trunk: CHANGES.txt
src/test/java/org/apache/hadoop/hbase/TestInfoServers.java
Author: todd
Date: Wed May 4 17:54:50 2011
New Revision: 1099542
URL: http://svn.apache.org/viewvc?rev=1099542&view=rev
Log:
HBASE-3853 Fix TestInfoServers to pass after HBASE-3835
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestInfoServers.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1099542&r1=1099541&r2=1099542&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed May 4 17:54:50 2011
@@ -98,6 +98,7 @@ Release 0.91.0 - Unreleased
HBASE-3847 Turn off DEBUG logging of RPCs in WriteableRPCEngine on TRUNK
HBASE-3777 Redefine Identity Of HBase Configuration (Karthick Sankarachary)
HBASE-3849 Fix master ui; hbase-1502 broke requests/second
+ HBASE-3853 Fix TestInfoServers to pass after HBASE-3835 (todd)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestInfoServers.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestInfoServers.java?rev=1099542&r1=1099541&r2=1099542&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestInfoServers.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestInfoServers.java Wed May 4 17:54:50 2011
@@ -45,16 +45,35 @@ public class TestInfoServers extends HBa
/**
* @throws Exception
*/
- public void testInfoServersAreUp() throws Exception {
+ public void testInfoServersRedirect() throws Exception {
// give the cluster time to start up
new HTable(conf, ".META.");
int port = cluster.getMaster().getInfoServer().getPort();
assertHasExpectedContent(new URL("http://localhost:" + port +
- "/index.html"), "master");
+ "/index.html"), "master-status");
port = cluster.getRegionServerThreads().get(0).getRegionServer().
getInfoServer().getPort();
assertHasExpectedContent(new URL("http://localhost:" + port +
- "/index.html"), "regionserver");
+ "/index.html"), "rs-status");
+ }
+
+ /**
+ * Test that the status pages in the minicluster load properly.
+ *
+ * This is somewhat a duplicate of TestRSStatusServlet and
+ * TestMasterStatusServlet, but those are true unit tests
+ * whereas this uses a cluster.
+ */
+ public void testInfoServersStatusPages() throws Exception {
+ // give the cluster time to start up
+ new HTable(conf, ".META.");
+ int port = cluster.getMaster().getInfoServer().getPort();
+ assertHasExpectedContent(new URL("http://localhost:" + port +
+ "/master-status"), "META");
+ port = cluster.getRegionServerThreads().get(0).getRegionServer().
+ getInfoServer().getPort();
+ assertHasExpectedContent(new URL("http://localhost:" + port +
+ "/rs-status"), "META");
}
private void assertHasExpectedContent(final URL u, final String expected)
@@ -62,8 +81,7 @@ public class TestInfoServers extends HBa
LOG.info("Testing " + u.toString() + " has " + expected);
java.net.URLConnection c = u.openConnection();
c.connect();
- assertTrue(c.getContentLength() > 0);
- StringBuilder sb = new StringBuilder(c.getContentLength());
+ StringBuilder sb = new StringBuilder();
BufferedInputStream bis = new BufferedInputStream(c.getInputStream());
byte [] bytes = new byte[1024];
for (int read = -1; (read = bis.read(bytes)) != -1;) {
@@ -71,6 +89,9 @@ public class TestInfoServers extends HBa
}
bis.close();
String content = sb.toString();
- assertTrue(content.contains(expected));
+ if (!content.contains(expected)) {
+ fail("Didn't have expected string '" + expected + "'. Content:\n"
+ + content);
+ }
}
}