Skip to content

Commit

Permalink
Added tests for DebugJanusGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola Svishevskiy committed Jan 21, 2022
1 parent d43ae6d commit 5f99f6c
Show file tree
Hide file tree
Showing 10 changed files with 533 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ public DebugJanusGraph(GraphDatabaseConfiguration configuration) {
@Override
public void commit(final Collection<InternalRelation> addedRelations,
final Collection<InternalRelation> deletedRelations, final StandardJanusGraphTx tx) {
super.commit(addedRelations, deletedRelations, tx);

traceCommit(addedRelations, deletedRelations, NO_SCHEMA_FILTER, tx);

super.commit(addedRelations, deletedRelations, tx);
}

private void traceCommit(final Collection<InternalRelation> addedRelations,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.playtika.janusgraph.aerospike.debuggrapdb;

import com.playtika.janusgraph.trace.DebugJanusGraph;
import org.janusgraph.StorageSetup;
import org.janusgraph.core.JanusGraphException;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.graphdb.JanusGraphTest;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;

import java.util.concurrent.ExecutionException;

import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration;
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class AerospikeDebugGraphCacheTest extends JanusGraphTest {

@ClassRule
public static final GenericContainer container = getAerospikeContainer();

@Override
public void open(WriteConfiguration config) {
this.graph = (StandardJanusGraph) DebugJanusGraph.open(config);
this.features = this.graph.getConfiguration().getStoreFeatures();
this.tx = this.graph.newTransaction();
this.mgmt = this.graph.openManagement();
}

@Override
public WriteConfiguration getConfiguration() {
return StorageSetup.addPermanentCache(getAerospikeConfiguration(container));
}

//TODO Investigate
@Ignore
@Test
@Override
public void testIndexUpdatesWithReindexAndRemove() throws InterruptedException, ExecutionException {
}

@Test
@Override
public void testLargeJointIndexRetrieval() {
assertThatThrownBy(super::testLargeJointIndexRetrieval)
.isInstanceOf(JanusGraphException.class) //Record too big
.hasMessageContaining("Could not commit transaction due to exception during persistence");
}

@Test
@Override
public void testVertexCentricQuery() {
assertThatThrownBy(super::testVertexCentricQuery)
.isInstanceOf(JanusGraphException.class) //Record too big
.hasMessageContaining("Could not commit transaction due to exception during persistence");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.playtika.janusgraph.aerospike.debuggrapdb;

import com.playtika.janusgraph.trace.DebugJanusGraph;
import org.janusgraph.TestCategory;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.graphdb.JanusGraphConcurrentTest;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.junit.ClassRule;
import org.junit.jupiter.api.Tag;
import org.testcontainers.containers.GenericContainer;

import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration;
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer;

@Tag(TestCategory.PERFORMANCE_TESTS)
public class AerospikeDebugGraphConcurrentTest extends JanusGraphConcurrentTest {

@Override
public void open(WriteConfiguration config) {
this.graph = (StandardJanusGraph) DebugJanusGraph.open(config);
this.features = this.graph.getConfiguration().getStoreFeatures();
this.tx = this.graph.newTransaction();
this.mgmt = this.graph.openManagement();
}

@ClassRule
public static final GenericContainer container = getAerospikeContainer();

@Override
public WriteConfiguration getConfiguration() {
return getAerospikeConfiguration(container).getConfiguration();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.playtika.janusgraph.aerospike.debuggrapdb;

import com.playtika.janusgraph.aerospike.AerospikeStoreManager;
import com.playtika.janusgraph.trace.DebugJanusGraph;
import org.janusgraph.diskstorage.BackendException;
import org.janusgraph.diskstorage.configuration.BasicConfiguration;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager;
import org.janusgraph.graphdb.JanusGraphIterativeBenchmark;
import org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.junit.ClassRule;
import org.testcontainers.containers.GenericContainer;

import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration;
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer;


public class AerospikeDebugGraphIterativeTest extends JanusGraphIterativeBenchmark {

@ClassRule
public static final GenericContainer container = getAerospikeContainer();

@Override
public void open(WriteConfiguration config) {
this.graph = (StandardJanusGraph) DebugJanusGraph.open(config);
this.features = this.graph.getConfiguration().getStoreFeatures();
this.tx = this.graph.newTransaction();
this.mgmt = this.graph.openManagement();
}

@Override
public WriteConfiguration getConfiguration() {
return getAerospikeConfiguration(container).getConfiguration();
}

@Override
public KeyColumnValueStoreManager openStorageManager() throws BackendException {
return new AerospikeStoreManager(new BasicConfiguration(
GraphDatabaseConfiguration.ROOT_NS,
getConfiguration(),
BasicConfiguration.Restriction.NONE));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.playtika.janusgraph.aerospike.debuggrapdb;

import com.playtika.janusgraph.trace.DebugJanusGraph;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.graphdb.JanusGraphPerformanceMemoryTest;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.junit.ClassRule;
import org.testcontainers.containers.GenericContainer;

import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration;
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer;


public class AerospikeDebugGraphPerformanceMemoryTest extends JanusGraphPerformanceMemoryTest {
@ClassRule
public static final GenericContainer container = getAerospikeContainer();

@Override
public void open(WriteConfiguration config) {
this.graph = (StandardJanusGraph) DebugJanusGraph.open(config);
this.features = this.graph.getConfiguration().getStoreFeatures();
this.tx = this.graph.newTransaction();
this.mgmt = this.graph.openManagement();
}

@Override
public WriteConfiguration getConfiguration() {
return getAerospikeConfiguration(container).getConfiguration();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.playtika.janusgraph.aerospike.debuggrapdb;

import com.playtika.janusgraph.trace.DebugJanusGraph;
import org.janusgraph.core.JanusGraphException;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.graphdb.JanusGraphTest;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;

import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration;
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class AerospikeDebugGraphTest extends JanusGraphTest {

@ClassRule
public static final GenericContainer container = getAerospikeContainer();

@Override
public void open(WriteConfiguration config) {
this.graph = (StandardJanusGraph) DebugJanusGraph.open(config);
this.features = this.graph.getConfiguration().getStoreFeatures();
this.tx = this.graph.newTransaction();
this.mgmt = this.graph.openManagement();
}

@Override
public WriteConfiguration getConfiguration() {
return getAerospikeConfiguration(container).getConfiguration();
}

//TODO Investigate
@Ignore
@Test
@Override
public void testIndexUpdatesWithReindexAndRemove() {
}

@Test
@Override
public void testLargeJointIndexRetrieval() {
assertThatThrownBy(super::testLargeJointIndexRetrieval)
.isInstanceOf(JanusGraphException.class) //Record too big
.hasMessageContaining("Could not commit transaction due to exception during persistence");
}

@Test
@Override
public void testVertexCentricQuery() {
assertThatThrownBy(super::testVertexCentricQuery)
.isInstanceOf(JanusGraphException.class) //Record too big
.hasMessageContaining("Could not commit transaction due to exception during persistence");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.playtika.janusgraph.aerospike.debuggrapdb;

import com.playtika.janusgraph.trace.DebugJanusGraph;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.janusgraph.olap.OLAPTest;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;

import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration;
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer;


//TODO https://github.com/JanusGraph/janusgraph/issues/1527
//TODO wait for https://github.com/JanusGraph/janusgraph/issues/1524
public class AerospikeDebugOLAPTest extends OLAPTest {
@ClassRule
public static final GenericContainer container = getAerospikeContainer();

@Override
public void open(WriteConfiguration config) {
this.graph = (StandardJanusGraph) DebugJanusGraph.open(config);
this.features = this.graph.getConfiguration().getStoreFeatures();
this.tx = this.graph.newTransaction();
this.mgmt = this.graph.openManagement();
}

@Override
public WriteConfiguration getConfiguration() {
return getAerospikeConfiguration(container).getConfiguration();
}

//TODO
@Ignore
@Override
@Test
public void degreeCounting() {
}

//Throws java.lang.OutOfMemoryError: Java heap space
@Ignore
@Override
@Test
public void degreeCountingDistance() {
}

//TODO
@Ignore
@Override
@Test
public void testVertexScan() {
}

//TODO
@Ignore
@Override
@Test
public void testShortestDistance() {
}

//TODO
@Ignore
@Override
@Test
public void testPageRank() {
}
}
Loading

0 comments on commit 5f99f6c

Please sign in to comment.