diff --git a/.evergreen/.evg.yml b/.evergreen/.evg.yml index a57f6473b6f..7f3ca3d2c53 100644 --- a/.evergreen/.evg.yml +++ b/.evergreen/.evg.yml @@ -509,24 +509,6 @@ functions: mongo --nodb setup.js aws_e2e_ecs.js cd - - "run atlas data lake test": - - command: shell.exec - type: test - params: - working_dir: "src" - script: | - ${PREPARE_SHELL} - JAVA_VERSION=${JAVA_VERSION} .evergreen/run-atlas-data-lake-test.sh - - "run atlas search test": - - command: shell.exec - type: test - params: - working_dir: "src" - script: | - ${PREPARE_SHELL} - MONGODB_URI="${atlas_search_uri}" .evergreen/run-atlas-search-tests.sh - "run-ocsp-test": - command: shell.exec type: test @@ -627,19 +609,6 @@ functions: ${PREPARE_SHELL} PROJECT_DIRECTORY=${PROJECT_DIRECTORY} JAVA_VERSION=${JAVA_VERSION} TOPOLOGY=${TOPOLOGY} STORAGE_ENGINE=${STORAGE_ENGINE} MONGODB_URI="${MONGODB_URI}" .evergreen/run-mmapv1-storage-test.sh - "run atlas test": - - command: shell.exec - type: test - params: - silent: true - working_dir: "src" - script: | - # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does) - # The connection strings are pipe-delimited - JAVA_VERSION="8" \ - MONGODB_URIS="${atlas_free_tier_uri}|${atlas_replica_set_uri}|${atlas_sharded_uri}|${atlas_tls_v11_uri}|${atlas_tls_v12_uri}|${atlas_free_tier_uri_srv}|${atlas_replica_set_uri_srv}|${atlas_sharded_uri_srv}|${atlas_tls_v11_uri_srv}|${atlas_tls_v12_uri_srv}|${atlas_serverless_uri}|${atlas_serverless_uri_srv}" \ - .evergreen/run-connectivity-tests.sh - run socks5 tests: - command: shell.exec type: test @@ -1462,14 +1431,50 @@ tasks: OCSP_MUST_STAPLE: "false" OCSP_TLS_SHOULD_SUCCEED: "0" - - name: "atlas-data-lake-test" + - name: "atlas-data-lake-task" commands: - func: "bootstrap mongohoused" - - func: "run atlas data lake test" + - command: shell.exec + type: test + params: + working_dir: "src" + script: | + ${PREPARE_SHELL} + JAVA_VERSION=${JAVA_VERSION} .evergreen/run-atlas-data-lake-test.sh - - name: "atlas-search-test" + - name: "atlas-search-task" commands: - - func: "run atlas search test" + - command: shell.exec + type: test + params: + working_dir: "src" + script: | + ${PREPARE_SHELL} + MONGODB_URI="${atlas_search_uri}" .evergreen/run-atlas-search-tests.sh + + - name: "atlas-connectivity-task" + commands: + - command: shell.exec + type: test + params: + silent: true + working_dir: "src" + script: | + # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does) + # The connection strings are pipe-delimited + MONGODB_URIS="${atlas_free_tier_uri}|${atlas_replica_set_uri}|${atlas_sharded_uri}|${atlas_tls_v11_uri}|${atlas_tls_v12_uri}|${atlas_free_tier_uri_srv}|${atlas_replica_set_uri_srv}|${atlas_sharded_uri_srv}|${atlas_tls_v11_uri_srv}|${atlas_tls_v12_uri_srv}|${atlas_serverless_uri}|${atlas_serverless_uri_srv}" \ + JAVA_VERSION="8" \ + .evergreen/run-connectivity-tests.sh + + - name: "atlas-search-index-management-task" + commands: + - command: subprocess.exec + params: + working_dir: src + binary: bash + add_expansions_to_env: true + args: + - .evergreen/run-atlas-search-index-management-tests.sh - name: "gssapi-auth-test" commands: @@ -1490,20 +1495,6 @@ tasks: - func: "bootstrap mongo-orchestration" - func: "run netty tests" - - name: "atlas-test" - commands: - - func: "run atlas test" - - - name: "test-atlas-search-index-helpers" - commands: - - command: subprocess.exec - params: - working_dir: src - binary: bash - add_expansions_to_env: true - args: - - .evergreen/run-atlas-search-index-management-tests.sh - - name: publish-snapshot depends_on: - variant: "static-checks" @@ -1536,7 +1527,7 @@ tasks: - func: "run perf tests" - func: "send dashboard data" - - name: "test-aws-lambda-deployed" + - name: "aws-lambda-deployed-task" commands: - command: ec2.assume_role params: @@ -1630,7 +1621,6 @@ tasks: echo "Untarring file ... begin" GCPKMS_CMD="tar xf mongo-java-driver.tgz" $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/run-command.sh echo "Untarring file ... end" - - command: shell.exec type: test params: @@ -1918,11 +1908,12 @@ axes: batchtime: 10080 # 7 days task_groups: - - name: test_atlas_task_group_search_indexes + - name: "atlas-deployed-task-group" setup_group: - func: fetch source - func: prepare resources - command: subprocess.exec + type: setup params: working_dir: src binary: bash @@ -1934,6 +1925,7 @@ task_groups: file: src/atlas-expansion.yml teardown_group: - command: subprocess.exec + type: setup params: working_dir: src binary: bash @@ -1943,7 +1935,9 @@ task_groups: setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: - - test-atlas-search-index-helpers + - "atlas-search-index-management-task" + - "aws-lambda-deployed-task" + - name: testgcpkms_task_group setup_group_can_fail_task: true setup_group_timeout_secs: 1800 # 30 minutes @@ -1979,6 +1973,7 @@ task_groups: $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/delete-instance.sh tasks: - testgcpkms-task + - name: testazurekms_task_group setup_group_can_fail_task: true setup_group_timeout_secs: 1800 # 30 minutes @@ -2023,32 +2018,6 @@ task_groups: $DRIVERS_TOOLS/.evergreen/csfle/azurekms/delete-vm.sh tasks: - testazurekms-task - - name: test_atlas_task_group - setup_group: - - func: fetch source - - func: prepare resources - - command: subprocess.exec - params: - working_dir: src - binary: bash - add_expansions_to_env: true - args: - - ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh - - command: expansions.update - params: - file: src/atlas-expansion.yml - teardown_group: - - command: subprocess.exec - params: - working_dir: src - binary: bash - add_expansions_to_env: true - args: - - ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh - setup_group_can_fail_task: true - setup_group_timeout_secs: 1800 - tasks: - - test-aws-lambda-deployed - name: testoidc_task_group setup_group: @@ -2283,24 +2252,12 @@ buildvariants: tasks: - name: "perf" -- name: rhel8-test-atlas - display_name: Atlas Cluster Tests - run_on: rhel80-large - tasks: - - test_atlas_task_group - - name: plain-auth-test display_name: "PLAIN (LDAP) Auth test" run_on: rhel80-small tasks: - name: "plain-auth-test" -- name: rhel80-test-search-indexes - display_name: Atlas Search Index Management Tests - run_on: rhel80-small - tasks: - - name: "test_atlas_task_group_search_indexes" - - name: "oidc-auth-test" display_name: "OIDC Auth" run_on: ubuntu2204-small @@ -2355,23 +2312,19 @@ buildvariants: tasks: - name: ".ocsp" -- name: atlas-data-lake-test - display_name: "Atlas Data Lake test" - run_on: ubuntu2004-small - tasks: - - name: "atlas-data-lake-test" - -- name: atlas-test - display_name: "Atlas test" +- name: "atlas-search-variant" + display_name: "Atlas Tests" run_on: rhel80-small tasks: - - name: "atlas-test" + - name: "atlas-deployed-task-group" + - name: "atlas-search-task" + - name: "atlas-connectivity-task" -- name: atlas-search-test - display_name: "Atlas Search test" - run_on: rhel80-small +- name: atlas-data-lake-test + display_name: "Atlas Data Lake test" + run_on: ubuntu2004-small tasks: - - name: "atlas-search-test" + - name: "atlas-data-lake-task" - name: "reactive-streams-tck-test" display_name: "Reactive Streams TCK tests" diff --git a/.evergreen/run-atlas-search-tests.sh b/.evergreen/run-atlas-search-tests.sh index 36cc981b3f4..f207647825f 100755 --- a/.evergreen/run-atlas-search-tests.sh +++ b/.evergreen/run-atlas-search-tests.sh @@ -16,4 +16,6 @@ echo "Running Atlas Search tests" ./gradlew --stacktrace --info \ -Dorg.mongodb.test.atlas.search=true \ -Dorg.mongodb.test.uri=${MONGODB_URI} \ - driver-core:test --tests AggregatesSearchIntegrationTest --tests AggregatesVectorSearchIntegrationTest + driver-core:test --tests AggregatesSearchIntegrationTest \ + --tests AggregatesBinaryVectorSearchIntegrationTest \ + --tests AggregatesSearchTest \ diff --git a/driver-core/src/main/com/mongodb/client/model/search/SearchOperator.java b/driver-core/src/main/com/mongodb/client/model/search/SearchOperator.java index ef5c1239313..aa8b01b29d4 100644 --- a/driver-core/src/main/com/mongodb/client/model/search/SearchOperator.java +++ b/driver-core/src/main/com/mongodb/client/model/search/SearchOperator.java @@ -22,9 +22,9 @@ import com.mongodb.client.model.geojson.Point; import org.bson.BsonArray; import org.bson.BsonBinary; -import org.bson.BsonBoolean; import org.bson.BsonDocument; import org.bson.BsonNull; +import org.bson.BsonBoolean; import org.bson.BsonType; import org.bson.Document; import org.bson.conversions.Bson; @@ -573,14 +573,15 @@ static PhraseSearchOperator phrase(final Iterable extends SearchPath> paths, f } /** - * Returns a {@link SearchOperator} that performs a search using a special characters in the search string that can match any character. + * Returns a {@link SearchOperator} that performs a search using a special + * characters in the search string that can match any character. * + * @param path The indexed field to be searched. * @param query The string to search for. - * @param path The indexed field to be searched. * @return The requested {@link SearchOperator}. * @mongodb.atlas.manual atlas-search/wildcard/ wildcard operator */ - static WildcardSearchOperator wildcard(final String query, final SearchPath path) { + static WildcardSearchOperator wildcard(final SearchPath path, final String query) { return wildcard(singleton(notNull("query", query)), singleton(notNull("path", path))); } diff --git a/driver-core/src/main/com/mongodb/client/model/search/WildcardSearchOperator.java b/driver-core/src/main/com/mongodb/client/model/search/WildcardSearchOperator.java index 651d9ffa57c..95d4a5caad5 100644 --- a/driver-core/src/main/com/mongodb/client/model/search/WildcardSearchOperator.java +++ b/driver-core/src/main/com/mongodb/client/model/search/WildcardSearchOperator.java @@ -20,7 +20,7 @@ import com.mongodb.annotations.Sealed; /** - * @see SearchOperator#wildcard(String, SearchPath) + * @see SearchOperator#wildcard(SearchPath, String) * @see SearchOperator#wildcard(Iterable, Iterable) * @since 4.7 */ diff --git a/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesBinaryVectorSearchIntegrationTest.java b/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesBinaryVectorSearchIntegrationTest.java index 0d5aad1085a..a242367992f 100644 --- a/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesBinaryVectorSearchIntegrationTest.java +++ b/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesBinaryVectorSearchIntegrationTest.java @@ -22,9 +22,9 @@ import com.mongodb.client.model.SearchIndexType; import com.mongodb.client.test.CollectionHelper; import com.mongodb.internal.operation.SearchIndexRequest; +import org.bson.BinaryVector; import org.bson.BsonDocument; import org.bson.Document; -import org.bson.BinaryVector; import org.bson.codecs.DocumentCodec; import org.bson.conversions.Bson; import org.junit.jupiter.api.AfterAll; diff --git a/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesSearchIntegrationTest.java b/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesSearchIntegrationTest.java index 3fe4229b498..bc34cb0060c 100644 --- a/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesSearchIntegrationTest.java +++ b/driver-core/src/test/functional/com/mongodb/client/model/search/AggregatesSearchIntegrationTest.java @@ -229,6 +229,9 @@ * * * + *
+ * Use this class when needing to test against MFLIX specifically. Otherwise,
+ * see AggregatesSearchTest.
*/
final class AggregatesSearchIntegrationTest {
private static final MongoNamespace MFLIX_MOVIES_NS = new MongoNamespace("sample_mflix", "movies");
diff --git a/driver-core/src/test/unit/com/mongodb/client/model/search/SearchOperatorTest.java b/driver-core/src/test/unit/com/mongodb/client/model/search/SearchOperatorTest.java
index 9151768da31..ccf5a44cd1f 100644
--- a/driver-core/src/test/unit/com/mongodb/client/model/search/SearchOperatorTest.java
+++ b/driver-core/src/test/unit/com/mongodb/client/model/search/SearchOperatorTest.java
@@ -833,8 +833,8 @@ void wildcard() {
.append("path", fieldPath("fieldName").toBsonValue())
),
SearchOperator.wildcard(
- "term",
- fieldPath("fieldName"))
+ fieldPath("fieldName"), "term"
+ )
.toBsonDocument()
),
() -> assertEquals(
diff --git a/driver-scala/src/main/scala/org/mongodb/scala/model/search/SearchOperator.scala b/driver-scala/src/main/scala/org/mongodb/scala/model/search/SearchOperator.scala
index 6f4f6a8860d..1fa47a54e1b 100644
--- a/driver-scala/src/main/scala/org/mongodb/scala/model/search/SearchOperator.scala
+++ b/driver-scala/src/main/scala/org/mongodb/scala/model/search/SearchOperator.scala
@@ -429,7 +429,7 @@ object SearchOperator {
* @return The requested `SearchOperator`.
* @see [[https://www.mongodb.com/docs/atlas/atlas-search/wildcard/ wildcard operator]]
*/
- def wildcard(query: String, path: SearchPath): WildcardSearchOperator = JSearchOperator.wildcard(query, path)
+ def wildcard(query: String, path: SearchPath): WildcardSearchOperator = JSearchOperator.wildcard(path, query)
/**
* Returns a `SearchOperator` that enables queries which use special characters in the search string that can match any character.
diff --git a/driver-sync/src/test/functional/com/mongodb/client/DatabaseTestCase.java b/driver-sync/src/test/functional/com/mongodb/client/DatabaseTestCase.java
index f2f1c5382cd..70479c4670b 100644
--- a/driver-sync/src/test/functional/com/mongodb/client/DatabaseTestCase.java
+++ b/driver-sync/src/test/functional/com/mongodb/client/DatabaseTestCase.java
@@ -16,11 +16,8 @@
package com.mongodb.client;
-import com.mongodb.MongoNamespace;
import com.mongodb.client.test.CollectionHelper;
import com.mongodb.internal.connection.ServerHelper;
-import org.bson.BsonDocument;
-import org.bson.BsonDocumentWrapper;
import org.bson.Document;
import org.bson.codecs.DocumentCodec;
import org.junit.jupiter.api.AfterEach;
@@ -40,7 +37,7 @@ public class DatabaseTestCase {
@BeforeEach
public void setUp() {
- client = getMongoClient();
+ client = getMongoClient();
database = client.getDatabase(getDefaultDatabaseName());
collection = database.getCollection(getClass().getName());
collection.drop();
@@ -58,23 +55,7 @@ public void tearDown() {
}
}
- protected String getDatabaseName() {
- return database.getName();
- }
-
- protected String getCollectionName() {
- return collection.getNamespace().getCollectionName();
- }
-
- protected MongoNamespace getNamespace() {
- return collection.getNamespace();
- }
-
protected CollectionHelper