stress-tests.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. name: Run StressTests (for 15 minutes)
  2. on:
  3. schedule:
  4. - cron: '0 0 * * *' # Runs every day at midnight UTC
  5. push:
  6. branches: [ v2_release, v2_develop ]
  7. paths-ignore:
  8. - '**.md'
  9. jobs:
  10. run_stress_tests:
  11. runs-on: ${{ matrix.os }}
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. os: [ ubuntu-latest ]
  16. timeout-minutes: 70 # Allow some buffer time beyond the 1-hour test duration
  17. steps:
  18. - name: Checkout code
  19. uses: actions/checkout@v4
  20. - name: Setup .NET Core
  21. uses: actions/setup-dotnet@v4
  22. with:
  23. dotnet-version: 8.x
  24. dotnet-quality: 'ga'
  25. - name: Install dependencies
  26. run: dotnet restore
  27. - name: Build StressTests
  28. run: dotnet build Tests/StressTests --configuration Debug --no-restore
  29. - name: Run StressTests for 15 minutes
  30. run: |
  31. end=$((SECONDS+900))
  32. while [ $SECONDS -lt $end ]; do
  33. dotnet test Tests/StressTests --no-build --verbosity normal --diag:logs/${{ runner.os }}/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always -- xunit.stopOnFail=true
  34. done
  35. - name: Upload Test Logs
  36. if: always()
  37. uses: actions/upload-artifact@v4
  38. with:
  39. name: stress-test-logs-${{ runner.os }}
  40. path: |
  41. logs/
  42. TestResults/StressTests
  43. parallel_unittests_stress:
  44. name: Parallel Unit Tests Stress (3 iterations)
  45. runs-on: ${{ matrix.os }}
  46. strategy:
  47. fail-fast: false
  48. matrix:
  49. os: [ ubuntu-latest, windows-latest, macos-latest ]
  50. timeout-minutes: 90
  51. steps:
  52. - name: Checkout code
  53. uses: actions/checkout@v4
  54. - name: Setup .NET Core
  55. uses: actions/setup-dotnet@v4
  56. with:
  57. dotnet-version: 8.x
  58. dotnet-quality: 'ga'
  59. - name: Install dependencies
  60. run: dotnet restore
  61. - name: Build UnitTestsParallelizable
  62. run: dotnet build Tests/UnitTestsParallelizable --configuration Debug --no-restore
  63. - name: Disable Windows Defender (Windows only)
  64. if: runner.os == 'Windows'
  65. shell: powershell
  66. run: |
  67. Add-MpPreference -ExclusionPath "${{ github.workspace }}"
  68. Add-MpPreference -ExclusionProcess "dotnet.exe"
  69. Add-MpPreference -ExclusionProcess "testhost.exe"
  70. Add-MpPreference -ExclusionProcess "VSTest.Console.exe"
  71. - name: Set VSTEST_DUMP_PATH
  72. shell: bash
  73. run: echo "VSTEST_DUMP_PATH=logs/UnitTestsParallelizable/${{ runner.os }}/" >> $GITHUB_ENV
  74. - name: Run UnitTestsParallelizable (3 iterations with varying parallelization)
  75. shell: bash
  76. run: |
  77. # Run tests 3 times with different parallelization settings to expose concurrency issues
  78. # Run 1: Default parallelization (2x) - standard test execution
  79. # Run 2: Maximum parallelization (unlimited) - stress test with high concurrency
  80. # Run 3: Single-threaded execution (1) - deterministic execution to expose ordering issues
  81. for RUN in {1..3}; do
  82. echo "============================================"
  83. echo "Starting test run $RUN of 3"
  84. echo "============================================"
  85. # Use a combination of run number and timestamp to create different execution patterns
  86. SEED=$((1000 + $RUN + $(date +%s) % 1000))
  87. echo "Using randomization seed: $SEED"
  88. # Vary the xUnit parallelization based on run number to expose race conditions
  89. if [ $RUN -eq 1 ]; then
  90. XUNIT_MAX_PARALLEL_THREADS="2x"
  91. echo "Run $RUN: Using default parallelization (2x)"
  92. elif [ $RUN -eq 2 ]; then
  93. XUNIT_MAX_PARALLEL_THREADS="unlimited"
  94. echo "Run $RUN: Using maximum parallelization (unlimited)"
  95. else
  96. XUNIT_MAX_PARALLEL_THREADS="1"
  97. echo "Run $RUN: Using single-threaded execution"
  98. fi
  99. dotnet test Tests/UnitTestsParallelizable \
  100. --no-build \
  101. --verbosity normal \
  102. --settings Tests/UnitTestsParallelizable/runsettings.xml \
  103. --diag:logs/UnitTestsParallelizable/${{ runner.os }}/run${RUN}-logs.txt \
  104. --blame \
  105. --blame-crash \
  106. --blame-hang \
  107. --blame-hang-timeout 60s \
  108. --blame-crash-collect-always \
  109. -- xUnit.MaxParallelThreads=${XUNIT_MAX_PARALLEL_THREADS}
  110. if [ $? -ne 0 ]; then
  111. echo "ERROR: Test run $RUN failed!"
  112. exit 1
  113. fi
  114. echo "Test run $RUN completed successfully"
  115. echo ""
  116. done
  117. echo "============================================"
  118. echo "All 3 test runs completed successfully!"
  119. echo "============================================"
  120. - name: Upload UnitTestsParallelizable Logs
  121. if: always()
  122. uses: actions/upload-artifact@v4
  123. with:
  124. name: parallel_unittests_stress-logs-${{ runner.os }}
  125. path: |
  126. logs/UnitTestsParallelizable/
  127. TestResults/