[
https://issues.apache.org/jira/browse/HBASE-5150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182774#comment-13182774
]
[email protected] commented on HBASE-5150:
------------------------------------------------------
bq. On 2012-01-09 20:13:20, Prakash Khemani wrote:
bq. > I wrote the following dummy test
bq. >
bq. > {code}
bq. > @Test
bq. > public void testDummy() throws Exception {
bq. > Thread t = new Thread() {
bq. > public void run() {
bq. > fail();
bq. > }
bq. > };
bq. > t.start();
bq. > t.join();
bq. > }
bq. > {code}
bq. >
bq. > And it failed with the following output
bq. > {code}
bq. > Exception in thread "Thread-2" java.lang.AssertionError:
bq. > at org.junit.Assert.fail(Assert.java:91)
bq. > at org.junit.Assert.fail(Assert.java:98)
bq. > at
org.apache.hadoop.hbase.master.TestDistributedLogSplitting$3.run(TestDistributedLogSplitting.java:294)
bq. > {code}
bq. >
bq. > To me it looks like that calling fail() or junit-asserts in a spawned
thread is equally effective as in the main thread. (I ran this in my eclipse
IDE.)
I ran the same from command line. I do get the exception. But it shows OK:
JUnit version 4.10
.Exception in thread "Thread-0" java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:92)
at org.junit.Assert.fail(Assert.java:100)
at Try$1.run(Try.java:11)
Time: 0.004
OK (1 test)
After I moved the fail() to below t.join(), I got this:
There was 1 failure:
1) testDummy(Try)
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:92)
.............................................
FAILURES!!!
Tests run: 1, Failures: 1
One fails the test, one doesn't. That's my concern.
- Jimmy
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/3433/#review4282
-----------------------------------------------------------
On 2012-01-09 17:34:47, Jimmy Xiang wrote:
bq.
bq. -----------------------------------------------------------
bq. This is an automatically generated e-mail. To reply, visit:
bq. https://reviews.apache.org/r/3433/
bq. -----------------------------------------------------------
bq.
bq. (Updated 2012-01-09 17:34:47)
bq.
bq.
bq. Review request for hbase, Todd Lipcon, Ted Yu, Michael Stack, and Prakash
Khemani.
bq.
bq.
bq. Summary
bq. -------
bq.
bq. Cleaned up the tests introduced in HBASE-5081, added some documentation.
bq.
bq.
bq. This addresses bug HBASE-5150.
bq. https://issues.apache.org/jira/browse/HBASE-5150
bq.
bq.
bq. Diffs
bq. -----
bq.
bq. src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java
0ef0e33
bq.
src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
b0487f1
bq. src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java
0974b56
bq.
bq. Diff: https://reviews.apache.org/r/3433/diff
bq.
bq.
bq. Testing
bq. -------
bq.
bq. Affected tests: TestDistributedLogSplitting and TestSplitLogManager, are
passed
bq.
bq.
bq. Thanks,
bq.
bq. Jimmy
bq.
bq.
> Fail in a thread may not fail a test, clean up log splitting test
> -----------------------------------------------------------------
>
> Key: HBASE-5150
> URL: https://issues.apache.org/jira/browse/HBASE-5150
> Project: HBase
> Issue Type: Test
> Affects Versions: 0.94.0
> Reporter: Jimmy Xiang
> Assignee: Jimmy Xiang
> Priority: Minor
> Attachments: hbase-5150.txt
>
>
> This is to clean up some tests for HBASE-5081. The Assert.fail method in a
> separate thread will terminate the thread, but may not fail the test.
> We can use callable, so that we can get the error in getting the result.
> Some documentation to explain the test will be helpful too.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira