couchbase 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/couchbase/CMakeLists.txt +59 -7
- data/ext/couchbase/cmake/Documentation.cmake +0 -1
- data/ext/couchbase/cmake/OpenSSL.cmake +98 -3
- data/ext/couchbase/cmake/Testing.cmake +12 -4
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +4 -0
- data/ext/couchbase/cmake/build_config.hxx.in +3 -0
- data/ext/couchbase/core/bucket.cxx +3 -2
- data/ext/couchbase/core/bucket.hxx +9 -0
- data/ext/couchbase/core/cluster.hxx +17 -0
- data/ext/couchbase/core/cluster_options.cxx +2 -2
- data/ext/couchbase/core/cluster_options.hxx +4 -7
- data/ext/couchbase/core/{config_profile.cxx → cluster_options_fwd.hxx} +7 -6
- data/ext/couchbase/core/config_profile.hxx +2 -65
- data/ext/couchbase/core/config_profiles.cxx +79 -0
- data/ext/couchbase/core/config_profiles.hxx +56 -0
- data/ext/couchbase/core/error_context/search.hxx +1 -1
- data/ext/couchbase/core/impl/analytics.cxx +237 -0
- data/ext/couchbase/core/impl/boolean_field_query.cxx +40 -0
- data/ext/couchbase/core/impl/boolean_query.cxx +62 -0
- data/ext/couchbase/core/impl/cluster.cxx +2 -1
- data/ext/couchbase/core/impl/conjunction_query.cxx +51 -0
- data/ext/couchbase/core/impl/date_range.cxx +89 -0
- data/ext/couchbase/core/impl/date_range_facet.cxx +54 -0
- data/ext/couchbase/core/impl/date_range_facet_result.cxx +64 -0
- data/ext/couchbase/core/impl/date_range_query.cxx +125 -0
- data/ext/couchbase/core/impl/disjunction_query.cxx +51 -0
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +5 -3
- data/ext/couchbase/core/impl/encoded_search_facet.hxx +29 -0
- data/ext/couchbase/core/impl/encoded_search_query.hxx +29 -0
- data/ext/couchbase/core/impl/encoded_search_sort.hxx +29 -0
- data/ext/couchbase/core/impl/geo_bounding_box_query.cxx +46 -0
- data/ext/couchbase/core/impl/geo_distance_query.cxx +43 -0
- data/ext/couchbase/core/impl/geo_polygon_query.cxx +46 -0
- data/ext/couchbase/core/impl/internal_date_range_facet_result.cxx +80 -0
- data/ext/couchbase/core/impl/internal_date_range_facet_result.hxx +48 -0
- data/ext/couchbase/core/impl/internal_numeric_range_facet_result.cxx +80 -0
- data/ext/couchbase/core/impl/internal_numeric_range_facet_result.hxx +48 -0
- data/ext/couchbase/core/impl/internal_search_error_context.cxx +141 -0
- data/ext/couchbase/core/impl/internal_search_error_context.hxx +61 -0
- data/ext/couchbase/core/impl/internal_search_meta_data.cxx +60 -0
- data/ext/couchbase/core/impl/internal_search_meta_data.hxx +41 -0
- data/ext/couchbase/core/impl/internal_search_result.cxx +84 -0
- data/ext/couchbase/core/impl/internal_search_result.hxx +43 -0
- data/ext/couchbase/core/impl/internal_search_row.cxx +82 -0
- data/ext/couchbase/core/impl/internal_search_row.hxx +56 -0
- data/ext/couchbase/core/impl/internal_search_row_location.hxx +32 -0
- data/ext/couchbase/core/impl/internal_search_row_locations.cxx +137 -0
- data/ext/couchbase/core/impl/internal_search_row_locations.hxx +45 -0
- data/ext/couchbase/core/impl/internal_term_facet_result.cxx +80 -0
- data/ext/couchbase/core/impl/internal_term_facet_result.hxx +48 -0
- data/ext/couchbase/core/impl/match_all_query.cxx +35 -0
- data/ext/couchbase/core/impl/match_none_query.cxx +35 -0
- data/ext/couchbase/core/impl/match_phrase_query.cxx +43 -0
- data/ext/couchbase/core/impl/match_query.cxx +59 -0
- data/ext/couchbase/core/impl/numeric_range.cxx +49 -0
- data/ext/couchbase/core/impl/numeric_range_facet.cxx +54 -0
- data/ext/couchbase/core/impl/numeric_range_facet_result.cxx +64 -0
- data/ext/couchbase/core/impl/numeric_range_query.cxx +56 -0
- data/ext/couchbase/core/impl/phrase_query.cxx +42 -0
- data/ext/couchbase/core/impl/prefix_query.cxx +40 -0
- data/ext/couchbase/core/impl/query.cxx +5 -5
- data/ext/couchbase/core/impl/query_string_query.cxx +37 -0
- data/ext/couchbase/core/impl/regexp_query.cxx +40 -0
- data/ext/couchbase/core/impl/search.cxx +191 -0
- data/ext/couchbase/core/impl/search_error_context.cxx +147 -0
- data/ext/couchbase/core/impl/search_meta_data.cxx +46 -0
- data/ext/couchbase/core/impl/search_result.cxx +66 -0
- data/ext/couchbase/core/impl/search_row.cxx +74 -0
- data/ext/couchbase/core/impl/search_row_location.cxx +64 -0
- data/ext/couchbase/core/impl/search_row_locations.cxx +66 -0
- data/ext/couchbase/core/impl/search_sort_field.cxx +104 -0
- data/ext/couchbase/core/impl/search_sort_id.cxx +43 -0
- data/ext/couchbase/core/impl/search_sort_score.cxx +43 -0
- data/ext/couchbase/core/impl/term_facet.cxx +36 -0
- data/ext/couchbase/core/impl/term_facet_result.cxx +64 -0
- data/ext/couchbase/core/impl/term_query.cxx +56 -0
- data/ext/couchbase/core/impl/term_range_query.cxx +57 -0
- data/ext/couchbase/core/impl/wildcard_query.cxx +40 -0
- data/ext/couchbase/core/io/dns_client.cxx +225 -0
- data/ext/couchbase/core/io/dns_client.hxx +19 -188
- data/ext/couchbase/core/io/http_context.hxx +1 -1
- data/ext/couchbase/core/io/http_session.hxx +10 -0
- data/ext/couchbase/core/io/http_session_manager.hxx +5 -3
- data/ext/couchbase/core/io/mcbp_session.cxx +28 -1
- data/ext/couchbase/core/io/retry_orchestrator.hxx +3 -2
- data/ext/couchbase/core/json_string.hxx +5 -0
- data/ext/couchbase/core/meta/version.cxx +18 -4
- data/ext/couchbase/core/mozilla_ca_bundle.hxx +39 -0
- data/ext/couchbase/core/operations/document_analytics.cxx +1 -0
- data/ext/couchbase/core/operations/document_analytics.hxx +1 -0
- data/ext/couchbase/core/operations/document_append.hxx +1 -1
- data/ext/couchbase/core/operations/document_decrement.hxx +1 -1
- data/ext/couchbase/core/operations/document_exists.hxx +1 -1
- data/ext/couchbase/core/operations/document_get.hxx +1 -1
- data/ext/couchbase/core/operations/document_get_and_lock.hxx +1 -1
- data/ext/couchbase/core/operations/document_get_and_touch.hxx +1 -1
- data/ext/couchbase/core/operations/document_get_projected.hxx +1 -1
- data/ext/couchbase/core/operations/document_increment.hxx +1 -1
- data/ext/couchbase/core/operations/document_insert.hxx +1 -1
- data/ext/couchbase/core/operations/document_lookup_in.hxx +1 -1
- data/ext/couchbase/core/operations/document_mutate_in.hxx +1 -1
- data/ext/couchbase/core/operations/document_prepend.hxx +1 -1
- data/ext/couchbase/core/operations/document_query.cxx +2 -0
- data/ext/couchbase/core/operations/document_query.hxx +6 -0
- data/ext/couchbase/core/operations/document_remove.hxx +1 -1
- data/ext/couchbase/core/operations/document_replace.hxx +1 -1
- data/ext/couchbase/core/operations/document_search.cxx +4 -1
- data/ext/couchbase/core/operations/document_search.hxx +2 -1
- data/ext/couchbase/core/operations/document_touch.hxx +1 -1
- data/ext/couchbase/core/operations/document_unlock.hxx +1 -1
- data/ext/couchbase/core/operations/document_upsert.hxx +1 -1
- data/ext/couchbase/core/operations/document_view.hxx +1 -0
- data/ext/couchbase/core/protocol/client_request.hxx +11 -2
- data/ext/couchbase/core/public_fwd.hxx +21 -0
- data/ext/couchbase/core/tls_verify_mode.hxx +26 -0
- data/ext/couchbase/core/topology/configuration.cxx +15 -2
- data/ext/couchbase/core/topology/configuration.hxx +5 -1
- data/ext/couchbase/core/transactions/active_transaction_record.hxx +2 -2
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +3 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +1 -1
- data/ext/couchbase/core/transactions/attempt_context_testing_hooks.cxx +93 -0
- data/ext/couchbase/core/transactions/attempt_context_testing_hooks.hxx +48 -75
- data/ext/couchbase/core/transactions/cleanup_testing_hooks.cxx +52 -0
- data/ext/couchbase/core/transactions/cleanup_testing_hooks.hxx +17 -31
- data/ext/couchbase/core/transactions/exceptions.hxx +12 -9
- data/ext/couchbase/core/transactions/internal/transaction_context.hxx +12 -12
- data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
- data/ext/couchbase/core/transactions/transaction_context.cxx +1 -0
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
- data/ext/couchbase/core/utils/connection_string.cxx +27 -3
- data/ext/couchbase/core/utils/connection_string.hxx +3 -3
- data/ext/couchbase/core/utils/json.cxx +4 -1
- data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
- data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
- data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
- data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
- data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
- data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
- data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
- data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
- data/ext/couchbase/couchbase/behavior_options.hxx +10 -1
- data/ext/couchbase/couchbase/boolean_field_query.hxx +77 -0
- data/ext/couchbase/couchbase/boolean_query.hxx +223 -0
- data/ext/couchbase/couchbase/cluster.hxx +75 -1
- data/ext/couchbase/couchbase/conjunction_query.hxx +88 -0
- data/ext/couchbase/couchbase/date_range.hxx +69 -0
- data/ext/couchbase/couchbase/date_range_facet.hxx +56 -0
- data/ext/couchbase/couchbase/date_range_facet_result.hxx +55 -0
- data/ext/couchbase/couchbase/date_range_query.hxx +265 -0
- data/ext/couchbase/couchbase/disjunction_query.hxx +109 -0
- data/ext/couchbase/couchbase/doc_id_query.hxx +111 -0
- data/ext/couchbase/couchbase/error_context.hxx +7 -6
- data/ext/couchbase/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
- data/ext/couchbase/couchbase/fmt/analytics_status.hxx +76 -0
- data/ext/couchbase/couchbase/fmt/search_scan_consistency.hxx +49 -0
- data/ext/couchbase/couchbase/geo_bounding_box_query.hxx +107 -0
- data/ext/couchbase/couchbase/geo_distance_query.hxx +109 -0
- data/ext/couchbase/couchbase/geo_point.hxx +32 -0
- data/ext/couchbase/couchbase/geo_polygon_query.hxx +85 -0
- data/ext/couchbase/couchbase/highlight_style.hxx +45 -0
- data/ext/couchbase/couchbase/match_all_query.hxx +43 -0
- data/ext/couchbase/couchbase/match_none_query.hxx +43 -0
- data/ext/couchbase/couchbase/match_operator.hxx +45 -0
- data/ext/couchbase/couchbase/match_phrase_query.hxx +108 -0
- data/ext/couchbase/couchbase/match_query.hxx +163 -0
- data/ext/couchbase/couchbase/numeric_range.hxx +58 -0
- data/ext/couchbase/couchbase/numeric_range_facet.hxx +56 -0
- data/ext/couchbase/couchbase/numeric_range_facet_result.hxx +55 -0
- data/ext/couchbase/couchbase/numeric_range_query.hxx +143 -0
- data/ext/couchbase/couchbase/phrase_query.hxx +93 -0
- data/ext/couchbase/couchbase/prefix_query.hxx +82 -0
- data/ext/couchbase/couchbase/query_options.hxx +0 -1
- data/ext/couchbase/couchbase/query_string_query.hxx +72 -0
- data/ext/couchbase/couchbase/regexp_query.hxx +82 -0
- data/ext/couchbase/couchbase/scope.hxx +73 -0
- data/ext/couchbase/couchbase/search_date_range.hxx +68 -0
- data/ext/couchbase/couchbase/search_error_context.hxx +138 -0
- data/ext/couchbase/couchbase/search_facet.hxx +60 -0
- data/ext/couchbase/couchbase/search_facet_result.hxx +50 -0
- data/ext/couchbase/couchbase/search_meta_data.hxx +85 -0
- data/ext/couchbase/couchbase/search_metrics.hxx +127 -0
- data/ext/couchbase/couchbase/search_numeric_range.hxx +69 -0
- data/ext/couchbase/couchbase/search_options.hxx +509 -0
- data/ext/couchbase/couchbase/search_query.hxx +69 -0
- data/ext/couchbase/couchbase/search_result.hxx +77 -0
- data/ext/couchbase/couchbase/search_row.hxx +104 -0
- data/ext/couchbase/couchbase/search_row_location.hxx +55 -0
- data/ext/couchbase/couchbase/search_row_locations.hxx +86 -0
- data/ext/couchbase/couchbase/search_scan_consistency.hxx +34 -0
- data/ext/couchbase/couchbase/search_sort.hxx +58 -0
- data/ext/couchbase/couchbase/search_sort_field.hxx +117 -0
- data/ext/couchbase/couchbase/search_sort_field_missing.hxx +26 -0
- data/ext/couchbase/couchbase/search_sort_field_mode.hxx +27 -0
- data/ext/couchbase/couchbase/search_sort_field_type.hxx +28 -0
- data/ext/couchbase/couchbase/search_sort_id.hxx +60 -0
- data/ext/couchbase/couchbase/search_sort_score.hxx +60 -0
- data/ext/couchbase/couchbase/search_term_range.hxx +51 -0
- data/ext/couchbase/couchbase/security_options.hxx +3 -0
- data/ext/couchbase/couchbase/term_facet.hxx +48 -0
- data/ext/couchbase/couchbase/term_facet_result.hxx +55 -0
- data/ext/couchbase/couchbase/term_query.hxx +151 -0
- data/ext/couchbase/couchbase/term_range_query.hxx +142 -0
- data/ext/couchbase/couchbase/tracing/request_span.hxx +63 -0
- data/ext/couchbase/couchbase/tracing/request_tracer.hxx +2 -40
- data/ext/couchbase/couchbase/transactions/async_attempt_context.hxx +83 -4
- data/ext/couchbase/couchbase/transactions/attempt_context.hxx +68 -1
- data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +2 -0
- data/ext/couchbase/couchbase/transactions/transaction_keyspace.hxx +11 -1
- data/ext/couchbase/couchbase/transactions/transaction_options.hxx +79 -8
- data/ext/couchbase/couchbase/transactions/transaction_query_options.hxx +128 -15
- data/ext/couchbase/couchbase/transactions/transaction_query_result.hxx +4 -0
- data/ext/couchbase/couchbase/transactions/transaction_result.hxx +1 -1
- data/ext/couchbase/couchbase/transactions/transactions_cleanup_config.hxx +5 -3
- data/ext/couchbase/couchbase/transactions/transactions_config.hxx +9 -5
- data/ext/couchbase/couchbase/transactions/transactions_query_config.hxx +6 -3
- data/ext/couchbase/couchbase/transactions.hxx +34 -1
- data/ext/couchbase/couchbase/wildcard_query.hxx +83 -0
- data/ext/couchbase/test/CMakeLists.txt +8 -7
- data/ext/couchbase/test/benchmark_helper_integration.hxx +2 -2
- data/ext/couchbase/test/test_helper.hxx +6 -6
- data/ext/couchbase/test/test_integration_analytics.cxx +314 -16
- data/ext/couchbase/test/test_integration_collections.cxx +7 -3
- data/ext/couchbase/test/test_integration_connect.cxx +7 -3
- data/ext/couchbase/test/test_integration_crud.cxx +19 -2
- data/ext/couchbase/test/test_integration_diagnostics.cxx +11 -5
- data/ext/couchbase/test/test_integration_durability.cxx +12 -7
- data/ext/couchbase/test/test_integration_examples.cxx +324 -11
- data/ext/couchbase/test/test_integration_management.cxx +162 -94
- data/ext/couchbase/test/test_integration_query.cxx +68 -10
- data/ext/couchbase/test/test_integration_range_scan.cxx +12 -12
- data/ext/couchbase/test/test_integration_read_replica.cxx +48 -11
- data/ext/couchbase/test/test_integration_search.cxx +621 -0
- data/ext/couchbase/test/test_integration_subdoc.cxx +62 -11
- data/ext/couchbase/test/test_integration_tracer.cxx +5 -0
- data/ext/couchbase/test/test_integration_transcoders.cxx +13 -5
- data/ext/couchbase/test/{test_transaction_transaction_context.cxx → test_transaction_context.cxx} +1 -1
- data/ext/couchbase/test/test_transaction_examples.cxx +195 -0
- data/ext/couchbase/test/{test_transaction_transaction_simple.cxx → test_transaction_simple.cxx} +90 -5
- data/ext/couchbase/test/{test_transaction_transaction_simple_async.cxx → test_transaction_simple_async.cxx} +19 -21
- data/ext/couchbase/test/test_unit_config_profiles.cxx +13 -13
- data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
- data/ext/couchbase/test/test_unit_json_transcoder.cxx +4 -0
- data/ext/couchbase/test/test_unit_search.cxx +427 -0
- data/ext/couchbase/test/test_unit_transaction_utils.cxx +10 -1
- data/ext/couchbase/test/test_unit_utils.cxx +8 -4
- data/ext/couchbase/third_party/snappy/CMakeLists.txt +150 -27
- data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
- data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
- data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
- data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
- data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
- data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
- data/ext/couchbase/third_party/snappy/snappy.h +19 -4
- data/ext/couchbase.cxx +85 -22
- data/ext/revisions.rb +3 -3
- data/lib/couchbase/authenticator.rb +0 -1
- data/lib/couchbase/cluster.rb +13 -13
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/config_profiles.rb +1 -1
- data/lib/couchbase/configuration.rb +3 -4
- data/lib/couchbase/json_transcoder.rb +12 -5
- data/lib/couchbase/management/collection_query_index_manager.rb +54 -15
- data/lib/couchbase/management/query_index_manager.rb +70 -5
- data/lib/couchbase/options.rb +85 -2
- data/lib/couchbase/raw_binary_transcoder.rb +37 -0
- data/lib/couchbase/raw_json_transcoder.rb +38 -0
- data/lib/couchbase/raw_string_transcoder.rb +40 -0
- data/lib/couchbase/search_options.rb +163 -240
- data/lib/couchbase/transcoder_flags.rb +62 -0
- data/lib/couchbase/version.rb +1 -1
- metadata +151 -12
- data/ext/couchbase/core/CMakeLists.txt +0 -0
- /data/ext/couchbase/test/{test_transaction_transaction_public_async_api.cxx → test_transaction_public_async_api.cxx} +0 -0
- /data/ext/couchbase/test/{test_transaction_transaction_public_blocking_api.cxx → test_transaction_public_blocking_api.cxx} +0 -0
|
@@ -17,15 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
#include "core/operations/management/analytics.hxx"
|
|
19
19
|
#include "core/operations/management/collection_create.hxx"
|
|
20
|
-
#include "core/operations/management/
|
|
20
|
+
#include "core/operations/management/collections.hxx"
|
|
21
21
|
#include "test_helper_integration.hxx"
|
|
22
22
|
|
|
23
23
|
TEST_CASE("integration: analytics query")
|
|
24
24
|
{
|
|
25
25
|
test::utils::integration_test_guard integration;
|
|
26
26
|
|
|
27
|
+
if (integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
28
|
+
SKIP("elixir deployment does not support analytics");
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
if (!integration.cluster_version().supports_analytics()) {
|
|
28
|
-
|
|
32
|
+
SKIP("cluster does not support analytics");
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
@@ -78,7 +82,7 @@ TEST_CASE("integration: analytics query")
|
|
|
78
82
|
REQUIRE(test::utils::wait_until([&]() {
|
|
79
83
|
couchbase::core::operations::analytics_request req{};
|
|
80
84
|
req.statement = fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = ?)", dataset_name);
|
|
81
|
-
req.positional_parameters.emplace_back(couchbase::core::
|
|
85
|
+
req.positional_parameters.emplace_back(couchbase::core::utils::json::generate(test_value));
|
|
82
86
|
resp = test::utils::execute(integration.cluster, req);
|
|
83
87
|
return resp.rows.size() == 1;
|
|
84
88
|
}));
|
|
@@ -130,10 +134,30 @@ TEST_CASE("integration: analytics query")
|
|
|
130
134
|
|
|
131
135
|
SECTION("consistency")
|
|
132
136
|
{
|
|
133
|
-
couchbase::core::operations::
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
couchbase::core::operations::analytics_response resp{};
|
|
138
|
+
CHECK(test::utils::wait_until([&]() {
|
|
139
|
+
/*
|
|
140
|
+
* In consistency test, always do fresh mutation
|
|
141
|
+
*/
|
|
142
|
+
test_value = test::utils::uniq_id("value");
|
|
143
|
+
value = couchbase::core::utils::json::generate({ { "testkey", test_value } });
|
|
144
|
+
{
|
|
145
|
+
auto id = couchbase::core::document_id(integration.ctx.bucket, "_default", "_default", key);
|
|
146
|
+
couchbase::core::operations::upsert_request req{ id, couchbase::core::utils::to_binary(value) };
|
|
147
|
+
REQUIRE_SUCCESS(test::utils::execute(integration.cluster, req).ctx.ec());
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
couchbase::core::operations::analytics_request req{};
|
|
151
|
+
req.statement = fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = "{}")", dataset_name, test_value);
|
|
152
|
+
req.scan_consistency = couchbase::core::analytics_scan_consistency::request_plus;
|
|
153
|
+
resp = test::utils::execute(integration.cluster, req);
|
|
154
|
+
/* Analytics might give us code 23027, ignore it here
|
|
155
|
+
*
|
|
156
|
+
* "errors": [{"code": 23027, "msg": "Bucket default on link Default.Local is not connected"} ],
|
|
157
|
+
*/
|
|
158
|
+
return resp.ctx.first_error_code != 23027;
|
|
159
|
+
}));
|
|
160
|
+
|
|
137
161
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
138
162
|
REQUIRE(resp.rows.size() == 1);
|
|
139
163
|
REQUIRE(resp.rows[0] == value);
|
|
@@ -160,8 +184,15 @@ TEST_CASE("integration: analytics scope query")
|
|
|
160
184
|
{
|
|
161
185
|
test::utils::integration_test_guard integration;
|
|
162
186
|
|
|
163
|
-
if (
|
|
164
|
-
|
|
187
|
+
if (integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
188
|
+
SKIP("elixir deployment does not support analytics");
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!integration.cluster_version().supports_analytics()) {
|
|
192
|
+
SKIP("cluster does not support analytics");
|
|
193
|
+
}
|
|
194
|
+
if (!integration.cluster_version().supports_collections()) {
|
|
195
|
+
SKIP("cluster does not support collections");
|
|
165
196
|
}
|
|
166
197
|
|
|
167
198
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
@@ -185,13 +216,15 @@ TEST_CASE("integration: analytics scope query")
|
|
|
185
216
|
REQUIRE(created);
|
|
186
217
|
}
|
|
187
218
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
219
|
+
CHECK(test::utils::wait_until(
|
|
220
|
+
[&]() {
|
|
221
|
+
couchbase::core::operations::analytics_request req{};
|
|
222
|
+
req.statement =
|
|
223
|
+
fmt::format("ALTER COLLECTION `{}`.`{}`.`{}` ENABLE ANALYTICS", integration.ctx.bucket, scope_name, collection_name);
|
|
224
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
|
225
|
+
return !resp.ctx.ec;
|
|
226
|
+
},
|
|
227
|
+
std::chrono::minutes{ 5 }));
|
|
195
228
|
|
|
196
229
|
auto key = test::utils::uniq_id("key");
|
|
197
230
|
auto test_value = test::utils::uniq_id("value");
|
|
@@ -259,3 +292,268 @@ TEST_CASE("unit: analytics query")
|
|
|
259
292
|
REQUIRE(http_req.headers.find("analytics-priority") == http_req.headers.end());
|
|
260
293
|
}
|
|
261
294
|
}
|
|
295
|
+
|
|
296
|
+
TEST_CASE("integration: public API analytics query")
|
|
297
|
+
{
|
|
298
|
+
test::utils::integration_test_guard integration;
|
|
299
|
+
|
|
300
|
+
if (integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
301
|
+
SKIP("elixir deployment does not support analytics");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (!integration.cluster_version().supports_analytics()) {
|
|
305
|
+
SKIP("cluster does not support analytics");
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
auto cluster = couchbase::cluster(integration.cluster);
|
|
309
|
+
auto bucket = cluster.bucket(integration.ctx.bucket);
|
|
310
|
+
auto collection = bucket.default_collection();
|
|
311
|
+
|
|
312
|
+
auto dataset_name = test::utils::uniq_id("dataset");
|
|
313
|
+
|
|
314
|
+
{
|
|
315
|
+
couchbase::core::operations::management::analytics_dataset_create_request req{};
|
|
316
|
+
req.dataset_name = dataset_name;
|
|
317
|
+
req.bucket_name = integration.ctx.bucket;
|
|
318
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
|
319
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
{
|
|
323
|
+
couchbase::core::operations::management::analytics_link_connect_request req{};
|
|
324
|
+
req.force = true;
|
|
325
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
|
326
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
auto key = test::utils::uniq_id("key");
|
|
330
|
+
auto test_value = test::utils::uniq_id("value");
|
|
331
|
+
tao::json::value document = {
|
|
332
|
+
{ "testkey", test_value },
|
|
333
|
+
};
|
|
334
|
+
{
|
|
335
|
+
auto [ctx, resp] = collection.upsert(key, document).get();
|
|
336
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
SECTION("simple query")
|
|
340
|
+
{
|
|
341
|
+
couchbase::analytics_result resp{};
|
|
342
|
+
couchbase::analytics_error_context ctx{};
|
|
343
|
+
CHECK(test::utils::wait_until([&]() {
|
|
344
|
+
std::tie(ctx, resp) =
|
|
345
|
+
cluster.analytics_query(fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = "{}")", dataset_name, test_value))
|
|
346
|
+
.get();
|
|
347
|
+
return !ctx.ec() && resp.meta_data().metrics().result_count() == 1;
|
|
348
|
+
}));
|
|
349
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
350
|
+
REQUIRE_FALSE(resp.meta_data().request_id().empty());
|
|
351
|
+
REQUIRE_FALSE(resp.meta_data().client_context_id().empty());
|
|
352
|
+
REQUIRE(resp.meta_data().status() == couchbase::analytics_status::success);
|
|
353
|
+
auto rows = resp.rows_as_json();
|
|
354
|
+
REQUIRE(rows.size() == 1);
|
|
355
|
+
REQUIRE(rows[0] == document);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
SECTION("positional params")
|
|
359
|
+
{
|
|
360
|
+
couchbase::analytics_result resp{};
|
|
361
|
+
couchbase::analytics_error_context ctx{};
|
|
362
|
+
CHECK(test::utils::wait_until([&]() {
|
|
363
|
+
std::tie(ctx, resp) = cluster
|
|
364
|
+
.analytics_query(fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = ?)", dataset_name),
|
|
365
|
+
couchbase::analytics_options{}.positional_parameters(test_value))
|
|
366
|
+
.get();
|
|
367
|
+
return !ctx.ec() && resp.meta_data().metrics().result_count() == 1;
|
|
368
|
+
}));
|
|
369
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
370
|
+
auto rows = resp.rows_as_json();
|
|
371
|
+
REQUIRE(rows.size() == 1);
|
|
372
|
+
REQUIRE(rows[0] == document);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
SECTION("named params")
|
|
376
|
+
{
|
|
377
|
+
couchbase::analytics_result resp{};
|
|
378
|
+
couchbase::analytics_error_context ctx{};
|
|
379
|
+
CHECK(test::utils::wait_until([&]() {
|
|
380
|
+
std::tie(ctx, resp) =
|
|
381
|
+
cluster
|
|
382
|
+
.analytics_query(fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = $testkey)", dataset_name),
|
|
383
|
+
couchbase::analytics_options{}.named_parameters(std::pair{ "testkey", test_value }))
|
|
384
|
+
.get();
|
|
385
|
+
return !ctx.ec() && resp.meta_data().metrics().result_count() == 1;
|
|
386
|
+
}));
|
|
387
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
388
|
+
auto rows = resp.rows_as_json();
|
|
389
|
+
REQUIRE(rows.size() == 1);
|
|
390
|
+
REQUIRE(rows[0] == document);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
SECTION("named params preformatted")
|
|
394
|
+
{
|
|
395
|
+
couchbase::analytics_result resp{};
|
|
396
|
+
couchbase::analytics_error_context ctx{};
|
|
397
|
+
CHECK(test::utils::wait_until([&]() {
|
|
398
|
+
std::tie(ctx, resp) =
|
|
399
|
+
cluster
|
|
400
|
+
.analytics_query(fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = $testkey)", dataset_name),
|
|
401
|
+
couchbase::analytics_options{}.encoded_named_parameters(
|
|
402
|
+
{ { "testkey", couchbase::core::utils::json::generate_binary(test_value) } }))
|
|
403
|
+
.get();
|
|
404
|
+
return !ctx.ec() && resp.meta_data().metrics().result_count() == 1;
|
|
405
|
+
}));
|
|
406
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
407
|
+
auto rows = resp.rows_as_json();
|
|
408
|
+
REQUIRE(rows.size() == 1);
|
|
409
|
+
REQUIRE(rows[0] == document);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
SECTION("raw")
|
|
413
|
+
{
|
|
414
|
+
couchbase::analytics_result resp{};
|
|
415
|
+
couchbase::analytics_error_context ctx{};
|
|
416
|
+
CHECK(test::utils::wait_until([&]() {
|
|
417
|
+
std::tie(ctx, resp) =
|
|
418
|
+
cluster
|
|
419
|
+
.analytics_query(fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = $testkey)", dataset_name),
|
|
420
|
+
couchbase::analytics_options{}.raw("$testkey", test_value))
|
|
421
|
+
.get();
|
|
422
|
+
return !ctx.ec() && resp.meta_data().metrics().result_count() == 1;
|
|
423
|
+
}));
|
|
424
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
425
|
+
auto rows = resp.rows_as_json();
|
|
426
|
+
REQUIRE(rows.size() == 1);
|
|
427
|
+
REQUIRE(rows[0] == document);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
SECTION("consistency")
|
|
431
|
+
{
|
|
432
|
+
couchbase::analytics_result resp{};
|
|
433
|
+
couchbase::analytics_error_context ctx{};
|
|
434
|
+
CHECK(test::utils::wait_until([&]() {
|
|
435
|
+
/*
|
|
436
|
+
* In consistency test, always do fresh mutation
|
|
437
|
+
*/
|
|
438
|
+
test_value = test::utils::uniq_id("value");
|
|
439
|
+
document = {
|
|
440
|
+
{ "testkey", test_value },
|
|
441
|
+
};
|
|
442
|
+
{
|
|
443
|
+
auto [ctx2, _] = collection.upsert(key, document).get();
|
|
444
|
+
REQUIRE_SUCCESS(ctx2.ec());
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
std::tie(ctx, resp) =
|
|
448
|
+
cluster
|
|
449
|
+
.analytics_query(fmt::format(R"(SELECT testkey FROM `Default`.`{}` WHERE testkey = "{}")", dataset_name, test_value),
|
|
450
|
+
couchbase::analytics_options{}.scan_consistency(couchbase::analytics_scan_consistency::request_plus))
|
|
451
|
+
.get();
|
|
452
|
+
/* Analytics might give us code 23027, ignore it here
|
|
453
|
+
*
|
|
454
|
+
* "errors": [{"code": 23027, "msg": "Bucket default on link Default.Local is not connected"} ],
|
|
455
|
+
*/
|
|
456
|
+
return ctx.first_error_code() != 23027;
|
|
457
|
+
}));
|
|
458
|
+
|
|
459
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
460
|
+
auto rows = resp.rows_as_json();
|
|
461
|
+
REQUIRE(rows.size() == 1);
|
|
462
|
+
REQUIRE(rows[0] == document);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
SECTION("readonly")
|
|
466
|
+
{
|
|
467
|
+
auto [ctx, resp] =
|
|
468
|
+
cluster.analytics_query(fmt::format("DROP DATASET Default.`{}`", dataset_name), couchbase::analytics_options{}.readonly(true))
|
|
469
|
+
.get();
|
|
470
|
+
|
|
471
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::internal_server_failure);
|
|
472
|
+
REQUIRE(resp.meta_data().status() == couchbase::analytics_status::fatal);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
{
|
|
476
|
+
couchbase::core::operations::management::analytics_dataset_drop_request req{};
|
|
477
|
+
req.dataset_name = dataset_name;
|
|
478
|
+
test::utils::execute(integration.cluster, req);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
TEST_CASE("integration: public API analytics scope query")
|
|
483
|
+
{
|
|
484
|
+
test::utils::integration_test_guard integration;
|
|
485
|
+
|
|
486
|
+
if (integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
487
|
+
SKIP("elixir deployment does not support analytics");
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (!integration.cluster_version().supports_analytics()) {
|
|
491
|
+
SKIP("cluster does not support analytics");
|
|
492
|
+
}
|
|
493
|
+
if (!integration.cluster_version().supports_collections()) {
|
|
494
|
+
SKIP("cluster does not support collections");
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
auto cluster = couchbase::cluster(integration.cluster);
|
|
498
|
+
auto bucket = cluster.bucket(integration.ctx.bucket);
|
|
499
|
+
|
|
500
|
+
auto scope_name = test::utils::uniq_id("scope");
|
|
501
|
+
auto collection_name = test::utils::uniq_id("collection");
|
|
502
|
+
|
|
503
|
+
{
|
|
504
|
+
const couchbase::core::operations::management::scope_create_request req{ integration.ctx.bucket, scope_name };
|
|
505
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
|
506
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
507
|
+
auto created = test::utils::wait_until_collection_manifest_propagated(integration.cluster, integration.ctx.bucket, resp.uid);
|
|
508
|
+
REQUIRE(created);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
{
|
|
512
|
+
const couchbase::core::operations::management::collection_create_request req{ integration.ctx.bucket, scope_name, collection_name };
|
|
513
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
|
514
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
515
|
+
auto created = test::utils::wait_until_collection_manifest_propagated(integration.cluster, integration.ctx.bucket, resp.uid);
|
|
516
|
+
REQUIRE(created);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
CHECK(test::utils::wait_until(
|
|
520
|
+
[&]() {
|
|
521
|
+
auto [ctx, resp] = cluster
|
|
522
|
+
.analytics_query(fmt::format(
|
|
523
|
+
"ALTER COLLECTION `{}`.`{}`.`{}` ENABLE ANALYTICS", integration.ctx.bucket, scope_name, collection_name))
|
|
524
|
+
.get();
|
|
525
|
+
return !ctx.ec();
|
|
526
|
+
},
|
|
527
|
+
std::chrono::minutes{ 5 }));
|
|
528
|
+
|
|
529
|
+
auto scope = bucket.scope(scope_name);
|
|
530
|
+
auto collection = scope.collection(collection_name);
|
|
531
|
+
|
|
532
|
+
auto key = test::utils::uniq_id("key");
|
|
533
|
+
auto test_value = test::utils::uniq_id("value");
|
|
534
|
+
const tao::json::value document = {
|
|
535
|
+
{ "testkey", test_value },
|
|
536
|
+
};
|
|
537
|
+
{
|
|
538
|
+
auto [ctx, resp] = collection.upsert(key, document).get();
|
|
539
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
couchbase::analytics_result resp{};
|
|
543
|
+
couchbase::analytics_error_context ctx{};
|
|
544
|
+
CHECK(test::utils::wait_until([&]() {
|
|
545
|
+
std::tie(ctx, resp) =
|
|
546
|
+
scope.analytics_query(fmt::format(R"(SELECT testkey FROM `{}` WHERE testkey = "{}")", collection_name, test_value)).get();
|
|
547
|
+
return !ctx.ec() && resp.meta_data().metrics().result_count() == 1;
|
|
548
|
+
}));
|
|
549
|
+
REQUIRE_SUCCESS(ctx.ec());
|
|
550
|
+
REQUIRE(resp.rows_as_json()[0] == document);
|
|
551
|
+
REQUIRE_FALSE(resp.meta_data().request_id().empty());
|
|
552
|
+
REQUIRE_FALSE(resp.meta_data().client_context_id().empty());
|
|
553
|
+
REQUIRE(resp.meta_data().status() == couchbase::analytics_status::success);
|
|
554
|
+
|
|
555
|
+
{
|
|
556
|
+
const couchbase::core::operations::management::scope_drop_request req{ integration.ctx.bucket, scope_name };
|
|
557
|
+
test::utils::execute(integration.cluster, req);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
@@ -25,7 +25,7 @@ TEST_CASE("integration: missing scope and collection", "[integration]")
|
|
|
25
25
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
26
26
|
|
|
27
27
|
if (!integration.cluster_version().supports_collections()) {
|
|
28
|
-
|
|
28
|
+
SKIP("cluster does not support collections");
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
SECTION("get missing scope")
|
|
@@ -77,7 +77,7 @@ TEST_CASE("integration: get and insert non default scope and collection", "[inte
|
|
|
77
77
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
78
78
|
|
|
79
79
|
if (!integration.cluster_version().supports_collections()) {
|
|
80
|
-
|
|
80
|
+
SKIP("cluster does not support collections");
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
auto scope_name = test::utils::uniq_id("scope");
|
|
@@ -121,7 +121,7 @@ TEST_CASE("integration: insert into dropped scope", "[integration]")
|
|
|
121
121
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
122
122
|
|
|
123
123
|
if (!integration.cluster_version().supports_collections()) {
|
|
124
|
-
|
|
124
|
+
SKIP("cluster does not support collections");
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
auto scope_name = test::utils::uniq_id("scope");
|
|
@@ -166,6 +166,10 @@ TEST_CASE("integration: insert into dropped scope", "[integration]")
|
|
|
166
166
|
REQUIRE(dropped);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
if (integration.cluster_version().is_mock()) {
|
|
170
|
+
SKIP("GOCAVES does not generate error when inserting into dropped collection. See "
|
|
171
|
+
"https://github.com/couchbaselabs/gocaves/issues/108");
|
|
172
|
+
}
|
|
169
173
|
{
|
|
170
174
|
couchbase::core::operations::upsert_request req{ id, couchbase::core::utils::to_binary(key) };
|
|
171
175
|
auto resp = test::utils::execute(integration.cluster, req);
|
|
@@ -42,9 +42,9 @@ TEST_CASE("integration: connecting with unresponsive first node in bootstrap nod
|
|
|
42
42
|
test::utils::init_logger();
|
|
43
43
|
asio::io_context io{};
|
|
44
44
|
auto ctx = test::utils::test_context::load_from_environment();
|
|
45
|
-
if (ctx.deployment == test::utils::deployment_type::capella) {
|
|
45
|
+
if (ctx.deployment == test::utils::deployment_type::capella || ctx.deployment == test::utils::deployment_type::elixir) {
|
|
46
46
|
// This breaks SRV assumptions (only one host in connection string)
|
|
47
|
-
|
|
47
|
+
SKIP("capella deployment uses single host in the connection string, which assumed to be reachable");
|
|
48
48
|
}
|
|
49
49
|
auto connstr = couchbase::core::utils::parse_connection_string(ctx.connection_string);
|
|
50
50
|
REQUIRE_FALSE(connstr.bootstrap_nodes.empty());
|
|
@@ -125,6 +125,10 @@ TEST_CASE("integration: destroy cluster without waiting for close completion", "
|
|
|
125
125
|
test::utils::init_logger();
|
|
126
126
|
auto ctx = test::utils::test_context::load_from_environment();
|
|
127
127
|
|
|
128
|
+
if (ctx.deployment == test::utils::deployment_type::elixir) {
|
|
129
|
+
SKIP("elixir deployment is incompatible with parts of this test, but it is probably bug in SDK. FIXME");
|
|
130
|
+
}
|
|
131
|
+
|
|
128
132
|
asio::io_context io{};
|
|
129
133
|
|
|
130
134
|
auto cluster = couchbase::core::cluster::create(io);
|
|
@@ -143,7 +147,7 @@ TEST_CASE("integration: destroy cluster without waiting for close completion", "
|
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
// hit Query
|
|
146
|
-
{
|
|
150
|
+
if (ctx.version.supports_query()) {
|
|
147
151
|
couchbase::core::operations::query_request req{ R"(SELECT 42 AS the_answer)" };
|
|
148
152
|
auto resp = test::utils::execute(cluster, req);
|
|
149
153
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
@@ -35,6 +35,10 @@ TEST_CASE("integration: switching off mutation token", "[integration]")
|
|
|
35
35
|
opts.enable_mutation_tokens = false;
|
|
36
36
|
test::utils::integration_test_guard integration(opts);
|
|
37
37
|
|
|
38
|
+
if (integration.cluster_version().is_mock()) {
|
|
39
|
+
SKIP("GOCAVES does not allow to switching off mutation tokens. See https://github.com/couchbaselabs/gocaves/issues/100");
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
39
43
|
couchbase::core::document_id id{ integration.ctx.bucket, "_default", "_default", test::utils::uniq_id("foo") };
|
|
40
44
|
|
|
@@ -228,6 +232,10 @@ TEST_CASE("integration: pessimistic locking", "[integration]")
|
|
|
228
232
|
{
|
|
229
233
|
couchbase::core::operations::get_and_lock_request req{ id };
|
|
230
234
|
req.lock_time = lock_time;
|
|
235
|
+
if (integration.ctx.deployment == test::utils::deployment_type::capella ||
|
|
236
|
+
integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
237
|
+
req.timeout = std::chrono::seconds{ 2 };
|
|
238
|
+
}
|
|
231
239
|
auto resp = test::utils::execute(integration.cluster, req);
|
|
232
240
|
REQUIRE(resp.ctx.ec() == couchbase::errc::common::ambiguous_timeout);
|
|
233
241
|
REQUIRE(resp.ctx.retried_because_of(couchbase::retry_reason::key_value_locked));
|
|
@@ -486,7 +494,7 @@ TEST_CASE("integration: upsert preserve expiry", "[integration]")
|
|
|
486
494
|
test::utils::integration_test_guard integration;
|
|
487
495
|
|
|
488
496
|
if (!integration.cluster_version().supports_preserve_expiry()) {
|
|
489
|
-
|
|
497
|
+
SKIP("cluster does not support preserve expiry");
|
|
490
498
|
}
|
|
491
499
|
|
|
492
500
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
@@ -667,6 +675,10 @@ TEST_CASE("integration: open bucket that does not exist", "[integration]")
|
|
|
667
675
|
{
|
|
668
676
|
test::utils::integration_test_guard integration;
|
|
669
677
|
|
|
678
|
+
if (integration.cluster_version().is_mock()) {
|
|
679
|
+
SKIP("GOCAVES returns not_found (0x01) instead of no_access (0x24). See https://github.com/couchbaselabs/gocaves/issues/102");
|
|
680
|
+
}
|
|
681
|
+
|
|
670
682
|
auto bucket_name = test::utils::uniq_id("missing_bucket");
|
|
671
683
|
|
|
672
684
|
auto barrier = std::make_shared<std::promise<std::error_code>>();
|
|
@@ -810,7 +822,12 @@ TEST_CASE("integration: pessimistic locking with public API", "[integration]")
|
|
|
810
822
|
|
|
811
823
|
// it is not allowed to lock the same key twice
|
|
812
824
|
{
|
|
813
|
-
|
|
825
|
+
couchbase::get_and_lock_options options{};
|
|
826
|
+
if (integration.ctx.deployment == test::utils::deployment_type::capella ||
|
|
827
|
+
integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
828
|
+
options.timeout(std::chrono::seconds{ 2 });
|
|
829
|
+
}
|
|
830
|
+
auto [ctx, resp] = collection.get_and_lock(id, lock_time, options).get();
|
|
814
831
|
REQUIRE(ctx.ec() == couchbase::errc::common::ambiguous_timeout);
|
|
815
832
|
REQUIRE(ctx.retried_because_of(couchbase::retry_reason::key_value_locked));
|
|
816
833
|
}
|
|
@@ -321,14 +321,18 @@ TEST_CASE("integration: fetch diagnostics after N1QL query", "[integration]")
|
|
|
321
321
|
{
|
|
322
322
|
test::utils::integration_test_guard integration;
|
|
323
323
|
|
|
324
|
+
if (!integration.cluster_version().supports_query() || integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
|
325
|
+
SKIP("cluster does not support query or cluster level query");
|
|
326
|
+
}
|
|
327
|
+
|
|
324
328
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
325
329
|
{
|
|
326
330
|
couchbase::core::operations::query_request req{ "SELECT 'hello, couchbase' AS greetings" };
|
|
327
331
|
auto resp = test::utils::execute(integration.cluster, req);
|
|
328
332
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
329
|
-
INFO("rows.size() =" << resp.rows.size())
|
|
333
|
+
INFO("rows.size() =" << resp.rows.size());
|
|
330
334
|
REQUIRE(resp.rows.size() == 1);
|
|
331
|
-
INFO("row=" << resp.rows[0])
|
|
335
|
+
INFO("row=" << resp.rows[0]);
|
|
332
336
|
REQUIRE(resp.rows[0] == R"({"greetings":"hello, couchbase"})");
|
|
333
337
|
}
|
|
334
338
|
{
|
|
@@ -365,8 +369,10 @@ TEST_CASE("integration: ping", "[integration]")
|
|
|
365
369
|
REQUIRE(res.services.count(couchbase::core::service_type::management) > 0);
|
|
366
370
|
REQUIRE(res.services[couchbase::core::service_type::management].size() > 0);
|
|
367
371
|
|
|
368
|
-
|
|
369
|
-
|
|
372
|
+
if (integration.ctx.deployment != test::utils::deployment_type::elixir) {
|
|
373
|
+
REQUIRE(res.services.count(couchbase::core::service_type::view) > 0);
|
|
374
|
+
REQUIRE(res.services[couchbase::core::service_type::view].size() > 0);
|
|
375
|
+
}
|
|
370
376
|
|
|
371
377
|
REQUIRE(res.services.count(couchbase::core::service_type::query) > 0);
|
|
372
378
|
REQUIRE(res.services[couchbase::core::service_type::query].size() > 0);
|
|
@@ -385,7 +391,7 @@ TEST_CASE("integration: ping", "[integration]")
|
|
|
385
391
|
}
|
|
386
392
|
|
|
387
393
|
REQUIRE(res.id == "my_report_id");
|
|
388
|
-
INFO(res.sdk)
|
|
394
|
+
INFO(res.sdk);
|
|
389
395
|
REQUIRE(res.sdk.find("cxx/") == 0);
|
|
390
396
|
}
|
|
391
397
|
}
|
|
@@ -25,7 +25,7 @@ TEST_CASE("integration: durable operations", "[integration]")
|
|
|
25
25
|
{
|
|
26
26
|
test::utils::integration_test_guard integration;
|
|
27
27
|
if (!integration.cluster_version().supports_enhanced_durability()) {
|
|
28
|
-
|
|
28
|
+
SKIP("cluster does not support enhanced durability");
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
@@ -68,7 +68,7 @@ TEST_CASE("integration: durable operations", "[integration]")
|
|
|
68
68
|
auto resp = test::utils::execute(integration.cluster, req);
|
|
69
69
|
REQUIRE_SUCCESS(resp.ctx.ec());
|
|
70
70
|
REQUIRE(!resp.cas.empty());
|
|
71
|
-
REQUIRE(resp.value == couchbase::core::utils::
|
|
71
|
+
REQUIRE(couchbase::core::utils::json::parse_binary(resp.value) == couchbase::core::utils::json::parse(R"({"foo":"bar","baz":42})"));
|
|
72
72
|
}
|
|
73
73
|
{
|
|
74
74
|
couchbase::core::operations::remove_request req{ id };
|
|
@@ -83,8 +83,13 @@ TEST_CASE("integration: durable operations", "[integration]")
|
|
|
83
83
|
TEST_CASE("integration: legacy durability persist to active and replicate to one", "[integration]")
|
|
84
84
|
{
|
|
85
85
|
test::utils::integration_test_guard integration;
|
|
86
|
-
if (integration.number_of_replicas() == 0
|
|
87
|
-
|
|
86
|
+
if (integration.number_of_replicas() == 0) {
|
|
87
|
+
SKIP("bucket has zero replicas");
|
|
88
|
+
}
|
|
89
|
+
if (integration.number_of_nodes() <= integration.number_of_replicas()) {
|
|
90
|
+
SKIP(fmt::format("number of nodes ({}) is less or equal to number of replicas ({})",
|
|
91
|
+
integration.number_of_nodes(),
|
|
92
|
+
integration.number_of_replicas()));
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
@@ -124,7 +129,7 @@ TEST_CASE("integration: low level legacy durability impossible if number of node
|
|
|
124
129
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
125
130
|
|
|
126
131
|
if (integration.number_of_replicas() == 3) {
|
|
127
|
-
|
|
132
|
+
SKIP("bucket has three replicas configured, so the test will not be applicable");
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
couchbase::core::document_id id{ integration.ctx.bucket, "_default", "_default", test::utils::uniq_id("foo") };
|
|
@@ -159,7 +164,7 @@ TEST_CASE("integration: low level legacy durability persist to active and replic
|
|
|
159
164
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
|
160
165
|
|
|
161
166
|
if (integration.number_of_replicas() < 1) {
|
|
162
|
-
|
|
167
|
+
SKIP("bucket does not have replicas configured");
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
couchbase::core::document_id id{ integration.ctx.bucket, "_default", "_default", test::utils::uniq_id("foo") };
|
|
@@ -211,7 +216,7 @@ TEST_CASE("integration: low level legacy durability persist to active and replic
|
|
|
211
216
|
auto resp = test::utils::execute(integration.cluster, req);
|
|
212
217
|
REQUIRE_SUCCESS(resp.ctx.ec());
|
|
213
218
|
REQUIRE(!resp.cas.empty());
|
|
214
|
-
REQUIRE(resp.value == couchbase::core::utils::
|
|
219
|
+
REQUIRE(couchbase::core::utils::json::parse_binary(resp.value) == couchbase::core::utils::json::parse(R"({"foo":"bar","baz":42})"));
|
|
215
220
|
}
|
|
216
221
|
{
|
|
217
222
|
couchbase::core::operations::remove_request_with_legacy_durability req{
|