diff --git a/.github/workflows/verify-flaky-test.yml b/.github/workflows/verify-flaky-test.yml new file mode 100644 index 000000000..c1b9dc910 --- /dev/null +++ b/.github/workflows/verify-flaky-test.yml @@ -0,0 +1,60 @@ +name: Verify Flaky Test + +on: + push: + branches: [ verify-flaky-test ] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Build with Maven (Skip Tests) + run: mvn clean install -DskipTests + + - name: Run Test Normally (Expected to Pass) + run: | + echo "Running test without NonDex - should PASS" + mvn test -pl core -Dtest=org.jsmart.zerocode.core.kafka.DeliveryDetailsTest#testSerDeser + echo "Test passed without NonDex as expected" + + - name: Run Test with NonDex (Expected to Fail) + continue-on-error: true + id: nondex-run + run: | + echo "Running test with NonDex - should FAIL" + mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex -pl core -Dtest=org.jsmart.zerocode.core.kafka.DeliveryDetailsTest#testSerDeser + # Store the exit code + echo "nondex_exit_code=$?" >> $GITHUB_OUTPUT + + - name: Display NonDex Results + run: | + echo "Checking NonDex results" + ls -la core/.nondex/ || echo "No .nondex directory found" + for dir in core/.nondex/*/; do + if [ -d "$dir" ]; then + echo "Contents of $dir:" + ls -la "$dir" + if [ -f "$dir/failure" ]; then + echo "Found failure file in $dir:" + cat "$dir/failure" + fi + fi + done + + - name: Verify Test Flakiness + run: | + if [ "${{ steps.nondex-run.outputs.nondex_exit_code }}" != "0" ]; then + echo "✅ Test is flaky: Passes without NonDex but fails with NonDex" + else + echo "❌ Test is not flaky: Passes both with and without NonDex" + exit 1 + fi \ No newline at end of file