|
| 1 | +name: Debug Flaky Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ main ] |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + debug-flaky-tests: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + java: [ 17, 21 ] |
| 16 | + iteration: [ 1, 2, 3, 4, 5 ] |
| 17 | + fail-fast: false |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up JDK ${{ matrix.java }} |
| 23 | + uses: actions/setup-java@v4 |
| 24 | + with: |
| 25 | + java-version: ${{ matrix.java }} |
| 26 | + distribution: 'temurin' |
| 27 | + |
| 28 | + - name: Setup Gradle |
| 29 | + uses: gradle/gradle-build-action@v3 |
| 30 | + with: |
| 31 | + gradle-home-cache-cleanup: true |
| 32 | + |
| 33 | + - name: Print system information |
| 34 | + run: | |
| 35 | + echo "Java Version: $(java -version)" |
| 36 | + echo "OS: $(uname -a)" |
| 37 | + echo "CPU Count: $(nproc)" |
| 38 | + echo "Memory: $(free -h)" |
| 39 | + echo "Load Average: $(uptime)" |
| 40 | + echo "Disk Space: $(df -h)" |
| 41 | + echo "Current Time: $(date)" |
| 42 | + echo "Iteration: ${{ matrix.iteration }}" |
| 43 | + |
| 44 | + - name: Run OpAMP client tests (Iteration ${{ matrix.iteration }}) |
| 45 | + run: | |
| 46 | + echo "=== Running OpAMP client tests - Iteration ${{ matrix.iteration }} ===" |
| 47 | + ./gradlew opamp-client:test --rerun-tasks --info --stacktrace -Dorg.gradle.parallel=false |
| 48 | + env: |
| 49 | + JAVA_OPTS: "-Xmx2g -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps" |
| 50 | + |
| 51 | + - name: Upload test results on failure |
| 52 | + if: failure() |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: test-results-java${{ matrix.java }}-iter${{ matrix.iteration }} |
| 56 | + path: | |
| 57 | + opamp-client/build/reports/ |
| 58 | + opamp-client/build/test-results/ |
| 59 | + retention-days: 7 |
| 60 | + |
| 61 | + - name: Print test timing information |
| 62 | + if: always() |
| 63 | + run: | |
| 64 | + echo "=== Test Timing Information ===" |
| 65 | + find opamp-client/build/test-results -name "*.xml" -exec echo "File: {}" \; -exec grep -E "(time=|testcase)" {} \; 2>/dev/null || echo "No test results found" |
| 66 | +
|
| 67 | + # Run additional stress test |
| 68 | + stress-test-multiple-times: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + java: [ 17, 21 ] |
| 73 | + fail-fast: false |
| 74 | + |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v4 |
| 77 | + |
| 78 | + - name: Set up JDK ${{ matrix.java }} |
| 79 | + uses: actions/setup-java@v4 |
| 80 | + with: |
| 81 | + java-version: ${{ matrix.java }} |
| 82 | + distribution: 'temurin' |
| 83 | + |
| 84 | + - name: Setup Gradle |
| 85 | + uses: gradle/gradle-build-action@v3 |
| 86 | + |
| 87 | + - name: Run stress test multiple times in sequence |
| 88 | + run: | |
| 89 | + echo "=== Running stress tests sequentially ===" |
| 90 | + for i in {1..20}; do |
| 91 | + echo "--- Sequential Run $i ---" |
| 92 | + if ! ./gradlew opamp-client:test --tests "*.flakiness_stress_test_all_timing_operations" --rerun-tasks --info; then |
| 93 | + echo "FAILURE: Sequential run $i failed" |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | + echo "SUCCESS: Sequential run $i passed" |
| 97 | + sleep 1 |
| 98 | + done |
| 99 | + echo "All sequential stress tests passed!" |
| 100 | + |
| 101 | + - name: Upload stress test results on failure |
| 102 | + if: failure() |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: stress-test-results-java${{ matrix.java }} |
| 106 | + path: | |
| 107 | + opamp-client/build/reports/ |
| 108 | + opamp-client/build/test-results/ |
| 109 | + retention-days: 7 |
| 110 | + |
| 111 | + # Run tests with different JVM options |
| 112 | + test-different-jvm-options: |
| 113 | + runs-on: ubuntu-latest |
| 114 | + strategy: |
| 115 | + matrix: |
| 116 | + java: [ 17, 21 ] |
| 117 | + jvm-opts: |
| 118 | + - "-Xmx1g -XX:+UseSerialGC" |
| 119 | + - "-Xmx2g -XX:+UseG1GC" |
| 120 | + - "-Xmx1g -XX:+UseParallelGC" |
| 121 | + fail-fast: false |
| 122 | + |
| 123 | + steps: |
| 124 | + - uses: actions/checkout@v4 |
| 125 | + |
| 126 | + - name: Set up JDK ${{ matrix.java }} |
| 127 | + uses: actions/setup-java@v4 |
| 128 | + with: |
| 129 | + java-version: ${{ matrix.java }} |
| 130 | + distribution: 'temurin' |
| 131 | + |
| 132 | + - name: Setup Gradle |
| 133 | + uses: gradle/gradle-build-action@v3 |
| 134 | + |
| 135 | + - name: Run tests with JVM options |
| 136 | + run: | |
| 137 | + echo "=== Running tests with JVM options: ${{ matrix.jvm-opts }} ===" |
| 138 | + ./gradlew opamp-client:test --rerun-tasks --info |
| 139 | + env: |
| 140 | + JAVA_OPTS: "${{ matrix.jvm-opts }}" |
| 141 | + |
| 142 | + - name: Upload JVM test results on failure |
| 143 | + if: failure() |
| 144 | + uses: actions/upload-artifact@v4 |
| 145 | + with: |
| 146 | + name: jvm-test-results-java${{ matrix.java }}-${{ hashFiles(matrix.jvm-opts) }} |
| 147 | + path: | |
| 148 | + opamp-client/build/reports/ |
| 149 | + opamp-client/build/test-results/ |
| 150 | + retention-days: 7 |
0 commit comments