Skip to content

Commit 00522bc

Browse files
authored
Merge pull request #560 from PetrJanouch/1.7_flaky_test_fix
Fixing flaky tests
2 parents 4acf9db + b6ad7eb commit 00522bc

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

driver/src/test/java/org/neo4j/driver/v1/integration/TrustCustomCertificateIT.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@
1818
*/
1919
package org.neo4j.driver.v1.integration;
2020

21+
import org.junit.jupiter.api.AfterAll;
22+
import org.junit.jupiter.api.BeforeAll;
2123
import org.junit.jupiter.api.Test;
2224
import org.junit.jupiter.api.extension.RegisterExtension;
2325

2426
import java.io.File;
27+
import java.io.IOException;
28+
import java.nio.file.Files;
29+
import java.nio.file.Path;
30+
import java.nio.file.StandardCopyOption;
2531
import java.util.function.Supplier;
2632

2733
import org.neo4j.driver.v1.Config;
@@ -42,11 +48,32 @@
4248
import static org.neo4j.driver.v1.util.CertificateToolUtil.createNewCertificateAndKeySignedBy;
4349

4450
@ParallelizableIT
45-
public class TrustCustomCertificateIT
51+
class TrustCustomCertificateIT
4652
{
4753
@RegisterExtension
4854
static final DatabaseExtension neo4j = new DatabaseExtension();
4955

56+
private static Path originalKeyFile;
57+
private static Path originalCertFile;
58+
59+
@BeforeAll
60+
static void beforeAll() throws IOException
61+
{
62+
originalKeyFile = Files.createTempFile( "key-file-", "" );
63+
originalCertFile = Files.createTempFile( "cert-file-", "" );
64+
65+
Files.copy( neo4j.tlsKeyFile().toPath(), originalKeyFile , StandardCopyOption.REPLACE_EXISTING);
66+
Files.copy( neo4j.tlsCertFile().toPath(), originalCertFile, StandardCopyOption.REPLACE_EXISTING );
67+
}
68+
69+
@AfterAll
70+
static void afterAll() throws Exception
71+
{
72+
neo4j.updateEncryptionKeyAndCert( originalKeyFile.toFile(), originalCertFile.toFile() );
73+
Files.deleteIfExists( originalKeyFile );
74+
Files.deleteIfExists( originalCertFile );
75+
}
76+
5077
@Test
5178
void shouldAcceptServerWithCertificateSignedByDriverCertificate() throws Throwable
5279
{

0 commit comments

Comments
 (0)