|
1 | | -import java.time.Duration |
2 | | -import java.time.temporal.ChronoUnit |
| 1 | +// import java.time.Duration |
| 2 | +// import java.time.temporal.ChronoUnit |
3 | 3 |
|
4 | | -def isTestingInstrumentation(Project project) { |
5 | | - return [ |
6 | | - "junit-4.10", |
7 | | - "cucumber", |
8 | | - "cucumber-junit-4", |
9 | | - "junit-4.13", |
10 | | - "munit-junit-4", |
11 | | - "junit-5.3", |
12 | | - "junit-5.8", |
13 | | - "cucumber-junit-5", |
14 | | - "spock-junit-5", |
15 | | - "testng-6", |
16 | | - "testng-7", |
17 | | - "karate", |
18 | | - "scalatest", |
19 | | - "selenium", |
20 | | - "weaver" |
21 | | - ].contains(project.name) |
22 | | -} |
| 4 | +// def isTestingInstrumentation(Project project) { |
| 5 | +// return [ |
| 6 | +// "junit-4.10", |
| 7 | +// "cucumber", |
| 8 | +// "cucumber-junit-4", |
| 9 | +// "junit-4.13", |
| 10 | +// "munit-junit-4", |
| 11 | +// "junit-5.3", |
| 12 | +// "junit-5.8", |
| 13 | +// "cucumber-junit-5", |
| 14 | +// "spock-junit-5", |
| 15 | +// "testng-6", |
| 16 | +// "testng-7", |
| 17 | +// "karate", |
| 18 | +// "scalatest", |
| 19 | +// "selenium", |
| 20 | +// "weaver" |
| 21 | +// ].contains(project.name) |
| 22 | +// } |
23 | 23 |
|
24 | | -def forkedTestLimit = gradle.sharedServices.registerIfAbsent("forkedTestLimit", BuildService) { |
25 | | - maxParallelUsages = 3 |
26 | | -} |
| 24 | +// def forkedTestLimit = gradle.sharedServices.registerIfAbsent("forkedTestLimit", BuildService) { |
| 25 | +// maxParallelUsages = 3 |
| 26 | +// } |
27 | 27 |
|
28 | | -testing { |
29 | | - suites.configureEach { |
30 | | - // Use JUnit 5 to run tests |
31 | | - useJUnitJupiter() |
32 | | - } |
33 | | -} |
| 28 | +// testing { |
| 29 | +// suites.configureEach { |
| 30 | +// // Use JUnit 5 to run tests |
| 31 | +// useJUnitJupiter() |
| 32 | +// } |
| 33 | +// } |
34 | 34 |
|
35 | | -// Go through the Test tasks and configure them |
36 | | -tasks.withType(Test).configureEach { |
37 | | - // Disable all tests if skipTests property was specified |
38 | | - onlyIf { !project.rootProject.hasProperty("skipTests") } |
| 35 | +// // Go through the Test tasks and configure them |
| 36 | +// tasks.withType(Test).configureEach { |
| 37 | +// // Disable all tests if skipTests property was specified |
| 38 | +// onlyIf { !project.rootProject.hasProperty("skipTests") } |
39 | 39 |
|
40 | | - // Enable force rerun of tests with -Prerun.tests.${project.name} |
41 | | - outputs.upToDateWhen { |
42 | | - !project.rootProject.hasProperty("rerun.tests.${project.name}") |
43 | | - } |
| 40 | +// // Enable force rerun of tests with -Prerun.tests.${project.name} |
| 41 | +// outputs.upToDateWhen { |
| 42 | +// !project.rootProject.hasProperty("rerun.tests.${project.name}") |
| 43 | +// } |
44 | 44 |
|
45 | | - // Avoid executing classes used to test testing frameworks instrumentation |
46 | | - if (isTestingInstrumentation(project)) { |
47 | | - exclude("**/TestSucceed*") |
48 | | - exclude("**/TestFailed*") |
49 | | - exclude("**/TestFailedWithSuccessPercentage*") |
50 | | - exclude("**/TestError*") |
51 | | - exclude("**/TestSkipped*") |
52 | | - exclude("**/TestSkippedClass*") |
53 | | - exclude("**/TestInheritance*", "**/BaseTestInheritance*") |
54 | | - exclude("**/TestFactory*") |
55 | | - exclude("**/TestParameterized*") |
56 | | - exclude("**/TestRepeated*") |
57 | | - exclude("**/TestTemplate*") |
58 | | - exclude("**/TestDisableTestTrace*") |
59 | | - exclude("**/TestAssumption*", "**/TestSuiteSetUpAssumption*") |
60 | | - exclude("**/TestUnskippable*") |
61 | | - exclude("**/TestWithSetup*") |
62 | | - } |
| 45 | +// // Avoid executing classes used to test testing frameworks instrumentation |
| 46 | +// if (isTestingInstrumentation(project)) { |
| 47 | +// exclude("**/TestSucceed*") |
| 48 | +// exclude("**/TestFailed*") |
| 49 | +// exclude("**/TestFailedWithSuccessPercentage*") |
| 50 | +// exclude("**/TestError*") |
| 51 | +// exclude("**/TestSkipped*") |
| 52 | +// exclude("**/TestSkippedClass*") |
| 53 | +// exclude("**/TestInheritance*", "**/BaseTestInheritance*") |
| 54 | +// exclude("**/TestFactory*") |
| 55 | +// exclude("**/TestParameterized*") |
| 56 | +// exclude("**/TestRepeated*") |
| 57 | +// exclude("**/TestTemplate*") |
| 58 | +// exclude("**/TestDisableTestTrace*") |
| 59 | +// exclude("**/TestAssumption*", "**/TestSuiteSetUpAssumption*") |
| 60 | +// exclude("**/TestUnskippable*") |
| 61 | +// exclude("**/TestWithSetup*") |
| 62 | +// } |
63 | 63 |
|
64 | | - // Split up tests that want to run forked in their own separate JVM for generated tasks |
65 | | - if (name.startsWith("forkedTest") || name.endsWith("ForkedTest")) { |
66 | | - setExcludes([]) |
67 | | - setIncludes(["**/*ForkedTest*"]) |
68 | | - forkEvery = 1 |
69 | | - // Limit the number of concurrent forked tests |
70 | | - usesService(forkedTestLimit) |
71 | | - onlyIf { !project.rootProject.hasProperty("skipForkedTests") } |
72 | | - } else { |
73 | | - exclude("**/*ForkedTest*") |
74 | | - } |
| 64 | +// // Split up tests that want to run forked in their own separate JVM for generated tasks |
| 65 | +// if (name.startsWith("forkedTest") || name.endsWith("ForkedTest")) { |
| 66 | +// setExcludes([]) |
| 67 | +// setIncludes(["**/*ForkedTest*"]) |
| 68 | +// forkEvery = 1 |
| 69 | +// // Limit the number of concurrent forked tests |
| 70 | +// usesService(forkedTestLimit) |
| 71 | +// onlyIf { !project.rootProject.hasProperty("skipForkedTests") } |
| 72 | +// } else { |
| 73 | +// exclude("**/*ForkedTest*") |
| 74 | +// } |
75 | 75 |
|
76 | | - // Set test timeout for 20 minutes. Default job timeout is 1h (configured on CI level). |
77 | | - timeout = Duration.of(20, ChronoUnit.MINUTES) |
| 76 | +// // Set test timeout for 20 minutes. Default job timeout is 1h (configured on CI level). |
| 77 | +// timeout = Duration.of(20, ChronoUnit.MINUTES) |
78 | 78 |
|
79 | | - check.dependsOn(it) |
80 | | -} |
| 79 | +// check.dependsOn(it) |
| 80 | +// } |
81 | 81 |
|
82 | | -Task allTestsTask = tasks.maybeCreate('allTests') |
83 | | -Task allLatestDepTestsTask = tasks.maybeCreate('allLatestDepTests') |
84 | | -project.afterEvaluate { |
85 | | - tasks.withType(Test).each { |
86 | | - if (it.name.containsIgnoreCase('latest')) { |
87 | | - allLatestDepTestsTask.dependsOn it |
88 | | - } else if (it.name != 'traceAgentTest') { |
89 | | - allTestsTask.dependsOn it |
90 | | - } |
91 | | - } |
92 | | -} |
| 82 | +// Task allTestsTask = tasks.maybeCreate('allTests') |
| 83 | +// Task allLatestDepTestsTask = tasks.maybeCreate('allLatestDepTests') |
| 84 | +// project.afterEvaluate { |
| 85 | +// tasks.withType(Test).each { |
| 86 | +// if (it.name.containsIgnoreCase('latest')) { |
| 87 | +// allLatestDepTestsTask.dependsOn it |
| 88 | +// } else if (it.name != 'traceAgentTest') { |
| 89 | +// allTestsTask.dependsOn it |
| 90 | +// } |
| 91 | +// } |
| 92 | +// } |
93 | 93 |
|
94 | | -// Setup flaky tests jobs. Done in afterEvaluate so that it applies to latestDepTest. |
95 | | -project.afterEvaluate { |
96 | | - tasks.withType(Test).configureEach { |
97 | | - // Flaky tests management for JUnit 5 |
98 | | - testFramework { |
99 | | - if (it instanceof JUnitPlatformOptions) { |
100 | | - if (project.rootProject.hasProperty("skipFlakyTests")) { |
101 | | - excludeTags("flaky") |
102 | | - } else if (project.rootProject.hasProperty("runFlakyTests")) { |
103 | | - includeTags("flaky") |
104 | | - } |
105 | | - } |
106 | | - } |
| 94 | +// // Setup flaky tests jobs. Done in afterEvaluate so that it applies to latestDepTest. |
| 95 | +// project.afterEvaluate { |
| 96 | +// tasks.withType(Test).configureEach { |
| 97 | +// // Flaky tests management for JUnit 5 |
| 98 | +// testFramework { |
| 99 | +// if (it instanceof JUnitPlatformOptions) { |
| 100 | +// if (project.rootProject.hasProperty("skipFlakyTests")) { |
| 101 | +// excludeTags("flaky") |
| 102 | +// } else if (project.rootProject.hasProperty("runFlakyTests")) { |
| 103 | +// includeTags("flaky") |
| 104 | +// } |
| 105 | +// } |
| 106 | +// } |
107 | 107 |
|
108 | | - // Flaky tests management for Spock |
109 | | - if (project.rootProject.hasProperty("skipFlakyTests")) { |
110 | | - jvmArgs += ["-Drun.flaky.tests=false"] |
111 | | - } else if (project.rootProject.hasProperty("runFlakyTests")) { |
112 | | - jvmArgs += ["-Drun.flaky.tests=true"] |
113 | | - } |
114 | | - } |
115 | | -} |
| 108 | +// // Flaky tests management for Spock |
| 109 | +// if (project.rootProject.hasProperty("skipFlakyTests")) { |
| 110 | +// jvmArgs += ["-Drun.flaky.tests=false"] |
| 111 | +// } else if (project.rootProject.hasProperty("runFlakyTests")) { |
| 112 | +// jvmArgs += ["-Drun.flaky.tests=true"] |
| 113 | +// } |
| 114 | +// } |
| 115 | +// } |
116 | 116 |
|
117 | | -if (!project.property("activePartition")) { |
118 | | - project.afterEvaluate { |
119 | | - tasks.withType(Test).configureEach { |
120 | | - enabled = false |
121 | | - } |
122 | | - } |
123 | | -} |
| 117 | +// if (!project.property("activePartition")) { |
| 118 | +// project.afterEvaluate { |
| 119 | +// tasks.withType(Test).configureEach { |
| 120 | +// enabled = false |
| 121 | +// } |
| 122 | +// } |
| 123 | +// } |
124 | 124 |
|
125 | | -tasks.withType(Test).configureEach { |
126 | | - // https://docs.gradle.com/develocity/flaky-test-detection/ |
127 | | - // https://docs.gradle.com/develocity/gradle-plugin/current/#test_retry |
128 | | - develocity.testRetry { |
129 | | - if (providers.environmentVariable("CI").isPresent()) { |
130 | | - maxRetries = 3 |
131 | | - } |
132 | | - } |
133 | | -} |
| 125 | +// tasks.withType(Test).configureEach { |
| 126 | +// // https://docs.gradle.com/develocity/flaky-test-detection/ |
| 127 | +// // https://docs.gradle.com/develocity/gradle-plugin/current/#test_retry |
| 128 | +// develocity.testRetry { |
| 129 | +// if (providers.environmentVariable("CI").isPresent()) { |
| 130 | +// maxRetries = 3 |
| 131 | +// } |
| 132 | +// } |
| 133 | +// } |
0 commit comments