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

Upgrade Neo4j server and driver dependencies. #4789

Merged
merged 7 commits into from
Jan 4, 2022

Conversation

meistermeier
Copy link
Contributor

@meistermeier meistermeier commented Dec 16, 2021

This PR upgrades

  • Neo4j server from for testing and as the (deprecated) default to 4.4.1.
  • The Neo4j Java driver for testing to the most current 4.4.2.

Two things that I would like to improve but do not know how to solve them:

  1. Having to explicitly say that the database from the test-resources needs to get upgraded every time. @michael-simons https://github.com/testcontainers/testcontainers-java/compare/master...meistermeier:upgrade-neo4j?expand=1#diff-7f1bb307bc0ede77f2ef4beb5966f2187e591768eabeb9733b4796df6a689137R50
  2. For testing purposes we have to build a minimal plugin against the Neo4j 3.5 API and cannot use the better fitting 4.4.x library because Neo4j 4.x has a JDK 11 baseline and as a consequence I cannot compile a 4.x plugin with the current build pipeline (JDK 8). @kiview I heard you know somebody who knows how to use Gradle's toolchains ;)

Copy link
Member

@kiview kiview left a comment

Choose a reason for hiding this comment

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

LGTM, WDYT about removing Neo4jTestImages?

@@ -250,4 +257,9 @@ private static String formatConfigurationKey(String plainConfigKey) {
.replaceAll("_", "__")
.replaceAll("\\.", "_"));
}

private boolean usesVersion(String version) {
Copy link
Member

Choose a reason for hiding this comment

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

We're a bit cautious that simply looking at the start of the version/tag could be a bit fragile in the case of custom images that people may be using, or simply surprising version numbers from any source.

Please could you have a look at how a similar problem is handled in LocalStackContainer?
https://github.com/testcontainers/testcontainers-java/blob/master/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java#L100

There are three main facets which (I hope!) add up to a safer implementation:

  1. use our ComparableVersion utility class to do a semver comparison, not startsWith
  2. gracefully fall back if a custom or non-parsable version is found - clearly logging what’s happened and how to change it
  3. provide a constructor to allow the automatic version detection to be overridden, if a custom version string is being used that clashes with the original

It's not perfect - edge cases can still exist - but this seems to be working well for users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your feedback. I changed the code to use ComparableVersion (hopefully right).
I refrained from the additional constructor because the feature can only used with older versions of Neo4j already today.
I do not want to have
a) an additional constructor added to the mix of the already available ones. This could confuse the users.
b) encourage users to use an older version for convenience
Both might even result in users trying to somehow hack their way around the restriction and end up with a broken database inside the container.

Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

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

@meistermeier thanks for switching to using ComparableVersion and for explaining your intentions around the constructors. I think this is fine, on balance, and am happy to approve.

@kiview kiview added this to the next milestone Jan 4, 2022
@kiview kiview merged commit f89dece into testcontainers:master Jan 4, 2022
@meistermeier meistermeier deleted the upgrade-neo4j branch March 11, 2022 12:47
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.

3 participants