From ccf39717e9e9c966a6c9f4c851eb954435d54eb2 Mon Sep 17 00:00:00 2001 From: Graham Pople Date: Thu, 24 Nov 2022 13:01:24 +0000 Subject: [PATCH] Tests - query tests need 7.1.0 for MB-50132 Any tests that are creating collections and require the indexer to be aware of those collections, needs MB-50132. Change-Id: Idabc2c4b24f8fdda954dbacc9bb1a0548fa898bf Reviewed-on: https://review.couchbase.org/c/couchbase-jvm-clients/+/183226 Reviewed-by: Michael Reiche Tested-by: Build Bot --- .../java/AnalyticsCollectionIntegrationTest.java | 2 ++ .../java/QueryCollectionIntegrationTest.java | 5 +++-- .../java/QueryConcurrencyIntegrationTest.java | 2 ++ .../client/java/QueryIntegrationTest.java | 2 ++ ...ueryCollectionsIndexManagerIntegrationTest.java | 8 ++++---- .../query/QueryIndexManagerIntegrationTest.java | 14 +++++++++++--- .../query/QueryIndexManagerIntegrationTest.kt | 3 +++ .../scala/manager/QueryIndexManagerSpec.scala | 13 ++++++------- .../couchbase/client/scala/query/QuerySpec.scala | 11 ++++++++++- .../client/scala/query/ScopeLevelQuerySpec.scala | 4 +++- 10 files changed, 46 insertions(+), 18 deletions(-) diff --git a/java-client/src/integrationTest/java/com/couchbase/client/java/AnalyticsCollectionIntegrationTest.java b/java-client/src/integrationTest/java/com/couchbase/client/java/AnalyticsCollectionIntegrationTest.java index 42024c63e..f975ed278 100644 --- a/java-client/src/integrationTest/java/com/couchbase/client/java/AnalyticsCollectionIntegrationTest.java +++ b/java-client/src/integrationTest/java/com/couchbase/client/java/AnalyticsCollectionIntegrationTest.java @@ -53,6 +53,7 @@ import static com.couchbase.client.java.manager.analytics.CreateDatasetAnalyticsOptions.createDatasetAnalyticsOptions; import static com.couchbase.client.java.manager.analytics.DropDatasetAnalyticsOptions.dropDatasetAnalyticsOptions; import static com.couchbase.client.java.manager.analytics.DropIndexAnalyticsOptions.dropIndexAnalyticsOptions; +import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.REQUIRE_MB_50132; import static com.couchbase.client.test.Util.waitUntilCondition; import static java.util.Collections.singletonMap; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -65,6 +66,7 @@ */ @IgnoreWhen( missesCapabilities = {Capabilities.ANALYTICS, Capabilities.COLLECTIONS}, + clusterVersionIsBelow = REQUIRE_MB_50132, clusterTypes = ClusterType.CAVES ) class AnalyticsCollectionIntegrationTest extends JavaIntegrationTest { diff --git a/java-client/src/integrationTest/java/com/couchbase/client/java/QueryCollectionIntegrationTest.java b/java-client/src/integrationTest/java/com/couchbase/client/java/QueryCollectionIntegrationTest.java index c5af0063b..a154087e3 100644 --- a/java-client/src/integrationTest/java/com/couchbase/client/java/QueryCollectionIntegrationTest.java +++ b/java-client/src/integrationTest/java/com/couchbase/client/java/QueryCollectionIntegrationTest.java @@ -53,6 +53,7 @@ import static com.couchbase.client.core.util.CbThrowables.throwIfUnchecked; import static com.couchbase.client.java.AsyncUtils.block; import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.DISABLE_QUERY_TESTS_FOR_CLUSTER; +import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.REQUIRE_MB_50132; import static com.couchbase.client.java.query.QueryOptions.queryOptions; import static com.couchbase.client.test.Util.waitUntilCondition; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -65,10 +66,10 @@ *

* @author Michael Reiche */ -// Using SUBDOC_REVIVE_DOCUMENT as a proxy for 7.1.0 so we get fix for MB-50132 @IgnoreWhen( - missesCapabilities = { Capabilities.QUERY, Capabilities.COLLECTIONS, Capabilities.SUBDOC_REVIVE_DOCUMENT }, + missesCapabilities = { Capabilities.QUERY, Capabilities.COLLECTIONS }, clusterTypes = { ClusterType.MOCKED, ClusterType.CAVES }, + clusterVersionIsBelow = REQUIRE_MB_50132, clusterVersionEquals = DISABLE_QUERY_TESTS_FOR_CLUSTER ) class QueryCollectionIntegrationTest extends JavaIntegrationTest { diff --git a/java-client/src/integrationTest/java/com/couchbase/client/java/QueryConcurrencyIntegrationTest.java b/java-client/src/integrationTest/java/com/couchbase/client/java/QueryConcurrencyIntegrationTest.java index 3eb5d3fdd..598e8818b 100644 --- a/java-client/src/integrationTest/java/com/couchbase/client/java/QueryConcurrencyIntegrationTest.java +++ b/java-client/src/integrationTest/java/com/couchbase/client/java/QueryConcurrencyIntegrationTest.java @@ -37,6 +37,7 @@ import java.util.concurrent.TimeUnit; import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.DISABLE_QUERY_TESTS_FOR_CLUSTER; +import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.REQUIRE_MB_50132; import static com.couchbase.client.java.query.QueryOptions.queryOptions; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -45,6 +46,7 @@ @IgnoreWhen( missesCapabilities = Capabilities.QUERY, clusterVersionEquals = DISABLE_QUERY_TESTS_FOR_CLUSTER, + clusterVersionIsBelow = REQUIRE_MB_50132, clusterTypes = ClusterType.CAVES ) class QueryConcurrencyIntegrationTest extends JavaIntegrationTest { diff --git a/java-client/src/integrationTest/java/com/couchbase/client/java/QueryIntegrationTest.java b/java-client/src/integrationTest/java/com/couchbase/client/java/QueryIntegrationTest.java index 48f7ed3db..b50b57d89 100644 --- a/java-client/src/integrationTest/java/com/couchbase/client/java/QueryIntegrationTest.java +++ b/java-client/src/integrationTest/java/com/couchbase/client/java/QueryIntegrationTest.java @@ -52,6 +52,7 @@ import java.util.concurrent.CompletableFuture; import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.DISABLE_QUERY_TESTS_FOR_CLUSTER; +import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.REQUIRE_MB_50132; import static com.couchbase.client.java.query.QueryOptions.queryOptions; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -67,6 +68,7 @@ @IgnoreWhen( missesCapabilities = Capabilities.QUERY, clusterVersionEquals = DISABLE_QUERY_TESTS_FOR_CLUSTER, + clusterVersionIsBelow = REQUIRE_MB_50132, clusterTypes = ClusterType.CAVES ) class QueryIntegrationTest extends JavaIntegrationTest { diff --git a/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryCollectionsIndexManagerIntegrationTest.java b/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryCollectionsIndexManagerIntegrationTest.java index 29677982b..03106e5c6 100644 --- a/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryCollectionsIndexManagerIntegrationTest.java +++ b/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryCollectionsIndexManagerIntegrationTest.java @@ -47,6 +47,7 @@ import static com.couchbase.client.java.manager.query.DropPrimaryQueryIndexOptions.dropPrimaryQueryIndexOptions; import static com.couchbase.client.java.manager.query.DropQueryIndexOptions.dropQueryIndexOptions; import static com.couchbase.client.java.manager.query.GetAllQueryIndexesOptions.getAllQueryIndexesOptions; +import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.REQUIRE_MB_50132; import static com.couchbase.client.java.manager.query.WatchQueryIndexesOptions.watchQueryIndexesOptions; import static com.couchbase.client.test.Capabilities.COLLECTIONS; import static com.couchbase.client.test.Capabilities.QUERY; @@ -64,7 +65,9 @@ /** * Very similar to the {@link QueryIndexManagerIntegrationTest}, but this one tests with scope and collection support. */ -@IgnoreWhen(clusterTypes = { CAVES, MOCKED }, missesCapabilities = { QUERY, COLLECTIONS }) +@IgnoreWhen(clusterTypes = { CAVES, MOCKED }, + missesCapabilities = { QUERY, COLLECTIONS }, + clusterVersionIsBelow = REQUIRE_MB_50132) public class QueryCollectionsIndexManagerIntegrationTest extends JavaIntegrationTest { // time to allow for watch operations that are expected to succeed eventually @@ -87,9 +90,6 @@ static void setup() throws Exception { waitForService(bucket, ServiceType.QUERY); waitForQueryIndexerToHaveKeyspace(cluster, bucketName); - // Workaround for MB-50132 - Thread.sleep(3000); - bucket.collections().createScope(scopeName); bucket.collections().createCollection(CollectionSpec.create(collectionName, scopeName)); waitForQueryIndexerToHaveKeyspace(cluster, collectionName); diff --git a/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryIndexManagerIntegrationTest.java b/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryIndexManagerIntegrationTest.java index c2a39d389..f1a4ffb3f 100644 --- a/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryIndexManagerIntegrationTest.java +++ b/java-client/src/integrationTest/java/com/couchbase/client/java/manager/query/QueryIndexManagerIntegrationTest.java @@ -45,6 +45,7 @@ import static com.couchbase.client.java.manager.query.DropQueryIndexOptions.dropQueryIndexOptions; import static com.couchbase.client.java.manager.query.GetAllQueryIndexesOptions.getAllQueryIndexesOptions; import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.DISABLE_QUERY_TESTS_FOR_CLUSTER; +import static com.couchbase.client.java.manager.query.QueryIndexManagerIntegrationTest.REQUIRE_MB_50132; import static com.couchbase.client.java.manager.query.WatchQueryIndexesOptions.watchQueryIndexesOptions; import static com.couchbase.client.test.Capabilities.QUERY; import static com.couchbase.client.test.ClusterType.CAVES; @@ -58,12 +59,19 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -// Disabling against 5.5 as there appear to be several query bugs (SCBC-246, SCBC-251). Hardcoding 5.5.6 as that's -// the current 5.5-release and it's unlikely to change. -@IgnoreWhen(clusterTypes = {CAVES, MOCKED}, missesCapabilities = QUERY, clusterVersionEquals = DISABLE_QUERY_TESTS_FOR_CLUSTER) +@IgnoreWhen(clusterTypes = {CAVES, MOCKED}, + missesCapabilities = QUERY, + clusterVersionEquals = DISABLE_QUERY_TESTS_FOR_CLUSTER, + clusterVersionIsBelow = REQUIRE_MB_50132) public class QueryIndexManagerIntegrationTest extends JavaIntegrationTest { + // Disabling against 5.5 as there appear to be several query bugs (SCBC-246, SCBC-251). Hardcoding 5.5.6 as that's + // the current 5.5-release and it's unlikely to change. + // This is now often redundant with REQUIRE_MB_50132 - leaving for documentation purposes. public static final String DISABLE_QUERY_TESTS_FOR_CLUSTER = "5.5.6"; + // Any tests that are creating collections and require the indexer to be aware of those collections, needs MB-50132. + public static final String REQUIRE_MB_50132 = "7.1.0"; + // time to allow for watch operations that are expected to succeed eventually private static final Duration watchTimeout = Duration.ofSeconds(15); diff --git a/kotlin-client/src/integrationTest/kotlin/com/couchbase/client/kotlin/manager/query/QueryIndexManagerIntegrationTest.kt b/kotlin-client/src/integrationTest/kotlin/com/couchbase/client/kotlin/manager/query/QueryIndexManagerIntegrationTest.kt index a0494f48c..bccbfd430 100644 --- a/kotlin-client/src/integrationTest/kotlin/com/couchbase/client/kotlin/manager/query/QueryIndexManagerIntegrationTest.kt +++ b/kotlin-client/src/integrationTest/kotlin/com/couchbase/client/kotlin/manager/query/QueryIndexManagerIntegrationTest.kt @@ -48,12 +48,15 @@ import kotlin.time.Duration.Companion.seconds // Disabling against 5.5 as there appear to be several query bugs (SCBC-246, SCBC-251). Hardcoding 5.5.6 as that's // the current 5.5-release and it's unlikely to change. private const val DISABLE_QUERY_TESTS_FOR_CLUSTER = "5.5.6" +// See QueryIndexManagerIntegrationTest for explanation +private const val REQUIRE_MB_50132 = "7.1.0" private val watchTimeout = 15.seconds @IgnoreWhen( clusterTypes = [ClusterType.CAVES, ClusterType.MOCKED], missesCapabilities = [Capabilities.QUERY], clusterVersionEquals = DISABLE_QUERY_TESTS_FOR_CLUSTER, + clusterVersionIsBelow = REQUIRE_MB_50132 ) internal class QueryIndexManagerIntegrationTest : KotlinIntegrationTest() { private val indexes: QueryIndexManager by lazy { cluster.queryIndexes } diff --git a/scala-client/src/integrationTest/scala/com/couchbase/client/scala/manager/QueryIndexManagerSpec.scala b/scala-client/src/integrationTest/scala/com/couchbase/client/scala/manager/QueryIndexManagerSpec.scala index b19963a13..dfcc69c4b 100644 --- a/scala-client/src/integrationTest/scala/com/couchbase/client/scala/manager/QueryIndexManagerSpec.scala +++ b/scala-client/src/integrationTest/scala/com/couchbase/client/scala/manager/QueryIndexManagerSpec.scala @@ -27,6 +27,7 @@ import com.couchbase.client.core.service.ServiceType import com.couchbase.client.scala.manager.bucket.CreateBucketSettings import com.couchbase.client.scala.manager.collection.CollectionSpec import com.couchbase.client.scala.manager.query.{QueryIndex, QueryIndexManager} +import com.couchbase.client.scala.query.QuerySpec.RequireMB50132 import com.couchbase.client.scala.util.ScalaIntegrationTest import com.couchbase.client.scala.{Cluster, Collection, TestUtils} import com.couchbase.client.test._ @@ -44,7 +45,8 @@ import scala.util.{Failure, Success, Try} @TestInstance(Lifecycle.PER_CLASS) @IgnoreWhen( clusterTypes = Array(ClusterType.MOCKED), - missesCapabilities = Array(Capabilities.COLLECTIONS) + missesCapabilities = Array(Capabilities.COLLECTIONS), + clusterVersionIsBelow = RequireMB50132 ) class QueryIndexManagerSpec extends ScalaIntegrationTest { private var cluster: Cluster = _ @@ -458,8 +460,7 @@ class QueryIndexManagerSpec extends ScalaIntegrationTest { assert(cluster.reactive.queryIndexes.getAllIndexes(bucketName).collectSeq().block().size == 1) } - // Using SUBDOC_REVIVE_DOCUMENT to indicate 7.1 support as fix MB-50132 is required - @IgnoreWhen(missesCapabilities = Array(Capabilities.SUBDOC_REVIVE_DOCUMENT)) + @IgnoreWhen(clusterVersionIsBelow = RequireMB50132) @Test def createCollectionIndex(): Unit = { val indexName = "myCollectionIndex" @@ -491,8 +492,7 @@ class QueryIndexManagerSpec extends ScalaIntegrationTest { }) } - // Using SUBDOC_REVIVE_DOCUMENT to indicate 7.1 support as fix MB-50132 is required - @IgnoreWhen(missesCapabilities = Array(Capabilities.SUBDOC_REVIVE_DOCUMENT)) + @IgnoreWhen(clusterVersionIsBelow = RequireMB50132) @Test def dropCollectionIndex() = { val indexName = UUID.randomUUID().toString @@ -521,8 +521,7 @@ class QueryIndexManagerSpec extends ScalaIntegrationTest { assert(cluster.queryIndexes.getAllIndexes(config.bucketname()).get.isEmpty) } - // Using SUBDOC_REVIVE_DOCUMENT to indicate 7.1 support as fix MB-50132 is required - @IgnoreWhen(missesCapabilities = Array(Capabilities.SUBDOC_REVIVE_DOCUMENT)) + @IgnoreWhen(clusterVersionIsBelow = RequireMB50132) @Test def buildOneDeferredCollectionIndex() = { val indexName = UUID.randomUUID().toString diff --git a/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/QuerySpec.scala b/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/QuerySpec.scala index 209384003..27b28d174 100644 --- a/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/QuerySpec.scala +++ b/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/QuerySpec.scala @@ -25,6 +25,7 @@ import com.couchbase.client.scala.implicits.Codec import com.couchbase.client.scala.json.JsonObject import com.couchbase.client.scala.kv.MutationState import com.couchbase.client.scala.query.QueryScanConsistency.ConsistentWith +import com.couchbase.client.scala.query.QuerySpec.{DisableQueryTestsForCluster, RequireMB50132} import com.couchbase.client.scala.util.ScalaIntegrationTest import com.couchbase.client.scala.{Cluster, Collection, TestUtils} import com.couchbase.client.test.{Capabilities, IgnoreWhen, Util} @@ -39,7 +40,9 @@ import scala.util.{Failure, Success} // Disabling against 5.5. See comment on QueryIndexManagerIntegrationTest for details. @TestInstance(Lifecycle.PER_CLASS) -@IgnoreWhen(missesCapabilities = Array(Capabilities.QUERY), clusterVersionEquals = "5.5.6") +@IgnoreWhen(missesCapabilities = Array(Capabilities.QUERY), + clusterVersionEquals = DisableQueryTestsForCluster, + clusterVersionIsBelow = RequireMB50132) class QuerySpec extends ScalaIntegrationTest { private var cluster: Cluster = _ @@ -531,3 +534,9 @@ class QuerySpec extends ScalaIntegrationTest { assert(coll.get(docId).isFailure) } } + +object QuerySpec { + // See QueryIndexManagerIntegrationTest.java for explanation of these. + final val DisableQueryTestsForCluster = "5.5.6" + final val RequireMB50132 = "7.1.0" +} diff --git a/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/ScopeLevelQuerySpec.scala b/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/ScopeLevelQuerySpec.scala index 14979d421..2fdc59ba6 100644 --- a/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/ScopeLevelQuerySpec.scala +++ b/scala-client/src/integrationTest/scala/com/couchbase/client/scala/query/ScopeLevelQuerySpec.scala @@ -19,6 +19,7 @@ import com.couchbase.client.core.service.ServiceType import com.couchbase.client.scala.json.JsonObject import com.couchbase.client.scala.kv.MutationState import com.couchbase.client.scala.manager.collection.CollectionSpec +import com.couchbase.client.scala.query.QuerySpec.RequireMB50132 import com.couchbase.client.scala.util.ScalaIntegrationTest import com.couchbase.client.scala.{Cluster, Collection, Scope, TestUtils} import com.couchbase.client.test.{Capabilities, Flaky, IgnoreWhen, Util} @@ -30,7 +31,8 @@ import scala.util.{Failure, Success} @Disabled @Flaky @TestInstance(Lifecycle.PER_CLASS) -@IgnoreWhen(missesCapabilities = Array(Capabilities.QUERY, Capabilities.COLLECTIONS)) +@IgnoreWhen(missesCapabilities = Array(Capabilities.QUERY, Capabilities.COLLECTIONS), + clusterVersionIsBelow = RequireMB50132) class ScopeLevelQuerySpec extends ScalaIntegrationTest { private var cluster: Cluster = _