Skip to content

Commit

Permalink
Try fixing 5.24 TeamCity errors (#4203)
Browse files Browse the repository at this point in the history
* Try fixing 5.24 TeamCity errors

* removed unused imports
  • Loading branch information
vga91 committed Oct 14, 2024
1 parent 4df3532 commit 8b13059
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ protected static void checkDocumentMetadata(CouchbaseJsonDocument jsonDocumentCr
}

protected static void createCouchbaseContainer() {
// 7.0 support stably multi collections and scopes
couchbase = new CouchbaseContainer("couchbase/server:7.0.0")
// 7.x support stably multi collections and scopes
couchbase = new CouchbaseContainer("couchbase/server:7.2.6")
.withStartupAttempts(3)
.withCredentials(USERNAME, PASSWORD)
.withBucket(new BucketDefinition(BUCKET_NAME));
Expand Down
2 changes: 2 additions & 0 deletions extended-it/src/test/java/apoc/load/PostgresJdbcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.graphdb.Result;
import org.neo4j.test.rule.DbmsRule;
Expand Down Expand Up @@ -98,6 +99,7 @@ public void testLoadJdbcParams() throws Exception {
}

@Test
@Ignore("flaky")
public void testIssue4141PeriodicIterateWithJdbc() throws Exception {
var config = Util.map("url", postgress.getJdbcUrl(),
"config", Util.map("schema", "test",
Expand Down
22 changes: 12 additions & 10 deletions extended/src/test/java/apoc/export/csv/ExportCsvTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.neo4j.configuration.GraphDatabaseSettings;
import org.neo4j.test.rule.DbmsRule;
import org.neo4j.test.rule.ImpermanentDbmsRule;
import org.neo4j.dbms.api.DatabaseManagementService;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.TestDatabaseManagementServiceBuilder;

import java.io.File;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -45,19 +47,19 @@ public class ExportCsvTest {
",,,,,,,,\"0\",\"1\",\"KNOWS\"%n" +
",,,,,,,,\"3\",\"4\",\"NEXT_DELIVERY\"%n");

private static File directory = new File("target/import");
static { //noinspection ResultOfMethodCallIgnored
directory.mkdirs();
}

@ClassRule
public static DbmsRule db = new ImpermanentDbmsRule()
.withSetting(GraphDatabaseSettings.load_csv_file_url_root, directory.toPath().toAbsolutePath());
public static TemporaryFolder storeDir = new TemporaryFolder();

private static GraphDatabaseService db;
private static DatabaseManagementService dbms;

private static MiniDFSCluster miniDFSCluster;

@BeforeClass
public static void setUp() throws Exception {
dbms = new TestDatabaseManagementServiceBuilder(storeDir.getRoot().toPath()).build();
db = dbms.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);

TestUtil.registerProcedure(db, ExportCSV.class, Graphs.class);
apocConfig().setProperty(APOC_EXPORT_FILE_ENABLED, true);
db.executeTransactionally("CREATE (f:User1:User {name:'foo',age:42,male:true,kids:['a','b','c']})-[:KNOWS]->(b:User {name:'bar',age:42}),(c:User {age:12})");
Expand All @@ -70,7 +72,7 @@ public static void tearDown() {
if (miniDFSCluster!= null) {
miniDFSCluster.shutdown();
}
db.shutdown();
dbms.shutdown();
}

@Test
Expand Down
26 changes: 24 additions & 2 deletions extended/src/test/java/apoc/load/LoadLdapContainerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.neo4j.test.rule.DbmsRule;
import org.neo4j.test.rule.ImpermanentDbmsRule;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;

import java.io.IOException;
import java.util.Map;

import static apoc.util.TestUtil.testCall;
Expand All @@ -21,18 +24,37 @@ public class LoadLdapContainerTest {

private static GenericContainer ldap;

@ClassRule
public static TemporaryFolder storeDir = new TemporaryFolder();

@ClassRule
public static DbmsRule db = new ImpermanentDbmsRule();

@BeforeClass
public static void beforeClass() {
public static void beforeClass() throws IOException {
ldap = new GenericContainer("osixia/openldap:1.5.0")
.withEnv("LDAP_TLS_VERIFY_CLIENT", "try")
.withExposedPorts(LDAP_DEFAULT_PORT, LDAP_DEFAULT_SSL_PORT);
.withExposedPorts(LDAP_DEFAULT_PORT, LDAP_DEFAULT_SSL_PORT)
.waitingFor( Wait.forListeningPort() );

addVolumes();
ldap.start();
TestUtil.registerProcedure(db, LoadLdap.class);
}

/**
* Added volumes to solve the issue: https://github.com/osixia/docker-openldap/issues/400,
* without these we can have the following error during startup if we execute the container multiple times:
* [Errno 17] File exists: '/container/service/:ssl-tools/startup.sh' -> '/container/run/startup/:ssl-tools'
* and, even if the container is started, we have error during apoc.load.ldap(...), i.e. :
* IOException(LDAPException(resultCode=91 (connect error), errorMessage='An error occurred while attempting to establish a connection to server localhost/127.0.0.1:56860
*/
private static void addVolumes() throws IOException {
ldap.withFileSystemBind(storeDir.newFolder("data/ldap").getAbsolutePath(), "/var/lib/ldap")
.withFileSystemBind(storeDir.newFolder("data/slapd").getAbsolutePath(), "/etc/ldap/slapd.d")
.withFileSystemBind(storeDir.newFolder("tmp").getAbsolutePath(), "/tmp");
}

@AfterClass
public static void tearDown() {
ldap.stop();
Expand Down

0 comments on commit 8b13059

Please sign in to comment.