Add ci mode

This commit is contained in:
Andrea Cavalli 2021-09-10 13:34:26 +02:00
parent 1e8eae20df
commit c467d5f2ba
6 changed files with 32 additions and 18 deletions

View File

@ -44,7 +44,7 @@ jobs:
run: | run: |
echo "REVISION: $REVISION" echo "REVISION: $REVISION"
mvn -B -Drevision=${REVISION} clean deploy mvn -B -Drevision=${REVISION} -Ddbengine.ci=true clean deploy
env: env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}

View File

@ -13,6 +13,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0-SNAPSHOT</revision> <revision>0-SNAPSHOT</revision>
<dbengine.ci>false</dbengine.ci>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
@ -511,6 +512,12 @@
</dependencies> </dependencies>
<configuration> <configuration>
<argLine>--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED</argLine> <argLine>--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED</argLine>
<systemProperties>
<property>
<name>ci</name>
<value>${dbengine.ci}</value>
</property>
</systemProperties>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -69,6 +69,10 @@ public class DbTestUtils {
return activeAllocations; return activeAllocations;
} }
public static boolean isCIMode() {
return System.getProperty("dbengine.ci", "false").equalsIgnoreCase("true");
}
public static <U> Flux<U> tempDb(TemporaryDbGenerator temporaryDbGenerator, public static <U> Flux<U> tempDb(TemporaryDbGenerator temporaryDbGenerator,
TestAllocator alloc, TestAllocator alloc,
Function<LLKeyValueDatabase, Publisher<U>> action) { Function<LLKeyValueDatabase, Publisher<U>> action) {

View File

@ -32,7 +32,7 @@ public abstract class TestDictionaryMap {
private boolean checkLeaks = true; private boolean checkLeaks = true;
private static boolean isTestBadKeysEnabled() { private static boolean isTestBadKeysEnabled() {
return System.getProperty("badkeys", "true").equalsIgnoreCase("true"); return !isCIMode() && System.getProperty("badkeys", "true").equalsIgnoreCase("true");
} }
protected abstract TemporaryDbGenerator getTempDbGenerator(); protected abstract TemporaryDbGenerator getTempDbGenerator();
@ -49,7 +49,7 @@ public abstract class TestDictionaryMap {
goodKeys.stream().map(s -> Tuples.of(s, false)), goodKeys.stream().map(s -> Tuples.of(s, false)),
badKeys.stream().map(s -> Tuples.of(s, true)) badKeys.stream().map(s -> Tuples.of(s, true))
).collect(Collectors.toList()); ).collect(Collectors.toList());
var values = List.of("", "\0", BIG_STRING); var values = isCIMode() ? List.of("val") : List.of("", "\0", BIG_STRING);
return keys return keys
.stream() .stream()
@ -315,7 +315,7 @@ public abstract class TestDictionaryMap {
} }
private static Stream<Arguments> provideArgumentsPutMulti() { private static Stream<Arguments> provideArgumentsPutMulti() {
var goodKeys = List.of(List.of("12345", "67890"), List.<String>of()); var goodKeys = isCIMode() ? List.of(List.of("12345")) : List.of(List.of("12345", "67890"), List.<String>of());
List<List<String>> badKeys; List<List<String>> badKeys;
if (isTestBadKeysEnabled()) { if (isTestBadKeysEnabled()) {
badKeys = List.of(List.of("", "12345"), List.of("45678", "aaaa"), List.of("aaaaaa", "capra")); badKeys = List.of(List.of("", "12345"), List.of("45678", "aaaa"), List.of("aaaaaa", "capra"));
@ -326,7 +326,7 @@ public abstract class TestDictionaryMap {
goodKeys.stream().map(s -> Tuples.of(s, false)), goodKeys.stream().map(s -> Tuples.of(s, false)),
badKeys.stream().map(s -> Tuples.of(s, true)) badKeys.stream().map(s -> Tuples.of(s, true))
).collect(Collectors.toList()); ).collect(Collectors.toList());
var values = List.of("", "\0", BIG_STRING); var values = isCIMode() ? List.of("val") : List.of("", "\0", BIG_STRING);
return keys return keys
.stream() .stream()

View File

@ -2,6 +2,7 @@ package it.cavallium.dbengine;
import static it.cavallium.dbengine.DbTestUtils.BIG_STRING; import static it.cavallium.dbengine.DbTestUtils.BIG_STRING;
import static it.cavallium.dbengine.DbTestUtils.ensureNoLeaks; import static it.cavallium.dbengine.DbTestUtils.ensureNoLeaks;
import static it.cavallium.dbengine.DbTestUtils.isCIMode;
import static it.cavallium.dbengine.DbTestUtils.newAllocator; import static it.cavallium.dbengine.DbTestUtils.newAllocator;
import static it.cavallium.dbengine.DbTestUtils.destroyAllocator; import static it.cavallium.dbengine.DbTestUtils.destroyAllocator;
import static it.cavallium.dbengine.DbTestUtils.tempDatabaseMapDictionaryDeepMap; import static it.cavallium.dbengine.DbTestUtils.tempDatabaseMapDictionaryDeepMap;
@ -45,7 +46,7 @@ public abstract class TestDictionaryMapDeep {
private boolean checkLeaks = true; private boolean checkLeaks = true;
private static boolean isTestBadKeysEnabled() { private static boolean isTestBadKeysEnabled() {
return System.getProperty("badkeys", "true").equalsIgnoreCase("true"); return !isCIMode() && System.getProperty("badkeys", "true").equalsIgnoreCase("true");
} }
protected abstract TemporaryDbGenerator getTempDbGenerator(); protected abstract TemporaryDbGenerator getTempDbGenerator();
@ -87,14 +88,14 @@ public abstract class TestDictionaryMapDeep {
} }
private static Stream<Arguments> provideArgumentsPut() { private static Stream<Arguments> provideArgumentsPut() {
var goodKeys1 = List.of("12345", "zebra"); var goodKeys1 = isCIMode() ? List.of("12345") : List.of("12345", "zebra");
List<String> badKeys1; List<String> badKeys1;
if (isTestBadKeysEnabled()) { if (isTestBadKeysEnabled()) {
badKeys1 = List.of("", "a", "aaaa", "aaaaaa"); badKeys1 = List.of("", "a", "aaaa", "aaaaaa");
} else { } else {
badKeys1 = List.of(); badKeys1 = List.of();
} }
var goodKeys2 = List.of("123456", "anatra"); var goodKeys2 = isCIMode() ? List.of("123456") : List.of("123456", "anatra");
List<String> badKeys2; List<String> badKeys2;
if (isTestBadKeysEnabled()) { if (isTestBadKeysEnabled()) {
badKeys2 = List.of("", "a", "aaaaa", "aaaaaaa"); badKeys2 = List.of("", "a", "aaaaa", "aaaaaaa");
@ -102,7 +103,7 @@ public abstract class TestDictionaryMapDeep {
badKeys2 = List.of(); badKeys2 = List.of();
} }
var values = List.of("a", "", "\0", "\0\0", "z", "azzszgzczqz", BIG_STRING); var values = isCIMode() ? List.of("val") : List.of("a", "", "\0", "\0\0", "z", "azzszgzczqz", BIG_STRING);
Flux<Tuple4<String, String, String, Boolean>> failOnKeys1 = Flux Flux<Tuple4<String, String, String, Boolean>> failOnKeys1 = Flux
.fromIterable(badKeys1) .fromIterable(badKeys1)
@ -679,7 +680,7 @@ public abstract class TestDictionaryMapDeep {
} }
private static Stream<Arguments> provideArgumentsSetMulti() { private static Stream<Arguments> provideArgumentsSetMulti() {
var goodKeys = List.of(List.of("12345", "67890"), List.<String>of()); var goodKeys = isCIMode() ? List.of(List.of("12345")) : List.of(List.of("12345", "67890"), List.<String>of());
List<List<String>> badKeys; List<List<String>> badKeys;
if (isTestBadKeysEnabled()) { if (isTestBadKeysEnabled()) {
badKeys = List.of(List.of("", "12345"), List.of("45678", "aaaa"), List.of("aaaaaa", "capra")); badKeys = List.of(List.of("", "12345"), List.of("45678", "aaaa"), List.of("aaaaaa", "capra"));
@ -690,7 +691,7 @@ public abstract class TestDictionaryMapDeep {
goodKeys.stream().map(s -> Tuples.of(s, false)), goodKeys.stream().map(s -> Tuples.of(s, false)),
badKeys.stream().map(s -> Tuples.of(s, true)) badKeys.stream().map(s -> Tuples.of(s, true))
).collect(Collectors.toList()); ).collect(Collectors.toList());
var values = List.of( var values = isCIMode() ? List.of(Map.of("123456", "val")) : List.of(
Map.of("123456", "a", "234567", ""), Map.of("123456", "a", "234567", ""),
Map.of("123456", "\0", "234567", "\0\0", "345678", BIG_STRING) Map.of("123456", "\0", "234567", "\0\0", "345678", BIG_STRING)
); );

View File

@ -3,6 +3,7 @@ package it.cavallium.dbengine;
import static it.cavallium.dbengine.DbTestUtils.BIG_STRING; import static it.cavallium.dbengine.DbTestUtils.BIG_STRING;
import static it.cavallium.dbengine.DbTestUtils.destroyAllocator; import static it.cavallium.dbengine.DbTestUtils.destroyAllocator;
import static it.cavallium.dbengine.DbTestUtils.ensureNoLeaks; import static it.cavallium.dbengine.DbTestUtils.ensureNoLeaks;
import static it.cavallium.dbengine.DbTestUtils.isCIMode;
import static it.cavallium.dbengine.DbTestUtils.newAllocator; import static it.cavallium.dbengine.DbTestUtils.newAllocator;
import static it.cavallium.dbengine.DbTestUtils.tempDatabaseMapDictionaryDeepMapHashMap; import static it.cavallium.dbengine.DbTestUtils.tempDatabaseMapDictionaryDeepMapHashMap;
import static it.cavallium.dbengine.DbTestUtils.tempDb; import static it.cavallium.dbengine.DbTestUtils.tempDb;
@ -11,6 +12,7 @@ import static it.cavallium.dbengine.DbTestUtils.tempDictionary;
import it.cavallium.dbengine.DbTestUtils.TestAllocator; import it.cavallium.dbengine.DbTestUtils.TestAllocator;
import it.cavallium.dbengine.database.UpdateMode; import it.cavallium.dbengine.database.UpdateMode;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
@ -38,22 +40,22 @@ public abstract class TestDictionaryMapDeepHashMap {
private boolean checkLeaks = true; private boolean checkLeaks = true;
private static boolean isTestBadKeysEnabled() { private static boolean isTestBadKeysEnabled() {
return System.getProperty("badkeys", "true").equalsIgnoreCase("true"); return !isCIMode() && System.getProperty("badkeys", "true").equalsIgnoreCase("true");
} }
protected abstract TemporaryDbGenerator getTempDbGenerator(); protected abstract TemporaryDbGenerator getTempDbGenerator();
private static Stream<Arguments> provideArgumentsPut() { private static Stream<Arguments> provideArgumentsPut() {
var goodKeys1 = Set.of("12345", "zebra"); var goodKeys1 = isCIMode() ? List.of("12345") : List.of("12345", "zebra");
Set<String> badKeys1; List<String> badKeys1;
if (isTestBadKeysEnabled()) { if (isTestBadKeysEnabled()) {
badKeys1 = Set.of("", "a", "aaaa", "aaaaaa"); badKeys1 = List.of("", "a", "aaaa", "aaaaaa");
} else { } else {
badKeys1 = Set.of(); badKeys1 = List.of();
} }
var goodKeys2 = Set.of("123456", "anatra", "", "a", "aaaaa", "aaaaaaa"); var goodKeys2 = isCIMode() ? List.of("123456") : List.of("123456", "anatra", "", "a", "aaaaa", "aaaaaaa");
var values = Set.of("a", "", "\0", "\0\0", "z", "azzszgzczqz", BIG_STRING); var values = isCIMode() ? List.of("val") : List.of("a", "", "\0", "\0\0", "z", "azzszgzczqz", BIG_STRING);
Flux<Tuple4<String, String, String, Boolean>> failOnKeys1 = Flux Flux<Tuple4<String, String, String, Boolean>> failOnKeys1 = Flux
.fromIterable(badKeys1) .fromIterable(badKeys1)