Skip to content

Commit

Permalink
Enable multi version tests (FoundationDB#3047)
Browse files Browse the repository at this point in the history
Primarily this enables the two classes that run yamsql files against the most recent released version, and the current embedded version. 
* Enable individual tests that require client-server continuations, or can otherwise be enabled now
* Retry starting the server in case it took some time to shut down after the previous test run
  • Loading branch information
ohadzeliger authored Jan 24, 2025
1 parent d5ef631 commit 646a698
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
Expand Down Expand Up @@ -87,7 +86,6 @@ public String getVersion() {

@Override
public void beforeAll(ExtensionContext context) throws Exception {
Assumptions.abort(); // Will be able to re-enable when we have a published external server to use here
File jar;
if (jarName == null) {
final File externalDirectory = new File(Objects.requireNonNull(System.getProperty(EXTERNAL_SERVER_PROPERTY_NAME)));
Expand All @@ -103,11 +101,7 @@ public void beforeAll(ExtensionContext context) throws Exception {
processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);

this.serverProcess = processBuilder.start();

// TODO: There should be a better way to figure out that the server is fully up and running
Thread.sleep(3000);
if (!serverProcess.isAlive()) {
if (!startServer(processBuilder)) {
Assertions.fail("Failed to start the external server");
}

Expand Down Expand Up @@ -135,4 +129,22 @@ public void afterAll(ExtensionContext context) throws Exception {
}
}

private boolean startServer(ProcessBuilder processBuilder) throws IOException, InterruptedException {
try {
serverProcess = processBuilder.start();
// TODO: There should be a better way to figure out that the server is fully up and running
Thread.sleep(3000);
if (!serverProcess.isAlive()) {
throw new Exception("Failed to start server once - retrying");
}
return true;
} catch (Exception ex) {
// Try once more
serverProcess = processBuilder.start();
// TODO: There should be a better way to figure out that the server is fully up and running
Thread.sleep(3000);
}

return serverProcess.isAlive();
}
}
65 changes: 1 addition & 64 deletions yaml-tests/src/test/java/JDBCYamlIntegrationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2021-2024 Apple Inc. and the FoundationDB project authors
* Copyright 2015-2025 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -27,69 +27,6 @@
*/
public abstract class JDBCYamlIntegrationTests extends YamlIntegrationTests {

@Override
@Test
@Disabled("TODO: Flakey")
public void orderBy() throws Exception {
super.orderBy();
}

@Override
@Test
@Disabled("TODO: Flakey")
public void scenarioTests() throws Exception {
super.scenarioTests();
}

@Override
@Test
@Disabled("Requires continuation support")
public void versionsTests() throws Exception {
super.versionsTests();
}

@Override
@Test
@Disabled("TODO: Need to work on supporting labels")
public void maxRows() throws Exception {
super.maxRows();
}

@Override
@Test
@Disabled("TODO")
public void selectAStar() throws Exception {
super.selectAStar();
}

@Override
@Test
@Disabled("TODO: Flakey")
public void aggregateIndexTestsCount() throws Exception {
super.aggregateIndexTestsCount();
}

@Override
@Test
@Disabled("TODO: Flakey")
public void joinTests() throws Exception {
super.joinTests();
}

@Override
@Test
@Disabled("TODO: Flakey")
public void nested() throws Exception {
super.nested();
}

@Override
@Test
@Disabled("TODO: Flakey")
public void showcasingTests() throws Exception {
super.showcasingTests();
}

@Override
@Test
@Disabled("TODO: Not supported")
Expand Down
39 changes: 1 addition & 38 deletions yaml-tests/src/test/java/MultiServerJDBCYamlTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2021-2024 Apple Inc. and the FoundationDB project authors
* Copyright 2015-2025 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@
import com.apple.foundationdb.relational.yamltests.MultiServerConnectionFactory;
import com.apple.foundationdb.relational.yamltests.YamlRunner;
import com.apple.foundationdb.relational.yamltests.server.RunExternalServerExtension;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand Down Expand Up @@ -93,40 +92,4 @@ public Set<String> getVersionsUnderTest() {
}
};
}

@Override
@Disabled("Test asserts about quantifiers")
public void updateDeleteReturning() throws Exception {
super.updateDeleteReturning();
}

@Override
@Disabled("Test asserts about quantifiers")
public void indexedFunctions() throws Exception {
super.indexedFunctions();
}

@Override
@Disabled("Test asserts about quantifiers")
public void bitmap() throws Exception {
super.bitmap();
}

@Override
@Disabled("Test asserts about quantifiers")
public void cte() throws Exception {
super.cte();
}

@Override
@Disabled("Test asserts about quantifiers")
public void unionEmptyTables() throws Exception {
super.unionEmptyTables();
}

@Override
@Disabled("Test asserts about quantifiers")
public void union() throws Exception {
super.union();
}
}

0 comments on commit 646a698

Please sign in to comment.