Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a README, and enabled a forgotten test.

  • Loading branch information...
commit da6aae92d3b7a0fedaa142da4ba88ac98630c72c 1 parent 74d89e6
David Montag authored
122 README.txt
View
@@ -0,0 +1,122 @@
+Neo4j store compatibility tests
+===============================
+
+This project aims to create a backward compatibility test suite intended for
+continuous use. Its main goal is to detect problems related to store upgrades
+between versions.
+
+It does this by storing a set of test stores generated by so-called agents.
+A Neo4j version will run a number of agents, generating a number of test stores
+for that version. An agent is a Java class implementing StoreAgent, and it
+is capable of both generating a store and, given a store, verifying that it
+matches what it created.
+
+File structure
+--------------
+
+src/
+ framework/ Testing framework classes
+ versions/ Version-specific tests
+ default/ Default test suite
+ agents/ Package for agents
+ META-INF/
+ services/
+ org.neo4j.compatibility.StoreAgent References agents to be used
+ 1.2.M06 "Patch" suite, applied on default suite for compatibility of
+ certain versions.
+ 1.2.M05
+ ...
+
+Scripts
+-------
+
+./generate.sh <version>
+
+ Generate new test stores for the specified Neo4j version.
+
+./generate-all.sh
+
+ Generate new test stores for all Neo4j versions specified in the script.
+
+./verify.sh <version>
+
+ Verify that the Neo4j version specified can verify all stored test store
+ versions.
+
+Examples
+--------
+
+./generate.sh 1.2.M04
+
+./generate-all.sh
+
+./verify.sh 1.3-SNAPSHOT
+
+New versions
+------------
+
+When a new version of Neo4j is released, the previous version needs to be
+rotated into the set of versions tested against. This can be done by executing:
+
+./generate.sh <version>
+
+for the version that is being rotated. Also add the rotated version to the set
+of versions in generate-all.sh. For example, if 1.3.M03 is being released,
+just do:
+
+./generate.sh 1.3.M02
+
+and verify the new version:
+
+./verify 1.3.M03
+
+Adding new tests
+----------------
+
+The default behavior should be to add new tests to src/versions/default.
+Simply give your class a unique name (that shouldn't change), and make your
+class implement StoreAgent. Finally, add your class name to
+src/versions/default/META-INF/services/org.neo4j.compatibility.StoreAgent. It
+will then be picked up when generating and verifying test stores.
+
+Managing code incompatibility
+-----------------------------
+
+Sometimes changes to new code break old code. In general it is good to preserve
+working test code for each version of Neo4j.
+
+If a new release breaks code in src/versions/default, simply create a
+version-specific directory for the broken version and copy the broken test
+cases there. Then fix the code in src/versions/default to match the latest
+release.
+
+Rotated releases can opt to not do any verification, since it is generally the
+latest version that will get verified.
+
+Code merging procedure
+----------------------
+
+When a version is to be generated or verified, first it is determined whether
+a specific version directory for that version exists or not. If none is found,
+then the default is used, and that is that.
+
+If a version directory is found, existence for a file named "no-default" is
+checked. If such a file exists, the default will not be used as the template.
+Then the classes used will simply be the ones in that version directory.
+
+If there is no "no-default" file, then the defaults are used as a template, and
+any files that exist in the version directory replace the ones in the default
+set. Note that this includes the META-INF/... file. Typically there will be two
+use cases:
+
+1. The tested version's code does not compile with the default, and therefore
+ requires special changes. An example is graphDb.index() vs IndexService.
+
+2. A specific test case class (agent) should not be used for this version. This
+ is easily achieved by making an empty class with the same name, that
+ inherits from IgnoringStoreAgent. It will not be picked up as a store agent.
+
+So to sum up:
+
+exists( version/no-default ) ? version : default + version
+
4 build.xml
View
@@ -73,13 +73,13 @@
</condition>
</target>
- <target name="compile-default" depends="check-should-copy-default" if="should.copy.default">
+ <target name="copy-default" depends="check-should-copy-default" if="should.copy.default">
<copy todir="${src.effective.dir}">
<fileset dir="${src.default.dir}" includes="**/*"/>
</copy>
</target>
- <target name="compile-version" depends="compile-default">
+ <target name="compile-version" depends="copy-default">
<copy todir="${src.effective.dir}" overwrite="true">
<fileset dir="${src.version.dir}" includes="**/*"/>
</copy>
3  src/versions/default/META-INF/services/org.neo4j.compatibility.StoreAgent
View
@@ -1,4 +1,5 @@
agents.SimpleGraph
agents.SimpleIndexingGraph
agents.UnclosedIndexingGraph
-agents.FulltextIndexingGraph
+agents.FulltextIndexingGraph
+agents.ExhaustiveGraph
8 src/versions/default/agents/ExhaustiveGraph.java
View
@@ -72,10 +72,10 @@ public void verify( String dbPath )
}
assertEquals( new HashSet<Node>( Arrays.asList( personB, personC, personD ) ), actual );
- assertEquals( personA, personB.getSingleRelationship( WORKS_FOR, Direction.INCOMING ) );
- assertEquals( personC, personB.getSingleRelationship( WORKS_FOR, Direction.OUTGOING ) );
+ assertEquals( personA, personB.getSingleRelationship( WORKS_FOR, Direction.INCOMING ).getStartNode() );
+ assertEquals( personC, personB.getSingleRelationship( WORKS_FOR, Direction.OUTGOING ).getEndNode() );
- assertEquals( personD, personC.getSingleRelationship( WORKS_FOR, Direction.OUTGOING ) );
- assertEquals( personC, personD.getSingleRelationship( WORKS_FOR, Direction.INCOMING ) );
+ assertEquals( personD, personC.getSingleRelationship( WORKS_FOR, Direction.OUTGOING ).getEndNode() );
+ assertEquals( personC, personD.getSingleRelationship( WORKS_FOR, Direction.INCOMING ).getStartNode() );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.