janusgraph icon indicating copy to clipboard operation
janusgraph copied to clipboard

Add timeouts to test classes and methods

Open mbrukman opened this issue 9 years ago • 6 comments

The entire test suite today takes an extremely long time; while there appears to be a global timeout of 21600 seconds (6 hours), running this command:

$ mvn clean install surefire:test --fail-never

may not terminate (and hasn't in over two days). Each of the currently-defined categories of tests does not terminate within the 50 minute timeout that Travis sets for tests.

We should add timeouts on a per-test basis via:

@Rule(timeout=1000)  // in milliseconds
public void testWithTimeout() { ... }

or a single global timeout that will be applied to all test methods individually:

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;

public class HasGlobalTimeout {
    public static String log;
    private final CountDownLatch latch = new CountDownLatch(1);

    @Rule
    public Timeout globalTimeout = Timeout.seconds(10); // 10 seconds max per method tested

    @Test
    public void testSleepForTooLong() throws Exception {
        log += "ran1";
        TimeUnit.SECONDS.sleep(100); // sleep for 100 seconds
    }

    @Test
    public void testBlockForever() throws Exception {
        log += "ran2";
        latch.await(); // will block 
    }
}

mbrukman avatar Jan 04 '17 23:01 mbrukman

Here is the result and runtime of my test run over the weekend:

[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] JanusGraph: Distributed Graph Database ............. SUCCESS [ 0.326 s] [INFO] JanusGraph-Core: Core Library for JanusGraph ....... SUCCESS [ 30.250 s] [INFO] JanusGraph-Test: Test Suite for JanusGraph ......... SUCCESS [23:43 min] [INFO] JanusGraph-BerkeleyJE: Distributed Graph Database .. SUCCESS [09:09 min] [INFO] JanusGraph-Cassandra: Distributed Graph Database ... SUCCESS [ 01:46 h] [INFO] JanusGraph-ElasticSearch: Distributed Indexing Support SUCCESS [12:42 min] [INFO] JanusGraph-HBase: Parent Module .................... SUCCESS [ 0.574 s] [INFO] JanusGraph-HBase: Version-independent Core ......... SUCCESS [ 2.303 s] [INFO] JanusGraph-HBase: 0.94 Compatibility Shim .......... SUCCESS [ 02:55 h] [INFO] JanusGraph-HBase: 0.96 Compatibility Shim .......... SUCCESS [ 01:35 h] [INFO] JanusGraph-HBase: 0.98 Compatibility Shim .......... SUCCESS [ 01:19 h] [INFO] JanusGraph-HBase: 1.0 Compatibility Shim ........... SUCCESS [49:40 min] [INFO] JanusGraph-HBase: Universal binary ................. SUCCESS [ 0.541 s] [INFO] JanusGraph-Hadoop: Parent Module ................... SUCCESS [ 6.011 s] [INFO] JanusGraph-Hadoop: Version-independent Core ........ SUCCESS [ 3.151 s] [INFO] JanusGraph-Hadoop: 1.x Compatibility Shim .......... SUCCESS [ 7.482 s] [INFO] JanusGraph-Hadoop: 2.x Compatibility Shim .......... SUCCESS [ 3.264 s] [INFO] JanusGraph-Hadoop: Universal binary ................ SUCCESS [ 0.212 s] [INFO] JanusGraph-Lucene: Indexing Support ................ SUCCESS [01:37 min] [INFO] JanusGraph-All: Complete JanusGraph Distribution ... SUCCESS [ 1.316 s] [INFO] JanusGraph-Solr: Distributed Indexing Support ...... FAILURE [18:35 min] [INFO] JanusGraph-Dist: Tar and Zip Archives .............. SKIPPED [INFO] JanusGraph-Dist: Archive with Hadoop 2 ............. SKIPPED [INFO] JanusGraph-Doc: AsciiDoc Manual for JanusGraph ..... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 09:33 h [INFO] Finished at: 2017-01-23T02:46:11-08:00

jerryjch avatar Jan 23 '17 18:01 jerryjch

I am thinking that we will deplicate HBase 0.94 and 0.96. This will save us quite some time: [INFO] JanusGraph-HBase: 0.94 Compatibility Shim .......... SUCCESS [ 02:55 h] [INFO] JanusGraph-HBase: 0.96 Compatibility Shim .......... SUCCESS [ 01:35 h]

jerryjch avatar Jan 23 '17 18:01 jerryjch

@jerryjch — I was thinking of doing a poll on the Apache HBase users list as well as the Titan mailing list to see what the distribution is of HBase versions. This will provide valuable data to both HBase developers as well as answer the question for us whether we should be ready to deprecate either or both of these versions. What do you think?

As much as I would love to deprecate older versions of HBase, I'd like to not limit the growth of JanusGraph community if upgrades are hard and there are a bunch of users still using either of these versions.

mbrukman avatar Jan 23 '17 18:01 mbrukman

@mbrukman That is a good point. I recall there was a recent survey on the HBase user list. Let me dig it out.

jerryjch avatar Jan 23 '17 18:01 jerryjch

Posted info on the relevent issues #36 #37

jerryjch avatar Jan 23 '17 18:01 jerryjch

Closing this since #74 is resolved.

sjudeng avatar Jul 18 '17 00:07 sjudeng