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

Uses dev docker container in the dev branch. No AUTO cherry-pick #2621

Merged
merged 10 commits into from
Mar 14, 2022

Conversation

ncordon
Copy link
Contributor

@ncordon ncordon commented Mar 9, 2022

What

Fetches the dev neo4j container from TeamCity.

Why

Some tests rely on the neo4j docker container, which is not published until the database is released. Those tests were being ignored in the CI. This way we can develop more reliably.

This container will be available only for PRs coming from internal contributors.

@ncordon ncordon changed the title Uses dev docker container in the dev branch Uses dev docker container in the dev branch. No AUTO cherry-pick Mar 9, 2022
@ncordon ncordon added 5.0 team-cypher-surface Cypher Surface team should review the PR labels Mar 9, 2022
@ncordon ncordon force-pushed the dev-use-dev-docker branch 5 times, most recently from 6952d1a to 91045d7 Compare March 10, 2022 15:52
@ncordon ncordon force-pushed the dev-use-dev-docker branch from 91045d7 to b8095ca Compare March 11, 2022 11:46
@@ -6,12 +6,11 @@ plugins {
id 'maven-publish'
id 'antlr'
id "org.sonarqube"
id "org.jetbrains.kotlin.jvm" version "1.5.31"
id "org.jetbrains.kotlin.jvm" version "1.6.0"
Copy link
Contributor Author

@ncordon ncordon Mar 11, 2022

Choose a reason for hiding this comment

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

We need to update this in the other maintained builds

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
Copy link
Contributor Author

@ncordon ncordon Mar 11, 2022

Choose a reason for hiding this comment

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

We need to update this in the other maintained builds

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to update this in the other maintained branches

Copy link
Contributor

Choose a reason for hiding this comment

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

No I don't think so, as Neo 4.x is supposed to be run with Java 11?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes yes, I only left this comment as a self-reminder to review these settings in other branches

@@ -20,7 +19,7 @@ jar {
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update this in the other branches

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but in the other branches 4.2, 4.3 and 4.4, I guess you should update it to 11 rather than 17.

Comment on lines 153 to 156
configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-nop'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add this in the other branches

Comment on lines 100 to +105
filter {
setFailOnNoMatchingTests(false)
}

testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add this lines in other branches

run: (find ~/.gradle/caches -name "*neo4j*" -exec rm -rf {} \;) || echo "All neo4j files cleaned"
- name: Check procedures included in apoc full
run: git diff --exit-code full/src/main/resources/extended.txt || (echo "extended.txt file does not contain all changes" && exit -1)
run: chmod +x gradlew && ./gradlew build
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplify these lines and make sure there's no build --continue in other branches.

Comment on lines 35 to 60
for (var version: Neo4jVersion.values()) {
try (Neo4jContainerExtension neo4jContainer = createDB(version, APOC_FULL, !TestUtil.isRunningInCI())
.withNeo4jConfig("dbms.transaction.timeout", "5s")) {

neo4jContainer.start();
assertTrue("Neo4j Instance should be up-and-running", neo4jContainer.isRunning());

Session session = neo4jContainer.getSession();
int procedureCount = session.run("SHOW PROCEDURES YIELD name WHERE name STARTS WITH 'apoc' RETURN count(*) AS count").peek().get("count").asInt();
int functionCount = session.run("SHOW FUNCTIONS YIELD name WHERE name STARTS WITH 'apoc' RETURN count(*) AS count").peek().get("count").asInt();
int coreCount = session.run("CALL apoc.help('') YIELD core WHERE core = true RETURN count(*) AS count").peek().get("count").asInt();

assertTrue(procedureCount > 0);
assertTrue(functionCount > 0);
assertTrue(coreCount > 0);
} catch (Exception ex) {
// if Testcontainers wasn't able to retrieve the docker image we ignore the test
if (TestContainerUtil.isDockerImageAvailable(ex)) {
ex.printStackTrace();
fail("Should not have thrown exception when trying to start Neo4j: " + ex);
} else if (!TestUtil.isRunningInCI()) {
fail( "The docker image " + TestContainerUtil.neo4jEnterpriseDockerImageVersion + " should be available in the CI");
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor this in other branches to also have tests for community version (to avoid binary incompatibilities ever again)

@@ -48,7 +47,7 @@ dependencies {
// implementation group: 'commons-codec', name: 'commons-codec', version: '1.14'
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
implementation group: 'org.hdrhistogram', name: 'HdrHistogram', version: '2.1.9'
implementation group: 'org.neo4j.driver', name: 'neo4j-java-driver', version: '4.0.0'
compileOnly group: 'org.neo4j.driver', name: 'neo4j-java-driver-slim', version: '4.4.3'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make the driver compile only in other branches to avoid overwriting the one in the database when we plug in apoc

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean with 'only in other branches'? I'm not sure I follow...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'll word it in other way: I want the version of java driver to be a compileOnly dependency as well in other branches (since it is included in the database already). Not doing this causes the database to evict its own java version and use the one included in the apoc jar.

@@ -20,7 +20,7 @@
public void test() {
try {
Neo4jContainerExtension neo4jContainer = createEnterpriseDB(!TestUtil.isRunningInCI())
.withNeo4jConfig("dbms.transaction.timeout", "5s");
.withNeo4jConfig("dbms.transaction.timeout", "60s");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Port this to other branches

Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

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

Most things looks good, just some smaller comments and questions

.github/workflows/CI.yaml Outdated Show resolved Hide resolved
.github/workflows/CI.yaml Show resolved Hide resolved
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Copy link
Contributor

Choose a reason for hiding this comment

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

No I don't think so, as Neo 4.x is supposed to be run with Java 11?

@@ -20,7 +19,7 @@ jar {
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but in the other branches 4.2, 4.3 and 4.4, I guess you should update it to 11 rather than 17.

full/src/main/java/apoc/bolt/Bolt.java Outdated Show resolved Hide resolved
@@ -48,7 +47,7 @@ dependencies {
// implementation group: 'commons-codec', name: 'commons-codec', version: '1.14'
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
implementation group: 'org.hdrhistogram', name: 'HdrHistogram', version: '2.1.9'
implementation group: 'org.neo4j.driver', name: 'neo4j-java-driver', version: '4.0.0'
compileOnly group: 'org.neo4j.driver', name: 'neo4j-java-driver-slim', version: '4.4.3'
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean with 'only in other branches'? I'm not sure I follow...

test-startup/src/test/java/StartupTest.java Show resolved Hide resolved
@ncordon ncordon merged commit f896da6 into dev Mar 14, 2022
@ncordon ncordon deleted the dev-use-dev-docker branch March 14, 2022 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 team-cypher-surface Cypher Surface team should review the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants