@@ -130,17 +130,18 @@ jobs:
130130 matrix :
131131 test-java-version :
132132 - 8
133- - 11
134- - 17
135- - 21
136- - 23
137133 vm :
138134 - hotspot
139135 # TODO (trask) enable once profiler supports OpenJ9
140136 # - openj9
141137 os :
142138 - windows-2022
143- - ubuntu-latest
139+ num :
140+ - 1
141+ - 2
142+ - 3
143+ - 4
144+ - 5
144145 fail-fast : false
145146 steps :
146147 - name : Support long paths
@@ -172,101 +173,23 @@ jobs:
172173
173174 - name : Test
174175 # spotless is checked separately since it's a common source of failure
175- run : >
176- ./gradlew
177- check
178- -x spotlessCheck
179- -PtestJavaVersion=${{ matrix.test-java-version }}
180- -PtestJavaVM=${{ matrix.vm }}
181- "-Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }}"
182- "-Porg.gradle.java.installations.auto-download=false"
183- ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
184-
185- setup-smoke-test-matrix :
186- runs-on : ubuntu-latest
187- outputs :
188- matrix : ${{ steps.set-matrix.outputs.matrix }}
189- steps :
190- - uses : actions/checkout@v4
191-
192- - id : set-matrix
193- run : |
194- json_array=$(
195- for dir in smoke-tests/apps/*; do
196- # Convert directory path to module name (e.g., "smoke-tests/apps/MyApp" -> "smoke-tests:apps:MyApp")
197- module=$(echo "$dir" | sed 's|/|:|g')
198- # Extract just the app name from the module path (e.g., "smoke-tests:apps:MyApp" -> "MyApp")
199- module_short=$(echo "$module" | sed 's|.*:||')
200-
201- find "${dir}/src/smokeTest/java" -name "*Test.java" | \
202- # Remove the base path to get relative path from smokeTest/java
203- sed "s|${dir}/src/smokeTest/java/||" | \
204- # Convert file name to class name (e.g., "com/example/MyTest.java" -> "com.example.MyTest")
205- sed 's|/|.|g' | sed 's|\.java$||' | \
206- # Process each fully qualified test class name
207- while read -r class_name; do
208- # Extract just the simple class name (e.g., "com.example.MyTest" -> "MyTest")
209- class_short=$(echo "$class_name" | sed 's/.*\.//')
210- echo "{\"display\":\"${module_short}:${class_short}\"," \
211- "\"module\":\"${module}\"," \
212- "\"test_class\":\"${class_name}\"}"
213- done
214- # Join all JSON objects with commas and remove trailing comma
215- done | tr '\n' ',' | sed 's/,$//'
216- )
217-
218- # Output the matrix in GitHub Actions format
219- echo "matrix={\"include\":[$json_array]}" >> $GITHUB_OUTPUT
220-
221- smoke-test :
222- name : ${{ matrix.display }}
223- needs : setup-smoke-test-matrix
224- runs-on : ubuntu-latest
225- strategy :
226- matrix : ${{fromJson(needs.setup-smoke-test-matrix.outputs.matrix)}}
227- fail-fast : false
228- steps :
229- - uses : actions/checkout@v4
230-
231- - name : Set up Java 17
232- uses : actions/setup-java@v4
233- with :
234- distribution : temurin
235- java-version : 17
236-
237- - name : Build and install local azure-monitor-opentelemetry-autoconfigure dependency
238- if : env.AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE_SNAPSHOT != ''
239- run : ./.github/scripts/build-azure-monitor-dependency.sh
240-
241- - name : Setup Gradle
242- uses : gradle/actions/setup-gradle@v4
243-
244- - name : Test
245- run : ./gradlew ${{ matrix.module }}:smokeTest --tests "${{ matrix.test_class }}*"
246-
247- - name : Create unique artifact name
248- if : failure()
249- run : |
250- # Create a unique name based on module and test class
251- artifact_name="${{ matrix.module }}:${{ matrix.test_class }}"
252- # Replace colons and dots with hyphens for valid artifact names
253- artifact_name=$(echo "$artifact_name" | sed 's/[:.]/\-/g')
254- echo "UPLOAD_ARTIFACT_NAME=$artifact_name" >> $GITHUB_ENV
255-
256- - name : Upload smoke test reports
257- uses : actions/upload-artifact@v4
258- if : failure()
259- with :
260- name : ${{ env.UPLOAD_ARTIFACT_NAME }}
261- path : ' **/build/reports/tests/smokeTest/**/*'
262-
263- check-snapshot-dependency :
264- runs-on : ubuntu-latest
265- steps :
266- - name : Check for snapshot dependency
176+ # running in a loop 1..50 to identify flaky test behavior
177+ shell : bash
267178 run : |
268- if [[ -n "$AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE_SNAPSHOT" ]]; then
269- echo "AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE_SNAPSHOT is set to '$AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE_SNAPSHOT'"
270- echo "PRs testing against a snapshot cannot be merged."
271- exit 1
272- fi
179+ for i in {1..100}; do
180+ echo "=== Test run $i/50 ==="
181+ ./gradlew \
182+ :agent:instrumentation:micrometer-1.0:test \
183+ --rerun-tasks \
184+ -PtestJavaVersion=${{ matrix.test-java-version }} \
185+ -PtestJavaVM=${{ matrix.vm }} \
186+ "-Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }}" \
187+ "-Porg.gradle.java.installations.auto-download=false"
188+ if [ $? -eq 0 ]; then
189+ echo "Test run $i completed successfully"
190+ else
191+ echo "Test run $i failed"
192+ exit 1
193+ fi
194+ done
195+ echo "All 50 test runs completed successfully"
0 commit comments