Skip to content

Commit dbab955

Browse files
committed
Enable test retry for daily builds
1 parent ab09fce commit dbab955

File tree

8 files changed

+359
-9
lines changed

8 files changed

+359
-9
lines changed

.github/repository-settings.md

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ for [`dependabot/**/**`](https://github.com/open-telemetry/community/blob/main/d
7575
- Key is associated with [@trask](https://github.com/trask)'s gmail address
7676
- `SONATYPE_KEY` - owned by [@trask](https://github.com/trask)
7777
- `SONATYPE_USER` - owned by [@trask](https://github.com/trask)
78+
- `FLAKY_TEST_REPORTER_ACCESS_KEY` - owned by [@laurit](https://github.com/laurit)
7879

7980
### Organization secrets
8081

.github/workflows/build-common.yml

+16
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,22 @@ jobs:
290290
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}
291291
run: cat build-scan.txt
292292

293+
- name: Get current job url
294+
uses: Tiryoh/gha-jobid-action@be260d8673c9211a84cdcf37794ebd654ba81eef # v1.4.0
295+
id: jobs
296+
with:
297+
job_name: "test${{ matrix.test-partition }} (${{ matrix.test-java-version }}, ${{ matrix.vm }})"
298+
per_page: 50 # input matrix size here if it is larger than 30
299+
300+
- name: Flaky test report
301+
if: ${{ !cancelled() }}
302+
env:
303+
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}
304+
JOB_URL: ${{ steps.jobs.outputs.html_url }}
305+
run: |
306+
BUILD_SCAN_URL=$(cat build-scan.txt)
307+
./gradlew :test-report:reportFlakyTests
308+
293309
- name: Upload deadlock detector artifacts if any
294310
if: failure()
295311
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0

.github/workflows/build-daily-no-build-cache.yml

-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,16 @@ jobs:
1010
common:
1111
uses: ./.github/workflows/build-common.yml
1212
with:
13-
max-test-retries: 0
1413
no-build-cache: true
1514

1615
test-latest-deps:
1716
uses: ./.github/workflows/reusable-test-latest-deps.yml
1817
with:
19-
max-test-retries: 0
2018
no-build-cache: true
2119

2220
test-indy:
2321
uses: ./.github/workflows/reusable-test-indy.yml
2422
with:
25-
max-test-retries: 0
2623
no-build-cache: true
2724

2825
# muzzle is not included here because it doesn't use gradle cache anyway and so is already covered

.github/workflows/build-daily.yml

-6
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,12 @@ on:
99
jobs:
1010
common:
1111
uses: ./.github/workflows/build-common.yml
12-
with:
13-
max-test-retries: 0
1412

1513
test-latest-deps:
1614
uses: ./.github/workflows/reusable-test-latest-deps.yml
17-
with:
18-
max-test-retries: 0
1915

2016
test-indy:
2117
uses: ./.github/workflows/reusable-test-indy.yml
22-
with:
23-
max-test-retries: 0
2418

2519
muzzle:
2620
uses: ./.github/workflows/reusable-muzzle.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.instrumentation.ratpack.v1_7;
7+
8+
import static org.assertj.core.api.Assertions.assertThat;
9+
10+
import java.util.Random;
11+
import org.junit.jupiter.api.Test;
12+
13+
class FlakyTest {
14+
15+
@Test
16+
void flakyTest1() {
17+
assertThat(new Random().nextInt(10)).isLessThan(3);
18+
}
19+
20+
@Test
21+
void flakyTest2() {
22+
assertThat(new Random().nextInt(10)).isLessThan(3);
23+
}
24+
25+
@Test
26+
void flakyTest3() {
27+
assertThat(new Random().nextInt(10)).isLessThan(3);
28+
}
29+
}

settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ include(":instrumentation-annotations-support-testing")
9797

9898
// misc
9999
include(":dependencyManagement")
100+
include(":test-report")
100101
include(":testing:agent-exporter")
101102
include(":testing:agent-for-testing")
102103
include(":testing:armeria-shaded-for-testing")

test-report/build.gradle.kts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
plugins {
2+
id("otel.java-conventions")
3+
}
4+
5+
dependencies {
6+
implementation("com.google.api-client:google-api-client:2.7.1")
7+
implementation("com.google.apis:google-api-services-sheets:v4-rev20250106-2.0.0")
8+
implementation("com.google.auth:google-auth-library-oauth2-http:1.30.1")
9+
}
10+
11+
otelJava {
12+
minJavaVersionSupported.set(JavaVersion.VERSION_17)
13+
}
14+
15+
tasks {
16+
val reportFlakyTests by registering(JavaExec::class) {
17+
dependsOn(classes)
18+
19+
mainClass.set("io.opentelemetry.instrumentation.testreport.FlakyTestReporter")
20+
classpath(sourceSets["main"].runtimeClasspath)
21+
22+
systemProperty("scanPath", project.rootDir)
23+
systemProperty("googleSheetsAccessKey", System.getenv("FLAKY_TEST_REPORTER_ACCESS_KEY"))
24+
systemProperty("buildScanUrl", System.getenv("BUILD_SCAN_URL"))
25+
systemProperty("jobUrl", System.getenv("JOB_URL"))
26+
}
27+
}

0 commit comments

Comments
 (0)