Skip to content

Conversation

@Md-Arif-Hasan
Copy link

Description

This pull request adds documentation for the flaky test DeliveryDetailsTest.testSerDeser in the zerocode project to the IDoFT dataset.

Details of the Flaky Test


What I Updated

  1. pr-data.csv:

    • Added a new entry documenting the flaky test.
    • Included the following details:
      • Good Commit: 16ccfca72
      • Detected Commit: cf84ccd70e6f70a2cfbac4e9242db911ba841859
      • Bad Commit: 6ef5f20eaff6a8bad3713b4aee6a482cdbd6e256
    • Example entry:
      https://github.com/authorjapps/zerocode,cf84ccd70e6f70a2cfbac4e9242db911ba841859,core/org.jsmart.zerocode.core.kafka,org.jsmart.zerocode.core.kafka.DeliveryDetailsTest.testSerDeser,ID,Open,,GOOD_COMMIT=16ccfca72;DETECTED_COMMIT=cf84ccd70e6f70a2cfbac4e9242db911ba841859;BAD_COMMIT=6ef5f20eaff6a8bad3713b4aee6a482cdbd6e256
      
  2. issue.md:

    • Added a detailed issue description for the flaky test with:
      • Steps to reproduce the flakiness.
      • Logs and configuration details from NonDex.
      • A proposed fix for resolving the flakiness.

How I Detected the First Flaky Commit

To identify the exact commit where the test first became flaky, I used the git bisect command along with a custom script to automate the process.

Steps Taken

  1. Set up git bisect:

    • Marked the bad commit (where the test was detected as flaky by IDoFT):
      git bisect bad 6ef5f20eaff6a8bad3713b4aee6a482cdbd6e256
    • Marked the good commit (where the test was stable and introduced):
      git bisect good 16ccfca72
  2. Automated the Bisect Process:

    • Created a script to run the flaky test with NonDex and determine if the test is flaky for each commit.
    • Script (test_flakiness.sh):
      #!/bin/bash
      
      # Step 1: Clean and compile the project
      mvn clean install -DskipTests
      if [ $? -ne 0 ]; then
          echo "Compilation failed"
          exit 125  # Exit code 125 tells git bisect to skip this commit
      fi
      
      # Step 2: Run the test with NonDex
      mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
          -pl core \
          -Dtest=org.jsmart.zerocode.core.kafka.DeliveryDetailsTest#testSerDeser
      
      # Step 3: Check the test result
      if [ $? -eq 0 ]; then
          echo "Test passed"
          exit 0  # Mark the commit as good
      else
          echo "Test failed"
          exit 1  # Mark the commit as bad
      fi
  3. Ran the Bisect Process:

    • Made the script executable:
      chmod +x test_flakiness.sh
    • Ran the bisect process with the script:
      git bisect run ./test_flakiness.sh

Result

  • The first flaky commit was identified as cf84ccd70e6f70a2cfbac4e9242db911ba841859.

Steps to Reproduce the Flakiness

  1. Clone the repository:
    git clone https://github.com/authorjapps/zerocode.git
    cd zerocode
  2. Checkout the flaky commit:
    git checkout cf84ccd70e6f70a2cfbac4e9242db911ba841859
  3. Build the project:
    mvn clean install -DskipTests
  4. Run the test with NonDex:
    mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
        -pl core \
        -Dtest=org.jsmart.zerocode.core.kafka.DeliveryDetailsTest#testSerDeser

Proposed Fix

To resolve the flakiness of DeliveryDetailsTest.testSerDeser, the following changes are recommended:

  1. Use JSONAssert with LENIENT mode to validate JSON strings without relying on field order.
    JSONAssert.assertEquals("{\"status\":\"Ok\",\"message\":\"test message\",\"recordCount\":10}", json, JSONCompareMode.LENIENT);
  2. Configure Gson for deterministic serialization by ensuring a consistent field order:
    Gson gson = new GsonBuilder().serializeNulls().create();

Let me know if more details are needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant