@@ -130,17 +130,18 @@ jobs:
130
130
matrix :
131
131
test-java-version :
132
132
- 8
133
- - 11
134
- - 17
135
- - 21
136
- - 23
137
133
vm :
138
134
- hotspot
139
135
# TODO (trask) enable once profiler supports OpenJ9
140
136
# - openj9
141
137
os :
142
138
- windows-2022
143
- - ubuntu-latest
139
+ num :
140
+ - 1
141
+ - 2
142
+ - 3
143
+ - 4
144
+ - 5
144
145
fail-fast : false
145
146
steps :
146
147
- name : Support long paths
@@ -172,101 +173,24 @@ jobs:
172
173
173
174
- name : Test
174
175
# 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
267
178
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
+ --tests "io.opentelemetry.javaagent.instrumentation.micrometer.v1_0.MicrometerTest" \
184
+ --rerun-tasks \
185
+ -PtestJavaVersion=${{ matrix.test-java-version }} \
186
+ -PtestJavaVM=${{ matrix.vm }} \
187
+ "-Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }}" \
188
+ "-Porg.gradle.java.installations.auto-download=false"
189
+ if [ $? -eq 0 ]; then
190
+ echo "Test run $i completed successfully"
191
+ else
192
+ echo "Test run $i failed"
193
+ exit 1
194
+ fi
195
+ done
196
+ echo "All 50 test runs completed successfully"
0 commit comments