Make FoundationDB versions available at runtime

This commit is contained in:
Jon Chambers 2025-06-27 11:21:50 -04:00
parent 12b4ceb4aa
commit 7260a9d5b4
5 changed files with 23 additions and 4 deletions

View File

@ -50,6 +50,7 @@
with even-numbered patch versions). Also when updating FoundationDB, make sure to update the version of FoundationDB
used by GitHub Actions. -->
<foundationdb.version>7.3.62</foundationdb.version>
<foundationdb.api-version>730</foundationdb.api-version>
<foundationdb.client-library-sha256>bfed237b787fae3cde1222676e6bfbb0d218fc27bf9e903397a7a7aa96fb2d33</foundationdb.client-library-sha256>
<google-cloud-libraries.version>26.57.0</google-cloud-libraries.version>
<grpc.version>1.70.0</grpc.version> <!-- should be kept in sync with the value from Google libraries-bom -->

View File

@ -761,7 +761,6 @@
<!-- add-opens: work around PATCH not being a supported method on HttpUrlConnection -->
<argLine>-javaagent:${org.mockito:mockito-core:jar} --add-opens=java.base/java.net=ALL-UNNAMED</argLine>
<systemPropertyVariables>
<foundationdb.version>${foundationdb.version}</foundationdb.version>
<localstackImage>${localstack.image}</localstackImage>
</systemPropertyVariables>
</configuration>

View File

@ -0,0 +1,20 @@
/*
* Copyright 2025 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
public class FoundationDbVersion {
private static final String VERSION = "${foundationdb.version}";
private static final int API_VERSION = ${foundationdb.api-version};
public static String getFoundationDbVersion() {
return VERSION;
}
public static int getFoundationDbApiVersion() {
return API_VERSION;
}
}

View File

@ -24,7 +24,7 @@ class FoundationDbExtension implements BeforeAllCallback, ExtensionContext.Store
? new ServiceContainerFoundationDbDatabaseLifecycleManager(serviceContainerName)
: new TestcontainersFoundationDbDatabaseLifecycleManager();
databaseLifecycleManager.initializeDatabase(FDB.selectAPIVersion(730));
databaseLifecycleManager.initializeDatabase(FDB.selectAPIVersion(FoundationDbVersion.getFoundationDbApiVersion()));
context.getRoot().getStore(ExtensionContext.Namespace.GLOBAL).put(getClass().getName(), this);
}

View File

@ -17,8 +17,7 @@ class TestcontainersFoundationDbDatabaseLifecycleManager implements FoundationDb
private FoundationDBContainer foundationDBContainer;
private Database database;
private static final String FOUNDATIONDB_IMAGE_NAME = "foundationdb/foundationdb:" +
System.getProperty("foundationdb.version", "7.3.62");
private static final String FOUNDATIONDB_IMAGE_NAME = "foundationdb/foundationdb:" + FoundationDbVersion.getFoundationDbVersion();
private static final Logger log = LoggerFactory.getLogger(TestcontainersFoundationDbDatabaseLifecycleManager.class);