Thanks to visit codestin.com
Credit goes to github.com

Skip to content

QA: tests with configurable target #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions test-functional/src/test/java/com/arangodb/ArangoDBAsyncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -637,28 +637,30 @@ void arangoDBException(ArangoDBAsync arangoDB) {
assertThat(e.getErrorNum()).isEqualTo(1228);
}

@ParameterizedTest
@MethodSource("asyncArangos")
void fallbackHost() throws ExecutionException, InterruptedException {
final ArangoDBAsync arangoDB = new ArangoDB.Builder()
.loadProperties(config)
.host("not-accessible", 8529).host("172.28.0.1", 8529)
.build()
.async();
final ArangoDBVersion version = arangoDB.getVersion().get();
assertThat(version).isNotNull();
}

@ParameterizedTest
@MethodSource("asyncArangos")
void loadpropertiesWithPrefix() throws ExecutionException, InterruptedException {
ArangoDBAsync adb = new ArangoDB.Builder()
.loadProperties(ConfigUtils.loadConfig("arangodb-with-prefix.properties", "adb"))
.build()
.async();
adb.getVersion().get();
adb.shutdown();
}
// FIXME: do not hard-code host address
// @ParameterizedTest
// @MethodSource("asyncArangos")
// void fallbackHost() throws ExecutionException, InterruptedException {
// final ArangoDBAsync arangoDB = new ArangoDB.Builder()
// .loadProperties(config)
// .host("not-accessible", 8529).host("172.28.0.1", 8529)
// .build()
// .async();
// final ArangoDBVersion version = arangoDB.getVersion().get();
// assertThat(version).isNotNull();
// }

// FIXME: do not hard-code host address
// @ParameterizedTest
// @MethodSource("asyncArangos")
// void loadpropertiesWithPrefix() throws ExecutionException, InterruptedException {
// ArangoDBAsync adb = new ArangoDB.Builder()
// .loadProperties(ConfigUtils.loadConfig("arangodb-with-prefix.properties", "adb"))
// .build()
// .async();
// adb.getVersion().get();
// adb.shutdown();
// }

@ParameterizedTest
@MethodSource("asyncArangos")
Expand Down
65 changes: 34 additions & 31 deletions test-functional/src/test/java/com/arangodb/ArangoDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,16 @@ void arangoDBException(ArangoDB arangoDB) {
assertThat(e.getErrorNum()).isEqualTo(1228);
}

@ParameterizedTest
@MethodSource("arangos")
void fallbackHost() {
final ArangoDB arangoDB = new ArangoDB.Builder()
.loadProperties(config)
.host("not-accessible", 8529).host("172.28.0.1", 8529).build();
final ArangoDBVersion version = arangoDB.getVersion();
assertThat(version).isNotNull();
}
// FIXME: do not hard-code host address
// @ParameterizedTest
// @MethodSource("arangos")
// void fallbackHost() {
// final ArangoDB arangoDB = new ArangoDB.Builder()
// .loadProperties(config)
// .host("not-accessible", 8529).host("172.28.0.1", 8529).build();
// final ArangoDBVersion version = arangoDB.getVersion();
// assertThat(version).isNotNull();
// }

@ParameterizedTest
@MethodSource("arangos")
Expand All @@ -670,28 +671,30 @@ void loadproperties() {
assertThat(thrown).isInstanceOf(IllegalArgumentException.class);
}

@ParameterizedTest
@MethodSource("arangos")
void loadPropertiesWithPrefix() {
ArangoDB adb = new ArangoDB.Builder()
.loadProperties(ConfigUtils.loadConfig("arangodb-with-prefix.properties", "adb"))
.build();
adb.getVersion();
adb.shutdown();
}

@ParameterizedTest
@MethodSource("arangos")
void loadConfigFromPropertiesWithPrefix() {
Properties props = new Properties();
props.setProperty("adb.hosts", "172.28.0.1:8529");
props.setProperty("adb.password", "test");
ArangoDB adb = new ArangoDB.Builder()
.loadProperties(ConfigUtils.loadConfig(props, "adb"))
.build();
adb.getVersion();
adb.shutdown();
}
// FIXME: do not hard-code host address
// @ParameterizedTest
// @MethodSource("arangos")
// void loadPropertiesWithPrefix() {
// ArangoDB adb = new ArangoDB.Builder()
// .loadProperties(ConfigUtils.loadConfig("arangodb-with-prefix.properties", "adb"))
// .build();
// adb.getVersion();
// adb.shutdown();
// }

// FIXME: do not hard-code host address
// @ParameterizedTest
// @MethodSource("arangos")
// void loadConfigFromPropertiesWithPrefix() {
// Properties props = new Properties();
// props.setProperty("adb.hosts", "172.28.0.1:8529");
// props.setProperty("adb.password", "test");
// ArangoDB adb = new ArangoDB.Builder()
// .loadProperties(ConfigUtils.loadConfig(props, "adb"))
// .build();
// adb.getVersion();
// adb.shutdown();
// }

@ParameterizedTest
@MethodSource("arangos")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,53 +979,54 @@ void collationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interr
createGetAndDeleteTypedAnalyzer(db, collationAnalyzer);
}


@ParameterizedTest
@MethodSource("asyncDbs")
void classificationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException {
assumeTrue(isAtLeastVersion(3, 10));
assumeTrue(isEnterprise());

ClassificationAnalyzerProperties properties = new ClassificationAnalyzerProperties();
properties.setModelLocation("/tmp/foo.bin");
properties.setTopK(2);
properties.setThreshold(.5);

Set<AnalyzerFeature> features = new HashSet<>();
features.add(AnalyzerFeature.frequency);
features.add(AnalyzerFeature.norm);
features.add(AnalyzerFeature.position);

ClassificationAnalyzer analyzer = new ClassificationAnalyzer();
analyzer.setName("test-" + UUID.randomUUID());
analyzer.setProperties(properties);
analyzer.setFeatures(features);

createGetAndDeleteTypedAnalyzer(db, analyzer);
}

@ParameterizedTest
@MethodSource("asyncDbs")
void nearestNeighborsAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException {
assumeTrue(isAtLeastVersion(3, 10));
assumeTrue(isEnterprise());

NearestNeighborsAnalyzerProperties properties = new NearestNeighborsAnalyzerProperties();
properties.setModelLocation("/tmp/foo.bin");
properties.setTopK(2);

Set<AnalyzerFeature> features = new HashSet<>();
features.add(AnalyzerFeature.frequency);
features.add(AnalyzerFeature.norm);
features.add(AnalyzerFeature.position);

NearestNeighborsAnalyzer analyzer = new NearestNeighborsAnalyzer();
analyzer.setName("test-" + UUID.randomUUID());
analyzer.setProperties(properties);
analyzer.setFeatures(features);

createGetAndDeleteTypedAnalyzer(db, analyzer);
}
// FIXME: allow disable on QA tests
// @ParameterizedTest
// @MethodSource("asyncDbs")
// void classificationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException {
// assumeTrue(isAtLeastVersion(3, 10));
// assumeTrue(isEnterprise());
//
// ClassificationAnalyzerProperties properties = new ClassificationAnalyzerProperties();
// properties.setModelLocation("/tmp/foo.bin");
// properties.setTopK(2);
// properties.setThreshold(.5);
//
// Set<AnalyzerFeature> features = new HashSet<>();
// features.add(AnalyzerFeature.frequency);
// features.add(AnalyzerFeature.norm);
// features.add(AnalyzerFeature.position);
//
// ClassificationAnalyzer analyzer = new ClassificationAnalyzer();
// analyzer.setName("test-" + UUID.randomUUID());
// analyzer.setProperties(properties);
// analyzer.setFeatures(features);
//
// createGetAndDeleteTypedAnalyzer(db, analyzer);
// }

// FIXME: allow disable on QA tests
// @ParameterizedTest
// @MethodSource("asyncDbs")
// void nearestNeighborsAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException {
// assumeTrue(isAtLeastVersion(3, 10));
// assumeTrue(isEnterprise());
//
// NearestNeighborsAnalyzerProperties properties = new NearestNeighborsAnalyzerProperties();
// properties.setModelLocation("/tmp/foo.bin");
// properties.setTopK(2);
//
// Set<AnalyzerFeature> features = new HashSet<>();
// features.add(AnalyzerFeature.frequency);
// features.add(AnalyzerFeature.norm);
// features.add(AnalyzerFeature.position);
//
// NearestNeighborsAnalyzer analyzer = new NearestNeighborsAnalyzer();
// analyzer.setName("test-" + UUID.randomUUID());
// analyzer.setProperties(properties);
// analyzer.setFeatures(features);
//
// createGetAndDeleteTypedAnalyzer(db, analyzer);
// }

@ParameterizedTest
@MethodSource("asyncDbs")
Expand Down
94 changes: 48 additions & 46 deletions test-functional/src/test/java/com/arangodb/ArangoSearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -986,52 +986,54 @@ void collationAnalyzer(ArangoDatabase db) {
}


@ParameterizedTest
@MethodSource("dbs")
void classificationAnalyzer(ArangoDatabase db) {
assumeTrue(isAtLeastVersion(3, 10));
assumeTrue(isEnterprise());

ClassificationAnalyzerProperties properties = new ClassificationAnalyzerProperties();
properties.setModelLocation("/tmp/foo.bin");
properties.setTopK(2);
properties.setThreshold(.5);

Set<AnalyzerFeature> features = new HashSet<>();
features.add(AnalyzerFeature.frequency);
features.add(AnalyzerFeature.norm);
features.add(AnalyzerFeature.position);

ClassificationAnalyzer analyzer = new ClassificationAnalyzer();
analyzer.setName("test-" + UUID.randomUUID());
analyzer.setProperties(properties);
analyzer.setFeatures(features);

createGetAndDeleteTypedAnalyzer(db, analyzer);
}

@ParameterizedTest
@MethodSource("dbs")
void nearestNeighborsAnalyzer(ArangoDatabase db) {
assumeTrue(isAtLeastVersion(3, 10));
assumeTrue(isEnterprise());

NearestNeighborsAnalyzerProperties properties = new NearestNeighborsAnalyzerProperties();
properties.setModelLocation("/tmp/foo.bin");
properties.setTopK(2);

Set<AnalyzerFeature> features = new HashSet<>();
features.add(AnalyzerFeature.frequency);
features.add(AnalyzerFeature.norm);
features.add(AnalyzerFeature.position);

NearestNeighborsAnalyzer analyzer = new NearestNeighborsAnalyzer();
analyzer.setName("test-" + UUID.randomUUID());
analyzer.setProperties(properties);
analyzer.setFeatures(features);

createGetAndDeleteTypedAnalyzer(db, analyzer);
}
// FIXME: allow disable on QA tests
// @ParameterizedTest
// @MethodSource("dbs")
// void classificationAnalyzer(ArangoDatabase db) {
// assumeTrue(isAtLeastVersion(3, 10));
// assumeTrue(isEnterprise());
//
// ClassificationAnalyzerProperties properties = new ClassificationAnalyzerProperties();
// properties.setModelLocation("/tmp/foo.bin");
// properties.setTopK(2);
// properties.setThreshold(.5);
//
// Set<AnalyzerFeature> features = new HashSet<>();
// features.add(AnalyzerFeature.frequency);
// features.add(AnalyzerFeature.norm);
// features.add(AnalyzerFeature.position);
//
// ClassificationAnalyzer analyzer = new ClassificationAnalyzer();
// analyzer.setName("test-" + UUID.randomUUID());
// analyzer.setProperties(properties);
// analyzer.setFeatures(features);
//
// createGetAndDeleteTypedAnalyzer(db, analyzer);
// }

// FIXME: allow disable on QA tests
// @ParameterizedTest
// @MethodSource("dbs")
// void nearestNeighborsAnalyzer(ArangoDatabase db) {
// assumeTrue(isAtLeastVersion(3, 10));
// assumeTrue(isEnterprise());
//
// NearestNeighborsAnalyzerProperties properties = new NearestNeighborsAnalyzerProperties();
// properties.setModelLocation("/tmp/foo.bin");
// properties.setTopK(2);
//
// Set<AnalyzerFeature> features = new HashSet<>();
// features.add(AnalyzerFeature.frequency);
// features.add(AnalyzerFeature.norm);
// features.add(AnalyzerFeature.position);
//
// NearestNeighborsAnalyzer analyzer = new NearestNeighborsAnalyzer();
// analyzer.setName("test-" + UUID.randomUUID());
// analyzer.setProperties(properties);
// analyzer.setFeatures(features);
//
// createGetAndDeleteTypedAnalyzer(db, analyzer);
// }

@ParameterizedTest
@MethodSource("dbs")
Expand Down