Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a README, and enabled a forgotten test.
- Loading branch information
Showing
4 changed files
with
130 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/versions/default/META-INF/services/org.neo4j.compatibility.StoreAgent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,4 +1,5 @@ | |||
agents.SimpleGraph | agents.SimpleGraph | ||
agents.SimpleIndexingGraph | agents.SimpleIndexingGraph | ||
agents.UnclosedIndexingGraph | agents.UnclosedIndexingGraph | ||
agents.FulltextIndexingGraph | agents.FulltextIndexingGraph | ||
agents.ExhaustiveGraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters