Skip to content

Commit 2f24ec5

Browse files
authored
skip getLogsOffset tests in 3.9 (#436)
1 parent ff9aa6c commit 2f24ec5

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

src/test/java/com/arangodb/ArangoDBTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ void getLogsSize(ArangoDB arangoDB) {
456456
@ParameterizedTest(name = "{index}")
457457
@MethodSource("arangos")
458458
void getLogsOffset(ArangoDB arangoDB) {
459-
assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362)
459+
assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362)
460+
assumeTrue(isLessThanVersion(3, 9)); // deprecated
460461
final LogEntity logs = arangoDB.getLogs(null);
461462
assertThat(logs.getTotalAmount()).isPositive();
462463
final LogEntity logsOffset = arangoDB.getLogs(new LogOptions().offset(1));

src/test/java/com/arangodb/BaseJunit5.java

+8
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ boolean isAtLeastVersion(final int major, final int minor, final int patch) {
101101
return TestUtils.isAtLeastVersion(adbs.get(0).getVersion().getVersion(), major, minor, patch);
102102
}
103103

104+
boolean isLessThanVersion(final int major, final int minor) {
105+
return isLessThanVersion(major, minor, 0);
106+
}
107+
108+
boolean isLessThanVersion(final int major, final int minor, final int patch) {
109+
return TestUtils.isLessThanVersion(adbs.get(0).getVersion().getVersion(), major, minor, patch);
110+
}
111+
104112
boolean isStorageEngine(ArangoDBEngine.StorageEngineName name) {
105113
return name.equals(adbs.get(0).getEngine().getName());
106114
}

src/test/java/com/arangodb/async/ArangoDBTest.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ private boolean isAtLeastVersion(final int major, final int minor) {
7171
return com.arangodb.util.TestUtils.isAtLeastVersion(arangoDBSync.getVersion().getVersion(), major, minor, 0);
7272
}
7373

74+
private boolean isLessThanVersion(final int major, final int minor) {
75+
return com.arangodb.util.TestUtils.isLessThanVersion(arangoDBSync.getVersion().getVersion(), major, minor, 0);
76+
}
77+
7478
private boolean supportsExtendedNames() {
7579
final ArangoDB arangoDB = new ArangoDB.Builder().serializer(new ArangoJack()).build();
7680
if (extendedNames == null) {
@@ -525,7 +529,8 @@ void getLogsSize() throws InterruptedException, ExecutionException {
525529

526530
@Test
527531
void getLogsOffset() throws InterruptedException, ExecutionException {
528-
assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362)
532+
assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362)
533+
assumeTrue(isLessThanVersion(3, 9)); // deprecated
529534
final LogEntity logs = arangoDB.getLogs(null).get();
530535
assertThat(logs.getTotalAmount()).isPositive();
531536
arangoDB.getLogs(new LogOptions().offset((int) (logs.getTotalAmount() - 1)))

src/test/java/com/arangodb/util/TestUtils.java

+17-14
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@ private TestUtils() {
4242
* Parses {@param version} and checks whether it is greater or equal to
4343
* <{@param otherMajor}, {@param otherMinor}, {@param otherPatch}>
4444
* comparing the corresponding version components in lexicographical order.
45-
*
46-
* @param version
47-
* @param otherMajor
48-
* @param otherMinor
49-
* @param otherPatch
5045
*/
5146
public static boolean isAtLeastVersion(final String version, final int otherMajor, final int otherMinor, final int otherPatch) {
47+
return compareVersion(version, otherMajor, otherMinor, otherPatch) >= 0;
48+
}
49+
50+
/**
51+
* Parses {@param version} and checks whether it is less than
52+
* <{@param otherMajor}, {@param otherMinor}, {@param otherPatch}>
53+
* comparing the corresponding version components in lexicographical order.
54+
*/
55+
public static boolean isLessThanVersion(final String version, final int otherMajor, final int otherMinor, final int otherPatch) {
56+
return compareVersion(version, otherMajor, otherMinor, otherPatch) < 0;
57+
}
58+
59+
private static int compareVersion(final String version, final int otherMajor, final int otherMinor, final int otherPatch) {
5260
String[] parts = version.split("-")[0].split("\\.");
5361

5462
int major = Integer.parseInt(parts[0]);
@@ -57,20 +65,15 @@ public static boolean isAtLeastVersion(final String version, final int otherMajo
5765

5866
int majorComparison = Integer.compare(major, otherMajor);
5967
if (majorComparison != 0) {
60-
return majorComparison > 0;
68+
return majorComparison;
6169
}
6270

6371
int minorComparison = Integer.compare(minor, otherMinor);
6472
if (minorComparison != 0) {
65-
return minorComparison > 0;
66-
}
67-
68-
int patchComparison = Integer.compare(patch, otherPatch);
69-
if (patchComparison != 0) {
70-
return patchComparison > 0;
73+
return minorComparison;
7174
}
7275

73-
return true;
76+
return Integer.compare(patch, otherPatch);
7477
}
7578

7679
private static String[] generateAllInputChars() {
@@ -90,7 +93,7 @@ private static String[] generateAllInputChars() {
9093
}
9194

9295
public static String generateRandomDbName(int length, boolean extendedNames) {
93-
if(extendedNames){
96+
if (extendedNames) {
9497
int max = allChars.length;
9598
StringBuilder sb = new StringBuilder();
9699
for (int i = 0; i < length; i++) {

0 commit comments

Comments
 (0)