Define the API version separately for the Java tests that are not executed as a part of the CI

This commit is contained in:
Vaidas Gasiunas 2023-02-27 18:20:11 +01:00
parent 8ddda99036
commit 83f76b60b9
16 changed files with 48 additions and 29 deletions

View File

@ -114,6 +114,7 @@ set(JAVA_TESTS_SRCS
src/test/com/apple/foundationdb/test/StackOperation.java
src/test/com/apple/foundationdb/test/StackTester.java
src/test/com/apple/foundationdb/test/StackUtils.java
src/test/com/apple/foundationdb/test/TestApiVersion.java
src/test/com/apple/foundationdb/test/TesterArgs.java
src/test/com/apple/foundationdb/test/TestResult.java
src/test/com/apple/foundationdb/test/TuplePerformanceTest.java

View File

@ -23,7 +23,6 @@ package com.apple.foundationdb.test;
import java.nio.charset.Charset;
import java.util.Random;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
@ -79,7 +78,7 @@ public abstract class AbstractTester {
args = TesterArgs.parseArgs(argStrings);
if (args == null) return;
fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
// Validate argument combinations and set options.
if (!args.useMultiversionApi()) {

View File

@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.Transaction;
@ -34,7 +33,7 @@ public class BlockingBenchmark {
private static final int PARALLEL = 100;
public static void main(String[] args) throws InterruptedException {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
// The cluster file DOES NOT need to be valid, although it must exist.
// This is because the database is never really contacted in this test.

View File

@ -26,7 +26,6 @@ import java.util.Random;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
@ -49,7 +48,7 @@ public class ConcurrentGetSetGet {
}
public static void main(String[] args) {
try(Database database = FDB.selectAPIVersion(ApiVersion.LATEST).open()) {
try(Database database = FDB.selectAPIVersion(TestApiVersion.CURRENT).open()) {
new ConcurrentGetSetGet().apply(database);
}
}

View File

@ -22,7 +22,6 @@ package com.apple.foundationdb.test;
import java.util.concurrent.atomic.AtomicInteger;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.KeyValue;
@ -33,7 +32,7 @@ public class IterableTest {
public static void main(String[] args) throws InterruptedException {
final int reps = 1000;
try {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database db = fdb.open()) {
runTests(reps, db);
}

View File

@ -23,7 +23,6 @@ package com.apple.foundationdb.test;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.LocalityUtil;
@ -35,7 +34,7 @@ import com.apple.foundationdb.tuple.ByteArrayUtil;
public class LocalityTests {
public static void main(String[] args) {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database database = fdb.open(args[0])) {
try(Transaction tr = database.createTransaction()) {
String[] keyAddresses = LocalityUtil.getAddressesForKey(tr, "a".getBytes()).join();

View File

@ -26,7 +26,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.KeyValue;
@ -44,7 +43,7 @@ public class ParallelRandomScan {
private static final int PARALLELISM_STEP = 5;
public static void main(String[] args) throws InterruptedException {
FDB api = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB api = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database database = api.open(args[0])) {
for(int i = PARALLELISM_MIN; i <= PARALLELISM_MAX; i += PARALLELISM_STEP) {
runTest(database, i, ROWS, DURATION_MS);

View File

@ -24,7 +24,6 @@ import java.util.List;
import java.util.concurrent.CompletionException;
import java.util.function.Function;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.FDBException;
@ -37,8 +36,8 @@ import com.apple.foundationdb.async.AsyncIterable;
public class RangeTest {
public static void main(String[] args) {
System.out.println("About to use version " + ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
System.out.println("About to use version " + TestApiVersion.CURRENT);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database db = fdb.open()) {
try {

View File

@ -24,7 +24,6 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.Transaction;
@ -35,7 +34,7 @@ public class SerialInsertion {
private static final int NODES = 1000000;
public static void main(String[] args) {
FDB api = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB api = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database database = api.open()) {
long start = System.currentTimeMillis();

View File

@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.KeyValue;
@ -40,7 +39,7 @@ public class SerialIteration {
private static final int THREAD_COUNT = 1;
public static void main(String[] args) throws InterruptedException {
FDB api = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB api = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database database = api.open(args[0])) {
for(int i = 1; i <= THREAD_COUNT; i++) {
runThreadedTest(database, i);

View File

@ -22,7 +22,6 @@ package com.apple.foundationdb.test;
import java.util.concurrent.atomic.AtomicInteger;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.TransactionContext;
@ -32,7 +31,7 @@ public class SerialTest {
public static void main(String[] args) throws InterruptedException {
final int reps = 1000;
try {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database db = fdb.open()) {
runTests(reps, db);
}

View File

@ -23,7 +23,6 @@ package com.apple.foundationdb.test;
import java.util.UUID;
import java.util.concurrent.CompletionException;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.FDBException;
@ -40,7 +39,7 @@ public class SnapshotTransactionTest {
private static final Subspace SUBSPACE = new Subspace(Tuple.from("test", "conflict_ranges"));
public static void main(String[] args) {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database db = fdb.open()) {
snapshotReadShouldNotConflict(db);
snapshotShouldNotAddConflictRange(db);

View File

@ -0,0 +1,32 @@
/*
* TestApiVersion.java
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2023 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.apple.foundationdb.test;
/**
* Declares the last tested API version of standalone Java tests & benchmarks
* that are not running as a part of CI. The tests should be retested
* manually after updating the API version
*/
public class TestApiVersion {
/**
* The latest API version supported by the Java binding
*/
public static final int CURRENT = 720;
}

View File

@ -24,7 +24,6 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.TransactionContext;
@ -38,7 +37,7 @@ public class TupleTest {
public static void main(String[] args) throws NoSuchFieldException {
final int reps = 1000;
try {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database db = fdb.open()) {
runTests(reps, db);
}

View File

@ -22,7 +22,6 @@ package com.apple.foundationdb.test;
import java.util.concurrent.CompletableFuture;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.MutationType;
@ -34,7 +33,7 @@ import com.apple.foundationdb.tuple.Versionstamp;
public class VersionstampSmokeTest {
public static void main(String[] args) {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database db = fdb.open()) {
db.run(tr -> {
tr.clear(Tuple.from("prefix").range());

View File

@ -26,7 +26,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import com.apple.foundationdb.ApiVersion;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.FDBException;
@ -35,7 +34,7 @@ import com.apple.foundationdb.Transaction;
public class WatchTest {
public static void main(String[] args) {
FDB fdb = FDB.selectAPIVersion(ApiVersion.LATEST);
FDB fdb = FDB.selectAPIVersion(TestApiVersion.CURRENT);
try(Database database = fdb.open(args[0])) {
database.options().setLocationCacheSize(42);
try(Transaction tr = database.createTransaction()) {