thinkaurelius / titan

Distributed Graph Database
http://titandb.io
Apache License 2.0
5.25k stars 1.01k forks source link

GeoShapeTest failing on ubuntu 16.04 #1351

Closed seth-priya closed 7 years ago

seth-priya commented 8 years ago

Hi,

I am trying run the Titan DB build and automated tests on an ubuntu 16.04 VM and the Geotest is failing. Results :

Failed tests: GeoshapeTest.testGeoJsonSerialization:225 expected:<{"type":"[Polygon]","coordinates":[[20...> but was:<{"type":"[Box]","coordinates":[[20...>

Tests run: 316, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Titan: Distributed Graph Database .................. SUCCESS [ 0.835 s] [INFO] Titan-Core: Core Library for Titan ................. SUCCESS [ 5.666 s] [INFO] Titan-Test: Test Suite for Titan ................... FAILURE [18:57 min] [INFO] Titan-BerkeleyJE: Distributed Graph Database ....... SKIPPED

This is the error that I am seeing during the test failure:

Running com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest circle[10.0,12.5]:100.0 box[[20.0,22.5],[40.5,60.5]] Tests run: 14, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.507 sec <<< FAILURE! - in com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest testGeoJsonSerialization(com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest) Time elapsed: 0.032 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<{"type":"[Polygon]","coordinates":[[20...> but was:<{"type":"[Box]","coordinates":[[20...> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest.testGeoJsonSerialization(GeoshapeTest.java:225)

Is this a known issue or am I missing something?

I am using openjdk 1.8.0 and the following build steps git clone https://github.com/thinkaurelius/titan cd titan mvn clean install -DskipTests=true mvn test

Any guidance on this would be of great help. Thanks!

Priya

seth-priya commented 8 years ago

Please note that the test case fails on RHEL as well and on both Power 8 (ppc64le) and Intel (x86_64) architectures.

sjudeng commented 8 years ago

Try running the test on the the titan11 branch instead of the default titan10. Or you could run it on the last stable release (1.0.0). I've run these tests a lot without issue, but mostly this has been on branches based on titan11.

git checkout titan11
#git checkout 1.0.0
mvn clean install
seth-priya commented 8 years ago

@sjudeng Thanks for your response, I will check with the titan11 branch and update my findings soon.

seth-priya commented 8 years ago

The failures for Geoshape are no longer seen with titan11 branch (tested this on ppc64le architecture).

However, there are errors, as below Tests in error: ElasticSearchConfigTest.testTransportClient:86 » NoNodeAvailable None of the c... ElasticSearchConfigTest.testNetworkNodeUsingExt » MasterNotDiscovered waited f... ElasticSearchConfigTest.testNetworkNodeUsingYaml » MasterNotDiscovered waited ... ElasticSearchConfigTest.testIndexCreationOptions » MasterNotDiscovered waited ...

Tests run: 75, Failures: 0, Errors: 4, Skipped: 0

and also

Tests in error: HBaseIDAuthorityTest>IDAuthorityTest.setUp:116 » Titan Exception in Titan HBaseIDAuthorityTest>IDAuthorityTest.tearDown:150->IDAuthorityTest.close:155 » NullPointer

Tests run: 163, Failures: 0, Errors: 2, Skipped: 0

Trying to debug this further, any pointers regarding which part of the code to look at would be great!

sjudeng commented 8 years ago

Testing I have done has been on a CentOS 7 x64 instance with 2 vCPU and 7.5 GB memory. Not sure if it could be an architecture issue. The test suite is pretty substantial, especially the storage backend tests (e.g. hbase). I've seen sporadic errors before (specifically in hbase tests) when I've tried running on systems with fewer resources.

I think the Elasticsearch tests in titan11 should pass, but if you can upgrade to Elasticserach 2.3, you can also retry with the branch in #1327. I know all tests in that branch pass, at least in the above test environment.

git remote add ngageoint https://github.com/ngageoint/titan.git
git fetch ngageoint
git checkout ngageoint/master
mvn clean install
seth-priya commented 8 years ago

Thanks for the quick response @sjudeng . I will follow your suggestions and update on the results.

seth-priya commented 7 years ago

No longer seeing this issue, hence closing the ticket. Thanks for all the help and support!

ngrigoriev commented 7 years ago

I just cloned titan10 and tried to build it on Amazon Linux (simple t1.micro instance). Getting exactly the same failure that @seth-priya has mentioned:

Running com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest
circle[10.0,12.5]:100.0
box[[20.0,22.5],[40.5,60.5]]
Tests run: 14, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.634 sec <<< FAILURE! - in com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest
testGeoJsonSerialization(com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest)  Time elapsed: 0.041 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<{"type":"[Polygon]","coordinates":[[20...> but was:<{"type":"[Box]","coordinates":[[20...>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at com.thinkaurelius.titan.graphdb.attribute.GeoshapeTest.testGeoJsonSerialization(GeoshapeTest.java:225)

Results :

Failed tests:
  GeoshapeTest.testGeoJsonSerialization:225 expected:<{"type":"[Polygon]","coordinates":[[20...> but was:<{"type":"[Box]","coordinates":[[20...>

Tests run: 14, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Titan: Distributed Graph Database .................. SUCCESS [  0.561 s]
[INFO] Titan-Core: Core Library for Titan ................. SUCCESS [  3.016 s]
[INFO] Titan-Test: Test Suite for Titan ................... FAILURE [  5.618 s]
ngrigoriev commented 7 years ago

Well, I think it is clearly the bug in the test. assertEquals("{\"type\":\"Polygon\",\"coordinates\":[[20.5,10.5],[22.5,10.5],[22.5,12.5],[20.5,12.5]]}", om.writeValueAsString(Geoshape.box(10.5, 20.5, 12.5, 22.5)));

This value is a box, if I read Geoshape code correctly. 4 coordinates. But the test expects it to be a polygon for some reason.

This is what makes the decision on the type:

    public Type getType() {
        if (coordinates[0].length==1) return Type.POINT;
        else if (coordinates[0].length>2) return Type.POLYGON;
        else { //coordinates[0].length==2
            if (Float.isNaN(coordinates[0][1])) return Type.CIRCLE;
            else return Type.BOX;
        }
    }

I believe it is the problem with the type in the expected value. It should be "Box" and changing it to "Box" makes the test working.

sjudeng commented 7 years ago

@ngrigoriev The issue is also resolved on the titan11 branch (see above)

ngrigoriev commented 7 years ago

Yes, I understand that, but that little issue breaks the build of the current stable code branch...

sjudeng commented 7 years ago

I think the last known truly stable titan code is the 1.0.0 tag. I confirmed the test is working there.

git checkout 1.0.0
mvn clean install -Dtest=GeoshapeTest -pl titan-test -am

For more current code I'd recommend starting with titan11 instead of titan10. Other options are the branch in #1327 and JanusGraph, both of which are based on titan11.