Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to test different cypher versions globally #725

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

gem-neo4j
Copy link
Contributor

Add config and env variable to be able to test Cypher Versions - ready to fix all Cypher 25 test failures

@gem-neo4j
Copy link
Contributor Author

@gem-neo4j gem-neo4j added dev and removed dev labels Jan 29, 2025
@gem-neo4j gem-neo4j force-pushed the dev_test_cypher_versions branch from 9a31599 to 188ff80 Compare January 29, 2025 14:17
@gem-neo4j gem-neo4j marked this pull request as draft January 29, 2025 15:04
@gem-neo4j gem-neo4j force-pushed the dev_test_cypher_versions branch 4 times, most recently from 7c939a9 to 44f67bf Compare January 30, 2025 13:08
@gem-neo4j gem-neo4j force-pushed the dev_test_cypher_versions branch from 44f67bf to 55d4729 Compare January 30, 2025 13:21
@gem-neo4j gem-neo4j marked this pull request as ready for review January 31, 2025 08:27
// A test may set this for the entire file itself, so we shouldn't override that
if (!globalConfig.containsKey(GraphDatabaseInternalSettings.default_cypher_version)) {
String cypherVersionEnv = System.getenv()
.getOrDefault("CYPHER_VERSION", GraphDatabaseInternalSettings.CypherVersion.Cypher25.name());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we leave this as 25 going forward?

The plan is to ask for the TC builds to use the env to test both Cypher 5 and 25 in PR builds :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for using 5 as default for now and setting it to 25 when mono repo has flipped.

Copy link
Contributor

@loveleif loveleif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines 1368 to 1371
public static List<String> getCypherVersions() {
assert QueryLanguage.ALL.size() == 2;
return List.of("5", "25");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be a compilation failure:

Suggested change
public static List<String> getCypherVersions() {
assert QueryLanguage.ALL.size() == 2;
return List.of("5", "25");
}
public static List<String> getCypherVersions() {
return QueryLanguage.ALL.stream()
.map(l -> switch(l) {
case Cypher5 -> "5";
case Cypher25 -> "25";
})
.toList();
}

assertResultAsJsonEquals(
CypherVersion.Default,
showFunctions(null),
showFunctions(CypherVersion.Default),
Copy link
Contributor

@loveleif loveleif Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CypherVersion.Default is being removed. If you really need a default one you can use:

switch (GraphDatabaseSettings.default_langage.default()) {
  case Cypher5 => CypherVerision.Cypher5;
  case Cypher25 => CypherVerision.Cypher25;
}

assertResultAsJsonEquals(
CypherVersion.Default,
showProcedures(null),
showProcedures(CypherVersion.Default),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

directory.toPath().toAbsolutePath());
directory.toPath().toAbsolutePath())
.withSetting(
GraphDatabaseInternalSettings.default_cypher_version,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting is being replaced by GraphDatabaseSettings.default_language. Unfortunately that is not hooked up yet (PR), so go ahead and merge this and I sort it out later.

// A test may set this for the entire file itself, so we shouldn't override that
if (!globalConfig.containsKey(GraphDatabaseInternalSettings.default_cypher_version)) {
String cypherVersionEnv = System.getenv()
.getOrDefault("CYPHER_VERSION", GraphDatabaseInternalSettings.CypherVersion.Cypher25.name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for using 5 as default for now and setting it to 25 when mono repo has flipped.

@gem-neo4j gem-neo4j merged commit 1b93708 into dev Feb 3, 2025
11 checks passed
@gem-neo4j gem-neo4j deleted the dev_test_cypher_versions branch February 3, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants