Skip to content

Commit 4257a78

Browse files
committed
Support null cluster file
This is ok, it will get it from the environment variable if it is null, but we can't set the environment variable to null.
1 parent cadc509 commit 4257a78

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ public class YamlTestExtension implements TestTemplateInvocationContextProvider,
6464
private List<YamlTestConfig> testConfigs;
6565
private List<YamlTestConfig> maintainConfigs;
6666
private List<ExternalServer> servers;
67+
@Nullable
6768
private final String clusterFile;
6869

6970
public YamlTestExtension() {
70-
this.clusterFile = System.getenv("FDB_CLUSTER_FILE");
71+
this.clusterFile = null; // it will get it from the environment
7172
}
7273

73-
public YamlTestExtension(final String clusterFile) {
74+
public YamlTestExtension(@Nullable final String clusterFile) {
7475
this.clusterFile = clusterFile;
7576
}
7677

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.logging.log4j.Logger;
2626
import org.junit.jupiter.api.Assertions;
2727

28+
import javax.annotation.Nullable;
2829
import java.io.File;
2930
import java.io.IOException;
3031
import java.util.Arrays;
@@ -43,19 +44,22 @@ public class ExternalServer {
4344
public static final String EXTERNAL_SERVER_PROPERTY_NAME = "yaml_testing_external_server";
4445
private static final boolean SAVE_SERVER_OUTPUT = false;
4546

47+
@Nullable
4648
private final File serverJar;
4749
private final int grpcPort;
4850
private final int httpPort;
4951
private SemanticVersion version;
5052
private Process serverProcess;
51-
private String clusterFile;
53+
@Nullable
54+
private final String clusterFile;
5255

5356
/**
5457
* Create a new instance that will run a specific jar.
5558
*
5659
* @param serverJar the path to the jar to run
5760
*/
58-
public ExternalServer(File serverJar, final int grpcPort, final int httpPort, final String clusterFile) {
61+
public ExternalServer(@Nullable File serverJar, final int grpcPort, final int httpPort,
62+
@Nullable final String clusterFile) {
5963
this.serverJar = serverJar;
6064
this.grpcPort = grpcPort;
6165
this.httpPort = httpPort;
@@ -123,7 +127,9 @@ public void start() throws Exception {
123127
ProcessBuilder.Redirect.DISCARD;
124128
processBuilder.redirectOutput(out);
125129
processBuilder.redirectError(err);
126-
processBuilder.environment().put("FDB_CLUSTER_FILE", clusterFile);
130+
if (clusterFile != null) {
131+
processBuilder.environment().put("FDB_CLUSTER_FILE", clusterFile);
132+
}
127133

128134
if (!startServer(processBuilder)) {
129135
Assertions.fail("Failed to start the external server");

0 commit comments

Comments
 (0)