Skip to content

Commit c4f19e5

Browse files
authored
Run nightly variations of yaml-tests in nightly workflow (#3202)
The configuration that existed for yaml-tests used a bunch of environment variables that we aren't setting. Change it to use the project properties that we do set. I removed the control for the number of threads, as I felt it would be good to simplify the number of controls. It also always sets and logs the seed used during tests. Since the yaml tests (currently) are very quick, I set the iterations to be 50x the iterations used elsewhere, but we can control it manually. Also, to make it easier to run the nightly workflow, I set it to also have `workflow_dispatch`
1 parent 8a3c17f commit c4f19e5

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

.github/workflows/nightly.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Nightly
33
on:
44
schedule:
55
- cron: "0 7 * * 1-5"
6+
workflow_dispatch:
67

78
jobs:
89
gradle:

yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlExecutionContext.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,7 @@ public Optional<Integer> getNightlyRepetition() {
190190
}
191191

192192
public int getNumThreads() {
193-
var numThreads = 1;
194-
if (System.getProperties().stringPropertyNames().contains(YamlRunner.TEST_MAX_THREADS)) {
195-
numThreads = Integer.parseInt(System.getProperty(YamlRunner.TEST_MAX_THREADS));
196-
Assert.thatUnchecked(numThreads > 0, "Invalid number of threads provided in the YamlExecutionContext");
197-
}
198-
return numThreads;
193+
return Runtime.getRuntime().availableProcessors() / 2;
199194
}
200195

201196
boolean isDirty() {

yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlRunner.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ public final class YamlRunner {
5151

5252
private static final Logger logger = LogManager.getLogger(YamlRunner.class);
5353

54-
static final String TEST_NIGHTLY = "yaml_testing_nightly";
55-
static final String TEST_SEED = "yaml_testing_seed";
56-
static final String TEST_NIGHTLY_REPETITION = "yaml_testing_nightly_repetition";
57-
static final String TEST_MAX_THREADS = "yaml_testing_max_threads";
54+
static final String TEST_NIGHTLY = "tests.nightly";
55+
static final String TEST_SEED = "tests.yaml.seed";
56+
static final String TEST_NIGHTLY_REPETITION = "tests.yaml.iterations";
5857

5958
@Nonnull
6059
private final String resourcePath;

yaml-tests/yaml-tests.gradle

+16-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import java.util.jar.JarFile
2-
import java.util.regex.Matcher
3-
41
/*
52
* yaml-tests.gradle
63
*
@@ -21,6 +18,10 @@ import java.util.regex.Matcher
2118
* limitations under the License.
2219
*/
2320

21+
import java.util.concurrent.ThreadLocalRandom
22+
import java.util.jar.JarFile
23+
import java.util.regex.Matcher
24+
2425
apply from: rootProject.file('gradle/proto.gradle')
2526

2627
project.tasks.named("processResources") {
@@ -185,26 +186,20 @@ mixedModeTest {
185186
test {
186187
dependsOn "serverJars"
187188
systemProperty("yaml_testing_external_server", project.layout.buildDirectory.dir('externalServer').get().asFile)
188-
// These are the system properties that are looked at by the YamlTesting framework to initialize the execution context
189-
var isNightly = System.getenv("COM_APPLE_FOUNDATIONDB_RELATIONAL_YAMLTESTS_NIGHTLY")
190-
if (isNightly != null) {
191-
systemProperty("yaml_testing_nightly", isNightly);
192-
}
193-
var seed = System.getenv("COM_APPLE_FOUNDATIONDB_RELATIONAL_YAMLTESTS_SEED")
194-
if (seed != null) {
195-
systemProperty("yaml_testing_seed", Long.parseLong(seed))
196-
}
197-
var maxThreads = System.getenv("COM_APPLE_FOUNDATIONDB_RELATIONAL_YAMLTESTS_MAX_THREADS")
198-
if (maxThreads != null) {
199-
systemProperty("yaml_testing_max_threads", Integer.parseInt(maxThreads))
189+
def seed
190+
if (project.hasProperty('tests.yaml.seed')) {
191+
seed = Long.parseLong(project.getProperty('tests.yaml.seed'))
200192
} else {
201-
systemProperty("yaml_testing_max_threads", (int) (Runtime.runtime.availableProcessors() / 2))
193+
seed = ThreadLocalRandom.current().nextLong();
202194
}
203-
var nightlyRepetitions = System.getenv("COM_APPLE_FOUNDATIONDB_RELATIONAL_YAMLTESTS_NIGHTLY_REPETITION")
204-
if (nightlyRepetitions != null) {
205-
systemProperty("yaml_testing_nightly_repetition", Integer.parseInt(nightlyRepetitions))
206-
} else {
207-
systemProperty("yaml_testing_nightly_repetition", 100)
195+
println("Using seed for yaml-tests: ${seed}")
196+
systemProperty('tests.yaml.seed', seed)
197+
if (project.hasProperty('tests.yaml.iterations')) {
198+
systemProperties['tests.yaml.iterations'] = project.getProperty('tests.yaml.iterations')
199+
} else if (project.hasProperty('tests.iterations')) {
200+
// The yaml tests are quite fast now, lets put a lot more repetition on the queries, if it gets larger
201+
// we may want to decrease this multiplying factor.
202+
systemProperties['tests.yaml.iterations'] = Integer.parseInt(project.getProperty('tests.iterations')) * 20
208203
}
209204
}
210205

0 commit comments

Comments
 (0)