Thanks for your reply.
1/ I have other question: It needs clear something when one test case had
failed ?
In my case. The test cases auto run at night.
I find some test case failed randomly and try to dig it.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 7.599 sec <<<
FAILURE!
testMergeTool(org.apache.hadoop.hbase.util.TestMergeTool) Time elapsed: 7.586
sec <<< FAILURE!
junit.framework.AssertionFailedError: 'merging regions 0 and 1' failed
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at
org.apache.hadoop.hbase.util.TestMergeTool.mergeAndVerify(TestMergeTool.java:182)
at
org.apache.hadoop.hbase.util.TestMergeTool.testMergeTool(TestMergeTool.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
test3686a(org.apache.hadoop.hbase.client.TestScannerTimeout) Time elapsed:
1.233 sec <<< ERROR!
org.apache.hadoop.hbase.TableNotFoundException: t
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:724)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:593)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:558)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:171)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:130)
at
org.apache.hadoop.hbase.client.TestScannerTimeout.test3686a(TestScannerTimeout.java:150)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
2/ DNS Error test case:
TestClockSkewDetection
testBadOriginalRootLocation
testScanner
TestCatalogTracker
Error logs:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<<
FAILURE!
testClockSkewDetection(org.apache.hadoop.hbase.master.TestClockSkewDetection)
Time elapsed: 0.02 sec <<< ERROR!
java.lang.IllegalArgumentException: Could not resolve the DNS name of
example.org:1234
at
org.apache.hadoop.hbase.HServerAddress.checkBindAddressCanBeResolved(HServerAddress.java:105)
at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:66)
at
org.apache.hadoop.hbase.master.TestClockSkewDetection.testClockSkewDetection(TestClockSkewDetection.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
-----邮件原件-----
发件人: [email protected] [mailto:[email protected]] 代表 Stack
发送时间: 2011年5月10日 1:35
收件人: [email protected]
主题: Re: A question about Unit Test
Did you try it Gao? The below looks like it might be a little
'dangerous' in that an empty address happens when the hosted
InetSocketAddress fails to resolve. Which test is failing? We should
for sure make it so tests pass if you are not connected to the net.
Thanks Gao,
St.Ack
On Sun, May 8, 2011 at 12:40 AM, Gaojinchao <[email protected]> wrote:
> private static final HServerAddress HSA =
> new HServerAddress("example.org:1234");
>
> In my machine , It always failed because of DNS error.
> The example.org is hard code. If we can add a function to get hostname.
> It likes:
>
> public static String gethostname()
> {
> String hostName = null;
> try{
> hostName = java.net.InetAddress.getLocalHost().getHostName();
> }
> catch(java.net.UnknownHostException uhe)
> {
> ......
> }
>
> return hostName;
> }
>
>
> private static final HServerAddress HSA =
> new HServerAddress(gethostname() +":1234");
>
>
>
>