commoncrawl / ia-web-commons

Web archiving utility library
Apache License 2.0
9 stars 6 forks source link

Failed tests: testInterruptibility (org.archive.util.InterruptibleCharSequenceTest): exception not throw #25

Closed cronopioelectronico closed 3 years ago

cronopioelectronico commented 3 years ago

Hi,

when installing through:

git clone https://github.com/commoncrawl/ia-web-commons
cd ia-web-commons
mvn install 

I get the error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project ia-web-commons: There are test failures.

and the following content of the file target/surefire-reports/org.archive.util.InterruptibleCharSequenceTest.txt

-------------------------------------------------------------------------------
Test set: org.archive.util.InterruptibleCharSequenceTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.509 sec <<< FAILURE!
testInterruptibility(org.archive.util.InterruptibleCharSequenceTest)  Time elapsed: 0.508 sec  <<< FAILURE!
junit.framework.AssertionFailedError: exception not thrown
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.assertTrue(Assert.java:20)
        at org.archive.util.InterruptibleCharSequenceTest.testInterruptibility(InterruptibleCharSequenceTest.java:118)

I am trying the installation on the following system:

Thanks!

sebastian-nagel commented 3 years ago

Hi @cronopioelectronico, thanks for the bug report! I'm able to reproduce the failing unit test using Java 11. I'll have a look. Note: using Java 8 all tests pass.

cronopioelectronico commented 3 years ago

Great, thanks for replying so fast @sebastian-nagel!

sebastian-nagel commented 3 years ago

Hi @cronopioelectronico, the reason was trivial: the unit test was based on the assumption that after 500ms the matching thread was still running. Looks like there are some performance improvements and running a thread and do the matching takes less than 32ms on JDK 11 (on my hardware):

Running org.archive.util.InterruptibleCharSequenceTest
already done, retrying with shorter sleep time: 256ms
already done, retrying with shorter sleep time: 128ms
already done, retrying with shorter sleep time: 64ms
already done, retrying with shorter sleep time: 32ms
already done, retrying with shorter sleep time: 16ms
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.013 sec

See 8accf19 for more details. Please update and retry to build. Thanks again!

cronopioelectronico commented 3 years ago

Works like a charm @sebastian-nagel, thanks!