Skip to content

Commit

Permalink
[hotfix][test] Fix unstable tests in CustomSerializationITCase
Browse files Browse the repository at this point in the history
  • Loading branch information
reswqa committed Oct 10, 2024
1 parent d86fe4b commit 24282df
Showing 1 changed file with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.junit.Test;

import java.io.IOException;
import java.util.Optional;

import static org.apache.flink.util.ExceptionUtils.findThrowable;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -119,10 +118,14 @@ public ConsumesTooMuchSpanning map(Long value) throws Exception {

env.execute();
} catch (JobExecutionException e) {
Optional<Throwable> rootCause =
findThrowable(e, t -> t.getMessage().contains("broken serialization"));
assertTrue(rootCause.isPresent());
assertTrue(rootCause.get().getMessage().contains("broken serialization"));
assertTrue(
findThrowable(
e,
candidate ->
candidate
.getMessage()
.contains("broken serialization."))
.isPresent());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
Expand All @@ -148,9 +151,14 @@ public ConsumesTooLittle map(Long value) throws Exception {

env.execute();
} catch (JobExecutionException e) {
Optional<IOException> rootCause = findThrowable(e, IOException.class);
assertTrue(rootCause.isPresent());
assertTrue(rootCause.get().getMessage().contains("broken serialization"));
assertTrue(
findThrowable(
e,
candidate ->
candidate
.getMessage()
.contains("broken serialization."))
.isPresent());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
Expand All @@ -176,9 +184,14 @@ public ConsumesTooLittleSpanning map(Long value) throws Exception {

env.execute();
} catch (ProgramInvocationException e) {
Throwable rootCause = e.getCause().getCause();
assertTrue(rootCause instanceof IOException);
assertTrue(rootCause.getMessage().contains("broken serialization"));
assertTrue(
findThrowable(
e,
candidate ->
candidate
.getMessage()
.contains("broken serialization."))
.isPresent());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
Expand Down

0 comments on commit 24282df

Please sign in to comment.