Skip to content

Commit 879c18a

Browse files
authored
Add support for running YAML tests against a server built from local branch (#3161)
In order to increase coverage - specifically, running the current version on multiple JVMs - this change adds the ability to build and run multi-server tests against the current local version. The test run will treat the locally-built server the same as any other downloaded server. That means that 4 test runs will be performed: - embedded then remote (with and without continuation forcing) - remote then embedded (with and without continuation forcing) This effectively adds one more downloaded server to the list. An option was considered (and can be quite easily implemented) to reduce coverage by treating this server differently (and only run a subset of the configs) but given the large number of servers we already plan to download anyway, this didn't seem material.
1 parent 91520c4 commit 879c18a

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,11 @@ public ContextOptions mergeFrom(ContextOptions other) {
521521
public <T> T getOrDefault(ContextOption<T> prop, T defaultValue) {
522522
return (T)map.getOrDefault(prop, defaultValue);
523523
}
524+
525+
@Override
526+
public String toString() {
527+
return map.toString();
528+
}
524529
}
525530

526531
public static class ContextOption<T> {
@@ -546,5 +551,10 @@ public boolean equals(final Object o) {
546551
public int hashCode() {
547552
return Objects.hashCode(name);
548553
}
554+
555+
@Override
556+
public String toString() {
557+
return name;
558+
}
549559
}
550560
}

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,14 @@ public void afterAll(final ExtensionContext context) throws Exception {
121121
return e;
122122
}
123123
}).filter(Objects::nonNull).findFirst();
124-
for (ExternalServer server : servers) {
125-
try {
126-
server.stop();
127-
} catch (Exception ex) {
128-
if (logger.isWarnEnabled()) {
129-
logger.warn("Failed to stop server " + server.getVersion() + " on " + server.getPort());
124+
if (servers != null) {
125+
for (ExternalServer server : servers) {
126+
try {
127+
server.stop();
128+
} catch (Exception ex) {
129+
if (logger.isWarnEnabled()) {
130+
logger.warn("Failed to stop server " + server.getVersion() + " on " + server.getPort());
131+
}
130132
}
131133
}
132134
}

yaml-tests/yaml-tests.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,17 @@ task cleanExternalServerDirectory(type: Delete) {
122122
delete project.layout.buildDirectory.dir('externalServer')
123123
}
124124

125-
task downloadExternalServer(type: Copy) {
126-
dependsOn "cleanExternalServerDirectory"
127-
from resolveOtherServer(new HashSet<String>())
125+
task serverJars(type: Copy) {
126+
dependsOn ":fdb-relational-server:package", "cleanExternalServerDirectory"
128127
into project.layout.buildDirectory.dir('externalServer')
128+
from resolveOtherServer(new HashSet<String>())
129+
from (rootProject.project("fdb-relational-server").layout.files('.dist')) {
130+
include("*-SNAPSHOT-all.jar")
131+
}
129132
}
130133

131134
test {
132-
dependsOn "downloadExternalServer"
135+
dependsOn "serverJars"
133136
systemProperty("yaml_testing_external_server", project.layout.buildDirectory.dir('externalServer').get().asFile)
134137
// These are the system properties that are looked at by the YamlTesting framework to initialize the execution context
135138
var isNightly = System.getenv("COM_APPLE_FOUNDATIONDB_RELATIONAL_YAMLTESTS_NIGHTLY")

0 commit comments

Comments
 (0)