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

Try fixing 5.24 TeamCity errors #4204

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading