Skip to content
/ beam Public
forked from apache/beam

Commit

Permalink
Add timeout to unit tests causing SickBay PostCommit timeout (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Abacn authored Mar 2, 2023
1 parent 913fefa commit 4a244b4
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .test-infra/jenkins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Beam Jenkins overview page: [link](https://ci-beam.apache.org/)
| beam_PostCommit_Javadoc | [cron](https://ci-beam.apache.org/job/beam_PostCommit_Javadoc/), [phrase](https://ci-beam.apache.org/job/beam_PostCommit_Javadoc_PR/) | `Run Javadoc PostCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Javadoc/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Javadoc) |
| beam_PostCommit_PortableJar_Flink | [cron](https://ci-beam.apache.org/job/beam_PostCommit_PortableJar_Flink/), [phrase](https://ci-beam.apache.org/job/beam_PostCommit_PortableJar_Flink_PR/) | `Run PortableJar_Flink PostCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_PortableJar_Flink/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_PortableJar_Flink) |
| beam_PostCommit_PortableJar_Spark | [cron](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_PortableJar_Spark/), [phrase](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_PortableJar_Spark_PR/) | `Run PortableJar_Spark PostCommit` | [![Build Status](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_PortableJar_Spark/badge/icon)](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_PortableJar_Spark/) |
| beam_PostCommit_Java_Sickbay | [cron](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_Java_Sickbay/), [phrase](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_Java_Sickbay_PR/) | `Run Java Sickbay` | [![Build Status](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_Java_Sickbay/badge/icon)](https://ci-beam.apache.org/view/PostCommit/job/beam_PostCommit_Java_Sickbay/) |
| beam_PostCommit_Py_VR_Dataflow | [cron](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/), [phrase](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_PR/) | `Run Python Dataflow ValidatesRunner` | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow) |
| beam_PostCommit_Py_VR_Dataflow_V2 | [cron](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/), [phrase](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2_PR/) | `Run Python Dataflow V2 ValidatesRunner` | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2) |
| beam_PostCommit_Py_ValCont | [cron](https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/), [phrase](https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont_PR/) | `Run Python Dataflow ValidatesContainer` | [![Build Status](https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/badge/icon)](https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -88,6 +89,7 @@ public class PipelineTest {
@Rule public final TestPipeline pipeline = TestPipeline.create();
@Rule public ExpectedLogs logged = ExpectedLogs.none(Pipeline.class);
@Rule public ExpectedException thrown = ExpectedException.none();
@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

// Mock class that throws a user code exception during the call to
// Pipeline.run().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -67,6 +68,7 @@ public class PCollectionCustomCoderTest {

@Rule public final transient ExpectedException thrown = ExpectedException.none();
@Rule public final transient TestPipeline pipeline = TestPipeline.create();
@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

/** Wrapper of StringUtf8Coder with customizable exception-throwing. */
public static class CustomTestCoder extends CustomCoder<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.runners.Parameterized;
Expand Down Expand Up @@ -186,6 +187,8 @@ public static class NeedsRunnerTests implements Serializable {

@Rule public transient ExpectedException expectedException = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

@Parameterized.Parameters(name = "{index}: {0}")
public static Collection<Object[]> params() {
return Arrays.asList(new Object[][] {{true}, {false}});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -88,6 +89,8 @@ public class FileIOTest implements Serializable {

@Rule public transient ExpectedException thrown = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

@Test
@Category(NeedsRunner.class)
public void testMatchAndMatchAll() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
Expand All @@ -80,6 +81,7 @@ public class GroupIntoBatchesTest implements Serializable {
private static final int ALLOWED_LATENESS = 0;
private static final Logger LOG = LoggerFactory.getLogger(GroupIntoBatchesTest.class);
@Rule public transient TestPipeline pipeline = TestPipeline.create();
@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);
private transient ArrayList<KV<String, String>> data = createTestData(EVEN_NUM_ELEMENTS);

private static ArrayList<KV<String, String>> createTestData(long numElements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -61,6 +62,8 @@ public class MapElementsTest implements Serializable {

@Rule public transient ExpectedException thrown = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

/**
* A {@link SimpleFunction} to test that the coder registry can propagate coders that are bound to
* type variables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -191,6 +192,8 @@ public abstract static class SharedTestBase {
@Rule public final transient TestPipeline pipeline = TestPipeline.create();

@Rule public transient ExpectedException thrown = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);
}

private static class PrintingDoFn extends DoFn<String, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -95,6 +96,8 @@
})
public class SplittableDoFnTest implements Serializable {

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

static class PairStringWithIndexToLengthBase extends DoFn<String, KV<String, Integer>> {
@ProcessElement
public ProcessContinuation process(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.junit.experimental.categories.Category;
import org.junit.internal.matchers.ThrowableMessageMatcher;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -89,6 +90,8 @@ public class ViewTest implements Serializable {

@Rule public transient ExpectedException thrown = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

@Test
@Category(ValidatesRunner.class)
public void testSingletonSideInput() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

Expand All @@ -44,6 +45,8 @@ public class WithTimestampsTest implements Serializable {

@Rule public transient ExpectedException thrown = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

@Test
@Category(ValidatesRunner.class)
public void withTimestampsShouldApplyTimestamps() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.runners.Parameterized;
Expand Down Expand Up @@ -192,6 +193,8 @@ public static class NeedsRunnerTests implements Serializable {

@Rule public transient ExpectedException expectedException = ExpectedException.none();

@Rule public transient Timeout globalTimeout = Timeout.seconds(1200);

@Parameterized.Parameters(name = "{index}: {0}")
public static Collection<Object[]> params() {
return Arrays.asList(new Object[][] {{true}, {false}});
Expand Down

0 comments on commit 4a244b4

Please sign in to comment.