You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by pa...@apache.org on 2022/09/08 16:02:58 UTC

[beam] branch master updated: Decrease derby.locks.waitTimeout in jdbc unit test

This is an automated email from the ASF dual-hosted git repository.

pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 269e0098f6b Decrease derby.locks.waitTimeout in jdbc unit test
     new ab8a375acf4 Merge pull request #23019 from Abacn/jdbctestspeed
269e0098f6b is described below

commit 269e0098f6baa55629b2b45a3cb1950759e1e914
Author: Yi Hu <ya...@google.com>
AuthorDate: Fri Sep 2 21:57:45 2022 -0400

    Decrease derby.locks.waitTimeout in jdbc unit test
---
 .../sdk/io/jdbc/JdbcIOExceptionHandlingParameterizedTest.java    | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sdks/java/io/jdbc/src/test/java/org/apache/beam/sdk/io/jdbc/JdbcIOExceptionHandlingParameterizedTest.java b/sdks/java/io/jdbc/src/test/java/org/apache/beam/sdk/io/jdbc/JdbcIOExceptionHandlingParameterizedTest.java
index 6fd245d5ba6..db345e2465a 100644
--- a/sdks/java/io/jdbc/src/test/java/org/apache/beam/sdk/io/jdbc/JdbcIOExceptionHandlingParameterizedTest.java
+++ b/sdks/java/io/jdbc/src/test/java/org/apache/beam/sdk/io/jdbc/JdbcIOExceptionHandlingParameterizedTest.java
@@ -38,6 +38,7 @@ import org.apache.beam.sdk.values.KV;
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeMatcher;
 import org.joda.time.Duration;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -53,6 +54,14 @@ public class JdbcIOExceptionHandlingParameterizedTest {
           "org.apache.derby.jdbc.EmbeddedDriver", "jdbc:derby:memory:testDB;create=true");
   private static final DataSource DATA_SOURCE = DATA_SOURCE_CONFIGURATION.buildDatasource();
 
+  @BeforeClass
+  public static void beforeClass() {
+    // by default, derby uses a lock timeout of 60 seconds. In order to speed up the test
+    // and detect the lock faster, we decrease this timeout
+    System.setProperty("derby.locks.waitTimeout", "2");
+    System.setProperty("derby.stream.error.file", "build/derby.log");
+  }
+
   @Parameterized.Parameters
   public static Collection<Object[]> data() {
     return Arrays.asList(