Skip to content

[Bug]: Detect Flaky Test in DeadLetterQueueTest #2914

@LucaDai

Description

@LucaDai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions