DataflowTemplates icon indicating copy to clipboard operation
DataflowTemplates copied to clipboard

[Bug]: Detect Flaky Test in DeadLetterQueueTest

Open LucaDai opened this issue 2 months ago • 0 comments

Related Template(s)

v2/sourcedb-to-spanner

Template Version

N/A

What happened?

Detected flaky behavior in unit test under NonDex randomization.

Test class: com.google.cloud.teleport.v2.writer.DeadLetterQueueTest Test method: testCreateLogDlq

NonDex detected inconsistent test results caused by nondeterministic JSON key ordering in the DeadLetterQueue payload.

Expected: Stable test results independent of JSON field ordering.

How to Reproduce

Reproduced the failure using NonDex, a tool from the University of Illinois designed to detect ID tests (Iteration-Dependent tests).

Environment

Java: 17.x Maven: 3.9.x Build module

mvn clean install -DskipTests -pl v2/spanner-common -am

Run a single test (no shuffling)

mvn test -pl v2/spanner-common \
  -Dtest=com.google.cloud.teleport.v2.spanner.testutils.failureinjectiontesting.MySQLSrcDataProviderTest \
  -Dmaven.test.redirectTestOutputToFile=false

Run with NonDex (shuffling)

mvn edu.illinois:nondex-maven-plugin:2.2.1:nondex \
  -pl v2/spanner-common \
  -Dtest=com.google.cloud.teleport.v2.spanner.testutils.failureinjectiontesting.MySQLSrcDataProviderTest \
  -DnondexRuns=5

Relevant log output

[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   DeadLetterQueueTest.testCreateLogDlq:153 expected to contain: "timestamp_col":"1970-01-01T00:29:09.630376Z","new_quantity":"42"
but was            : {"_metadata_read_timestamp":12412435345,"_metadata_source_type":"mysql","_metadata_dataflow_timestamp":12412435345,"_metadata_timestamp":12412435345,"new_quantity":"42","_metadata_change_type":"UPDATE-INSERT","timestamp_col":"1970-01-01T00:29:09.630376Z","_metadata_table":"srcTable"}                                                                                                       
[INFO] 
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0
[INFO] 
[ERROR] There are test failures.

LucaDai avatar Oct 23 '25 16:10 LucaDai