Skip to content

Commit 4f0586f

Browse files
authored
Try fixing 5.24 TeamCity errors (#4204)
* Try fixing 5.24 TeamCity errors * removed unused deps
1 parent 9424ed8 commit 4f0586f

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

extended-it/src/test/java/apoc/couchbase/CouchbaseTestUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ protected static void checkDocumentMetadata(CouchbaseJsonDocument jsonDocumentCr
132132
}
133133

134134
protected static void createCouchbaseContainer() {
135-
// 7.0 support stably multi collections and scopes
136-
couchbase = new CouchbaseContainer("couchbase/server:7.0.0")
135+
// 7.x support stably multi collections and scopes
136+
couchbase = new CouchbaseContainer("couchbase/server:7.2.6")
137137
.withStartupAttempts(3)
138138
.withCredentials(USERNAME, PASSWORD)
139139
.withBucket(new BucketDefinition(BUCKET_NAME));

extended/src/test/java/apoc/export/csv/ExportCsvTest.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import org.junit.BeforeClass;
1515
import org.junit.ClassRule;
1616
import org.junit.Test;
17+
import org.junit.rules.TemporaryFolder;
1718
import org.neo4j.configuration.GraphDatabaseSettings;
18-
import org.neo4j.test.rule.DbmsRule;
19-
import org.neo4j.test.rule.ImpermanentDbmsRule;
19+
import org.neo4j.dbms.api.DatabaseManagementService;
20+
import org.neo4j.graphdb.GraphDatabaseService;
21+
import org.neo4j.test.TestDatabaseManagementServiceBuilder;
2022

2123
import java.io.File;
2224
import java.nio.charset.StandardCharsets;
@@ -45,19 +47,19 @@ public class ExportCsvTest {
4547
",,,,,,,,\"0\",\"1\",\"KNOWS\"%n" +
4648
",,,,,,,,\"3\",\"4\",\"NEXT_DELIVERY\"%n");
4749

48-
private static File directory = new File("target/import");
49-
static { //noinspection ResultOfMethodCallIgnored
50-
directory.mkdirs();
51-
}
52-
5350
@ClassRule
54-
public static DbmsRule db = new ImpermanentDbmsRule()
55-
.withSetting(GraphDatabaseSettings.load_csv_file_url_root, directory.toPath().toAbsolutePath());
51+
public static TemporaryFolder storeDir = new TemporaryFolder();
52+
53+
private static GraphDatabaseService db;
54+
private static DatabaseManagementService dbms;
5655

5756
private static MiniDFSCluster miniDFSCluster;
5857

5958
@BeforeClass
6059
public static void setUp() throws Exception {
60+
dbms = new TestDatabaseManagementServiceBuilder(storeDir.getRoot().toPath()).build();
61+
db = dbms.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
62+
6163
TestUtil.registerProcedure(db, ExportCSV.class, Graphs.class);
6264
apocConfig().setProperty(APOC_EXPORT_FILE_ENABLED, true);
6365
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})");
@@ -70,7 +72,7 @@ public static void tearDown() {
7072
if (miniDFSCluster!= null) {
7173
miniDFSCluster.shutdown();
7274
}
73-
db.shutdown();
75+
dbms.shutdown();
7476
}
7577

7678
@Test

extended/src/test/java/apoc/load/LoadLdapContainerTest.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
import org.junit.BeforeClass;
66
import org.junit.ClassRule;
77
import org.junit.Test;
8+
import org.junit.rules.TemporaryFolder;
89
import org.neo4j.test.rule.DbmsRule;
910
import org.neo4j.test.rule.ImpermanentDbmsRule;
1011
import org.testcontainers.containers.GenericContainer;
12+
import org.testcontainers.containers.wait.strategy.Wait;
1113

14+
import java.io.IOException;
1215
import java.util.Map;
1316

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

2225
private static GenericContainer ldap;
2326

27+
@ClassRule
28+
public static TemporaryFolder storeDir = new TemporaryFolder();
29+
2430
@ClassRule
2531
public static DbmsRule db = new ImpermanentDbmsRule();
2632

2733
@BeforeClass
28-
public static void beforeClass() {
34+
public static void beforeClass() throws IOException {
2935
ldap = new GenericContainer("osixia/openldap:1.5.0")
3036
.withEnv("LDAP_TLS_VERIFY_CLIENT", "try")
31-
.withExposedPorts(LDAP_DEFAULT_PORT, LDAP_DEFAULT_SSL_PORT);
37+
.withExposedPorts(LDAP_DEFAULT_PORT, LDAP_DEFAULT_SSL_PORT)
38+
.waitingFor( Wait.forListeningPort() );
39+
40+
addVolumes();
3241
ldap.start();
3342
TestUtil.registerProcedure(db, LoadLdap.class);
3443
}
3544

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

0 commit comments

Comments
 (0)