Skip to content

Commit

Permalink
Merge pull request apache#8506: [BEAM-7229] ParDoLifecycleTest: remov…
Browse files Browse the repository at this point in the history
…e duplicated test methods
  • Loading branch information
adude3141 committed May 6, 2019
2 parents 05e78f8 + 5108958 commit a7c40dd
Showing 1 changed file with 4 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,55 +154,7 @@ private static class CallSequenceEnforcingStatefulFn<K, V>

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testTeardownCalledAfterExceptionInStartBundle() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.START_BUNDLE);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
p.run();
fail("Pipeline should have failed with an exception");
} catch (Exception e) {
assertThat(
"Function should have been torn down after exception",
ExceptionThrowingFn.teardownCalled.get(),
is(true));
}
}

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testTeardownCalledAfterExceptionInProcessElement() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.PROCESS_ELEMENT);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
p.run();
fail("Pipeline should have failed with an exception");
} catch (Exception e) {
assertThat(
"Function should have been torn down after exception",
ExceptionThrowingFn.teardownCalled.get(),
is(true));
}
}

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testTeardownCalledAfterExceptionInFinishBundle() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.FINISH_BUNDLE);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
p.run();
fail("Pipeline should have failed with an exception");
} catch (Exception e) {
assertThat(
"Function should have been torn down after exception",
ExceptionThrowingFn.teardownCalled.get(),
is(true));
}
}

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testWithContextTeardownCalledAfterExceptionInSetup() {
public void testTeardownCalledAfterExceptionInSetup() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.SETUP);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
Expand All @@ -218,7 +170,7 @@ public void testWithContextTeardownCalledAfterExceptionInSetup() {

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testWithContextTeardownCalledAfterExceptionInStartBundle() {
public void testTeardownCalledAfterExceptionInStartBundle() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.START_BUNDLE);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
Expand All @@ -234,7 +186,7 @@ public void testWithContextTeardownCalledAfterExceptionInStartBundle() {

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testWithContextTeardownCalledAfterExceptionInProcessElement() {
public void testTeardownCalledAfterExceptionInProcessElement() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.PROCESS_ELEMENT);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
Expand All @@ -250,7 +202,7 @@ public void testWithContextTeardownCalledAfterExceptionInProcessElement() {

@Test
@Category({ValidatesRunner.class, UsesParDoLifecycle.class})
public void testWithContextTeardownCalledAfterExceptionInFinishBundle() {
public void testTeardownCalledAfterExceptionInFinishBundle() {
ExceptionThrowingFn fn = new ExceptionThrowingFn(MethodForException.FINISH_BUNDLE);
p.apply(Create.of(1, 2, 3)).apply(ParDo.of(fn));
try {
Expand Down

0 comments on commit a7c40dd

Please sign in to comment.