couchbase 3.4.2 → 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/couchbase/CMakeLists.txt +71 -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/build_config.hxx.in +3 -0
- data/ext/couchbase/core/bucket.cxx +183 -151
- data/ext/couchbase/core/bucket.hxx +23 -1
- data/ext/couchbase/core/cluster.hxx +51 -13
- data/ext/couchbase/core/cluster_options.cxx +2 -2
- data/ext/couchbase/core/cluster_options.hxx +7 -6
- data/ext/couchbase/core/cluster_options_fwd.hxx +26 -0
- data/ext/couchbase/core/config_profile.hxx +1 -54
- data/ext/couchbase/core/config_profiles.cxx +79 -0
- data/ext/couchbase/core/config_profiles.hxx +56 -0
- data/ext/couchbase/core/crud_component.cxx +51 -22
- data/ext/couchbase/core/error_context/key_value.cxx +2 -1
- data/ext/couchbase/core/error_context/key_value.hxx +10 -12
- data/ext/couchbase/core/error_context/search.hxx +1 -1
- data/ext/couchbase/core/impl/analytics.cxx +1 -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/build_deferred_query_indexes.cxx +115 -50
- data/ext/couchbase/core/impl/cluster.cxx +8 -0
- data/ext/couchbase/core/impl/conjunction_query.cxx +51 -0
- data/ext/couchbase/core/impl/create_bucket.cxx +155 -0
- data/ext/couchbase/core/impl/create_query_index.cxx +172 -59
- 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 +2 -1
- data/ext/couchbase/core/impl/drop_bucket.cxx +66 -0
- data/ext/couchbase/core/impl/drop_query_index.cxx +138 -59
- 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/flush_bucket.cxx +66 -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/get_all_buckets.cxx +163 -0
- data/ext/couchbase/core/impl/get_all_query_indexes.cxx +67 -37
- data/ext/couchbase/core/impl/get_bucket.cxx +153 -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_manager_error_context.cxx +113 -0
- data/ext/couchbase/core/impl/internal_manager_error_context.hxx +60 -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/key_value_error_category.cxx +2 -4
- data/ext/couchbase/core/impl/key_value_error_context.cxx +98 -0
- data/ext/couchbase/core/impl/lookup_in.cxx +1 -0
- data/ext/couchbase/core/impl/lookup_in_all_replicas.cxx +176 -0
- data/ext/couchbase/core/impl/lookup_in_all_replicas.hxx +80 -0
- data/ext/couchbase/core/impl/lookup_in_any_replica.cxx +167 -0
- data/ext/couchbase/core/impl/lookup_in_any_replica.hxx +75 -0
- data/ext/couchbase/core/impl/lookup_in_replica.cxx +97 -0
- data/ext/couchbase/core/impl/lookup_in_replica.hxx +67 -0
- data/ext/couchbase/core/impl/manager_error_context.cxx +100 -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 +1 -0
- data/ext/couchbase/core/impl/query_error_context.cxx +75 -0
- 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/update_bucket.cxx +130 -0
- data/ext/couchbase/core/impl/watch_query_indexes.cxx +53 -29
- data/ext/couchbase/core/impl/wildcard_query.cxx +40 -0
- data/ext/couchbase/core/io/dns_client.cxx +111 -40
- data/ext/couchbase/core/io/dns_config.cxx +5 -4
- data/ext/couchbase/core/io/http_context.hxx +1 -1
- data/ext/couchbase/core/io/http_session.hxx +34 -1
- data/ext/couchbase/core/io/http_session_manager.hxx +5 -3
- data/ext/couchbase/core/io/mcbp_command.hxx +9 -2
- data/ext/couchbase/core/io/mcbp_session.cxx +106 -42
- data/ext/couchbase/core/io/mcbp_session.hxx +4 -3
- data/ext/couchbase/core/io/retry_orchestrator.hxx +3 -2
- data/ext/couchbase/core/json_string.hxx +5 -0
- data/ext/couchbase/core/logger/custom_rotating_file_sink.cxx +1 -1
- data/ext/couchbase/core/logger/logger.cxx +80 -20
- data/ext/couchbase/core/logger/logger.hxx +31 -0
- data/ext/couchbase/core/meta/features.hxx +25 -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_lookup_in_all_replicas.hxx +192 -0
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +188 -0
- 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 +13 -0
- data/ext/couchbase/core/operations/document_query.hxx +7 -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/operations.hxx +2 -0
- data/ext/couchbase/core/origin.cxx +270 -0
- data/ext/couchbase/core/origin.hxx +2 -0
- data/ext/couchbase/core/protocol/client_request.hxx +11 -2
- data/ext/couchbase/core/protocol/client_response.hxx +1 -0
- data/ext/couchbase/core/protocol/cmd_hello.hxx +1 -0
- data/ext/couchbase/core/protocol/cmd_lookup_in_replica.cxx +107 -0
- data/ext/couchbase/core/protocol/cmd_lookup_in_replica.hxx +137 -0
- data/ext/couchbase/core/protocol/hello_feature.hxx +6 -0
- data/ext/couchbase/core/protocol/hello_feature_fmt.hxx +3 -0
- data/ext/couchbase/core/protocol/status.cxx +2 -2
- data/ext/couchbase/core/public_fwd.hxx +21 -0
- data/ext/couchbase/core/range_scan_options.cxx +3 -27
- data/ext/couchbase/core/range_scan_options.hxx +13 -17
- data/ext/couchbase/core/range_scan_orchestrator.cxx +388 -170
- data/ext/couchbase/core/range_scan_orchestrator.hxx +13 -2
- data/ext/couchbase/core/range_scan_orchestrator_options.hxx +5 -3
- data/ext/couchbase/core/scan_options.hxx +0 -19
- data/ext/couchbase/core/scan_result.cxx +19 -5
- data/ext/couchbase/core/scan_result.hxx +5 -2
- data/ext/couchbase/core/timeout_defaults.hxx +2 -3
- data/ext/couchbase/core/tls_verify_mode.hxx +26 -0
- data/ext/couchbase/core/topology/capabilities.hxx +3 -0
- data/ext/couchbase/core/topology/capabilities_fmt.hxx +8 -0
- data/ext/couchbase/core/topology/collections_manifest_fmt.hxx +1 -1
- data/ext/couchbase/core/topology/configuration.cxx +15 -2
- data/ext/couchbase/core/topology/configuration.hxx +20 -1
- data/ext/couchbase/core/topology/configuration_json.hxx +6 -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/utils/connection_string.cxx +75 -43
- data/ext/couchbase/core/utils/connection_string.hxx +1 -0
- data/ext/couchbase/core/utils/json.cxx +4 -1
- data/ext/couchbase/couchbase/analytics_error_context.hxx +1 -1
- data/ext/couchbase/couchbase/behavior_options.hxx +27 -1
- data/ext/couchbase/couchbase/boolean_field_query.hxx +77 -0
- data/ext/couchbase/couchbase/boolean_query.hxx +223 -0
- data/ext/couchbase/couchbase/bucket_manager.hxx +135 -0
- data/ext/couchbase/couchbase/build_query_index_options.hxx +0 -30
- data/ext/couchbase/couchbase/cluster.hxx +56 -1
- data/ext/couchbase/couchbase/collection.hxx +111 -0
- data/ext/couchbase/couchbase/collection_query_index_manager.hxx +7 -48
- data/ext/couchbase/couchbase/conjunction_query.hxx +88 -0
- data/ext/couchbase/couchbase/create_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/create_primary_query_index_options.hxx +0 -29
- data/ext/couchbase/couchbase/create_query_index_options.hxx +0 -33
- 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/drop_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/drop_primary_query_index_options.hxx +0 -30
- data/ext/couchbase/couchbase/drop_query_index_options.hxx +0 -31
- data/ext/couchbase/couchbase/error_codes.hxx +1 -2
- data/ext/couchbase/couchbase/error_context.hxx +17 -8
- data/ext/couchbase/couchbase/flush_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
- data/ext/couchbase/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
- 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/get_all_buckets_options.hxx +44 -0
- data/ext/couchbase/couchbase/get_all_query_indexes_options.hxx +0 -30
- data/ext/couchbase/couchbase/get_and_lock_options.hxx +2 -2
- data/ext/couchbase/couchbase/get_and_touch_options.hxx +2 -2
- data/ext/couchbase/couchbase/get_bucket_options.hxx +43 -0
- data/ext/couchbase/couchbase/get_options.hxx +2 -2
- data/ext/couchbase/couchbase/highlight_style.hxx +45 -0
- data/ext/couchbase/couchbase/insert_options.hxx +3 -3
- data/ext/couchbase/couchbase/key_value_error_context.hxx +7 -2
- data/ext/couchbase/couchbase/lookup_in_all_replicas_options.hxx +109 -0
- data/ext/couchbase/couchbase/lookup_in_any_replica_options.hxx +101 -0
- data/ext/couchbase/couchbase/lookup_in_options.hxx +2 -2
- data/ext/couchbase/couchbase/lookup_in_replica_result.hxx +74 -0
- data/ext/couchbase/couchbase/lookup_in_result.hxx +26 -0
- data/ext/couchbase/couchbase/management/bucket_settings.hxx +116 -0
- data/ext/couchbase/couchbase/manager_error_context.hxx +29 -53
- 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/mutate_in_options.hxx +2 -2
- 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_error_context.hxx +3 -1
- data/ext/couchbase/couchbase/query_index_manager.hxx +16 -83
- data/ext/couchbase/couchbase/query_options.hxx +18 -0
- data/ext/couchbase/couchbase/query_string_query.hxx +72 -0
- data/ext/couchbase/couchbase/regexp_query.hxx +82 -0
- data/ext/couchbase/couchbase/remove_options.hxx +2 -2
- data/ext/couchbase/couchbase/replace_options.hxx +3 -3
- data/ext/couchbase/couchbase/scope.hxx +40 -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 +18 -0
- data/ext/couchbase/couchbase/subdocument_error_context.hxx +4 -2
- 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/touch_options.hxx +2 -2
- 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 +67 -0
- 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/unlock_options.hxx +2 -2
- data/ext/couchbase/couchbase/update_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/upsert_options.hxx +3 -3
- data/ext/couchbase/couchbase/watch_query_indexes_options.hxx +0 -31
- data/ext/couchbase/couchbase/wildcard_query.hxx +83 -0
- data/ext/couchbase/test/CMakeLists.txt +8 -5
- data/ext/couchbase/test/benchmark_helper_integration.hxx +2 -2
- data/ext/couchbase/test/test_helper.hxx +5 -5
- data/ext/couchbase/test/test_integration_analytics.cxx +28 -6
- data/ext/couchbase/test/test_integration_collections.cxx +13 -3
- data/ext/couchbase/test/test_integration_connect.cxx +7 -3
- data/ext/couchbase/test/test_integration_crud.cxx +18 -3
- 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 +419 -11
- data/ext/couchbase/test/test_integration_management.cxx +867 -368
- data/ext/couchbase/test/test_integration_query.cxx +87 -17
- data/ext/couchbase/test/test_integration_range_scan.cxx +363 -124
- data/ext/couchbase/test/test_integration_read_replica.cxx +48 -11
- data/ext/couchbase/test/test_integration_search.cxx +32 -3
- data/ext/couchbase/test/test_integration_subdoc.cxx +717 -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_public_async_api.cxx → test_transaction_public_async_api.cxx} +13 -12
- data/ext/couchbase/test/{test_transaction_transaction_public_blocking_api.cxx → test_transaction_public_blocking_api.cxx} +27 -21
- data/ext/couchbase/test/{test_transaction_transaction_simple.cxx → test_transaction_simple.cxx} +17 -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 +1 -1
- data/ext/couchbase/test/test_unit_connection_string.cxx +29 -0
- data/ext/couchbase/test/test_unit_json_transcoder.cxx +4 -0
- data/ext/couchbase/test/test_unit_query.cxx +75 -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.cxx +641 -45
- data/ext/revisions.rb +3 -3
- data/lib/couchbase/authenticator.rb +0 -1
- data/lib/couchbase/cluster.rb +1 -5
- data/lib/couchbase/collection.rb +108 -0
- data/lib/couchbase/collection_options.rb +100 -0
- data/lib/couchbase/config_profiles.rb +1 -1
- data/lib/couchbase/errors.rb +5 -0
- data/lib/couchbase/json_transcoder.rb +12 -5
- data/lib/couchbase/key_value_scan.rb +125 -0
- 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 +151 -0
- 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/scope.rb +1 -1
- data/lib/couchbase/search_options.rb +5 -0
- data/lib/couchbase/transcoder_flags.rb +62 -0
- data/lib/couchbase/utils/time.rb +14 -1
- data/lib/couchbase/version.rb +1 -1
- metadata +175 -13
- data/ext/couchbase/core/config_profile.cxx +0 -47
- data/ext/couchbase/core/impl/collection_query_index_manager.cxx +0 -93
@@ -17,6 +17,8 @@
|
|
17
17
|
|
18
18
|
#include "test_helper_integration.hxx"
|
19
19
|
|
20
|
+
#include <catch2/catch_approx.hpp>
|
21
|
+
|
20
22
|
#include "core/management/analytics_link.hxx"
|
21
23
|
#include "core/operations/management/analytics.hxx"
|
22
24
|
#include "core/operations/management/bucket.hxx"
|
@@ -32,6 +34,8 @@
|
|
32
34
|
#include "couchbase/drop_query_index_options.hxx"
|
33
35
|
#include "couchbase/watch_query_indexes_options.hxx"
|
34
36
|
|
37
|
+
using Catch::Approx;
|
38
|
+
|
35
39
|
static couchbase::core::operations::management::bucket_get_response
|
36
40
|
wait_for_bucket_created(test::utils::integration_test_guard& integration, const std::string& bucket_name)
|
37
41
|
{
|
@@ -59,7 +63,7 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
59
63
|
test::utils::integration_test_guard integration;
|
60
64
|
|
61
65
|
if (!integration.cluster_version().supports_bucket_management()) {
|
62
|
-
|
66
|
+
SKIP("cluster does not support bucket management");
|
63
67
|
}
|
64
68
|
|
65
69
|
if (!integration.cluster_version().supports_gcccp()) {
|
@@ -70,244 +74,555 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
70
74
|
|
71
75
|
SECTION("crud")
|
72
76
|
{
|
73
|
-
|
74
|
-
bucket_settings.name = bucket_name;
|
75
|
-
bucket_settings.ram_quota_mb = 100;
|
76
|
-
bucket_settings.num_replicas = 1;
|
77
|
-
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::couchbase;
|
78
|
-
bucket_settings.eviction_policy = couchbase::core::management::cluster::bucket_eviction_policy::value_only;
|
79
|
-
bucket_settings.flush_enabled = true;
|
80
|
-
if (integration.cluster_version().is_enterprise()) {
|
81
|
-
bucket_settings.max_expiry = 10;
|
82
|
-
bucket_settings.compression_mode = couchbase::core::management::cluster::bucket_compression::active;
|
83
|
-
}
|
84
|
-
bucket_settings.replica_indexes = true;
|
85
|
-
bucket_settings.conflict_resolution_type = couchbase::core::management::cluster::bucket_conflict_resolution::sequence_number;
|
86
|
-
|
77
|
+
SECTION("core API")
|
87
78
|
{
|
88
|
-
couchbase::core::
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
79
|
+
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
80
|
+
bucket_settings.name = bucket_name;
|
81
|
+
bucket_settings.ram_quota_mb = 100;
|
82
|
+
bucket_settings.num_replicas = 1;
|
83
|
+
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::couchbase;
|
84
|
+
bucket_settings.eviction_policy = couchbase::core::management::cluster::bucket_eviction_policy::value_only;
|
85
|
+
bucket_settings.flush_enabled = true;
|
86
|
+
if (integration.cluster_version().is_enterprise()) {
|
87
|
+
bucket_settings.max_expiry = 10;
|
88
|
+
bucket_settings.compression_mode = couchbase::core::management::cluster::bucket_compression::active;
|
89
|
+
}
|
90
|
+
bucket_settings.replica_indexes = true;
|
91
|
+
bucket_settings.conflict_resolution_type = couchbase::core::management::cluster::bucket_conflict_resolution::sequence_number;
|
92
|
+
{
|
93
|
+
couchbase::core::operations::management::bucket_create_request req;
|
94
|
+
req.bucket = bucket_settings;
|
95
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
96
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
97
|
+
}
|
93
98
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
99
|
+
{
|
100
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
101
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
102
|
+
REQUIRE(bucket_settings.bucket_type == resp.bucket.bucket_type);
|
103
|
+
REQUIRE(bucket_settings.name == resp.bucket.name);
|
104
|
+
REQUIRE(Approx(bucket_settings.ram_quota_mb).margin(5) == resp.bucket.ram_quota_mb);
|
105
|
+
REQUIRE(bucket_settings.num_replicas == resp.bucket.num_replicas);
|
106
|
+
REQUIRE(bucket_settings.flush_enabled == resp.bucket.flush_enabled);
|
107
|
+
REQUIRE(bucket_settings.max_expiry == resp.bucket.max_expiry);
|
108
|
+
REQUIRE(bucket_settings.eviction_policy == resp.bucket.eviction_policy);
|
109
|
+
REQUIRE(bucket_settings.compression_mode == resp.bucket.compression_mode);
|
110
|
+
REQUIRE(bucket_settings.replica_indexes == resp.bucket.replica_indexes);
|
111
|
+
}
|
112
|
+
std::uint64_t old_quota_mb{ 0 };
|
113
|
+
{
|
114
|
+
couchbase::core::operations::management::bucket_get_all_request req{};
|
115
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
116
|
+
INFO(resp.ctx.http_body);
|
117
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
118
|
+
bool found = false;
|
119
|
+
for (const auto& bucket : resp.buckets) {
|
120
|
+
if (bucket.name != bucket_name) {
|
121
|
+
continue;
|
122
|
+
}
|
123
|
+
found = true;
|
124
|
+
REQUIRE(bucket_settings.bucket_type == bucket.bucket_type);
|
125
|
+
REQUIRE(bucket_settings.name == bucket.name);
|
126
|
+
REQUIRE(bucket_settings.ram_quota_mb == bucket.ram_quota_mb);
|
127
|
+
old_quota_mb = bucket_settings.ram_quota_mb;
|
128
|
+
REQUIRE(bucket_settings.num_replicas == bucket.num_replicas);
|
129
|
+
REQUIRE(bucket_settings.flush_enabled == bucket.flush_enabled);
|
130
|
+
REQUIRE(bucket_settings.max_expiry == bucket.max_expiry);
|
131
|
+
REQUIRE(bucket_settings.eviction_policy == bucket.eviction_policy);
|
132
|
+
REQUIRE(bucket_settings.compression_mode == bucket.compression_mode);
|
133
|
+
REQUIRE(bucket_settings.replica_indexes == bucket.replica_indexes);
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
REQUIRE(found);
|
137
|
+
}
|
138
|
+
|
139
|
+
{
|
140
|
+
bucket_settings.ram_quota_mb = old_quota_mb + 20;
|
141
|
+
couchbase::core::operations::management::bucket_update_request req;
|
142
|
+
req.bucket = bucket_settings;
|
143
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
144
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
145
|
+
}
|
146
|
+
|
147
|
+
auto ram_quota_updated = test::utils::wait_until([&integration, &bucket_name, old_quota_mb]() {
|
148
|
+
couchbase::core::operations::management::bucket_get_request req{ bucket_name };
|
149
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
150
|
+
return !resp.ctx.ec && resp.bucket.ram_quota_mb > old_quota_mb;
|
151
|
+
});
|
152
|
+
REQUIRE(ram_quota_updated);
|
153
|
+
|
154
|
+
{
|
155
|
+
couchbase::core::operations::management::bucket_drop_request req{ bucket_name };
|
156
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
157
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
158
|
+
}
|
159
|
+
|
160
|
+
{
|
161
|
+
couchbase::core::operations::management::bucket_get_request req{ bucket_name };
|
162
|
+
auto resp = retry_on_error(integration, req, {});
|
163
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
164
|
+
}
|
165
|
+
|
166
|
+
{
|
167
|
+
couchbase::core::operations::management::bucket_get_all_request req;
|
168
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
169
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
170
|
+
REQUIRE(!resp.buckets.empty());
|
171
|
+
auto known_buckets = std::count_if(
|
172
|
+
resp.buckets.begin(), resp.buckets.end(), [&bucket_name](auto& entry) { return entry.name == bucket_name; });
|
173
|
+
REQUIRE(known_buckets == 0);
|
174
|
+
}
|
106
175
|
}
|
107
|
-
|
176
|
+
SECTION("public API")
|
108
177
|
{
|
109
|
-
couchbase::
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
178
|
+
couchbase::cluster c(integration.cluster);
|
179
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
180
|
+
bucket_settings.name = bucket_name;
|
181
|
+
bucket_settings.ram_quota_mb = 100;
|
182
|
+
bucket_settings.num_replicas = 1;
|
183
|
+
bucket_settings.bucket_type = couchbase::management::cluster::bucket_type::couchbase;
|
184
|
+
bucket_settings.eviction_policy = couchbase::management::cluster::bucket_eviction_policy::value_only;
|
185
|
+
bucket_settings.flush_enabled = true;
|
186
|
+
if (integration.cluster_version().is_enterprise()) {
|
187
|
+
bucket_settings.max_expiry = 10;
|
188
|
+
bucket_settings.compression_mode = couchbase::management::cluster::bucket_compression::active;
|
189
|
+
}
|
190
|
+
bucket_settings.replica_indexes = true;
|
191
|
+
bucket_settings.conflict_resolution_type = couchbase::management::cluster::bucket_conflict_resolution::sequence_number;
|
192
|
+
{
|
193
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
194
|
+
REQUIRE_SUCCESS(ctx.ec());
|
195
|
+
}
|
196
|
+
{
|
197
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, &c]() {
|
198
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
199
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
200
|
+
});
|
201
|
+
REQUIRE(bucket_exists);
|
202
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
203
|
+
REQUIRE_SUCCESS(ctx.ec());
|
119
204
|
REQUIRE(bucket_settings.bucket_type == bucket.bucket_type);
|
120
205
|
REQUIRE(bucket_settings.name == bucket.name);
|
121
|
-
REQUIRE(bucket_settings.ram_quota_mb == bucket.ram_quota_mb);
|
122
|
-
old_quota_mb = bucket_settings.ram_quota_mb;
|
206
|
+
REQUIRE(Approx(bucket_settings.ram_quota_mb).margin(5) == bucket.ram_quota_mb);
|
123
207
|
REQUIRE(bucket_settings.num_replicas == bucket.num_replicas);
|
124
208
|
REQUIRE(bucket_settings.flush_enabled == bucket.flush_enabled);
|
125
209
|
REQUIRE(bucket_settings.max_expiry == bucket.max_expiry);
|
126
210
|
REQUIRE(bucket_settings.eviction_policy == bucket.eviction_policy);
|
127
211
|
REQUIRE(bucket_settings.compression_mode == bucket.compression_mode);
|
128
212
|
REQUIRE(bucket_settings.replica_indexes == bucket.replica_indexes);
|
129
|
-
break;
|
130
213
|
}
|
131
|
-
|
214
|
+
std::uint64_t old_quota_mb{ 0 };
|
215
|
+
{
|
216
|
+
auto [ctx, buckets] = c.buckets().get_all_buckets({}).get();
|
217
|
+
INFO(ctx.content());
|
218
|
+
REQUIRE_SUCCESS(ctx.ec());
|
219
|
+
bool found = false;
|
220
|
+
for (const auto& bucket : buckets) {
|
221
|
+
if (bucket.name != bucket_name) {
|
222
|
+
continue;
|
223
|
+
}
|
224
|
+
found = true;
|
225
|
+
REQUIRE(bucket_settings.bucket_type == bucket.bucket_type);
|
226
|
+
REQUIRE(bucket_settings.name == bucket.name);
|
227
|
+
REQUIRE(bucket_settings.ram_quota_mb == bucket.ram_quota_mb);
|
228
|
+
old_quota_mb = bucket_settings.ram_quota_mb;
|
229
|
+
REQUIRE(bucket_settings.num_replicas == bucket.num_replicas);
|
230
|
+
REQUIRE(bucket_settings.flush_enabled == bucket.flush_enabled);
|
231
|
+
REQUIRE(bucket_settings.max_expiry == bucket.max_expiry);
|
232
|
+
REQUIRE(bucket_settings.eviction_policy == bucket.eviction_policy);
|
233
|
+
REQUIRE(bucket_settings.compression_mode == bucket.compression_mode);
|
234
|
+
REQUIRE(bucket_settings.replica_indexes == bucket.replica_indexes);
|
235
|
+
break;
|
236
|
+
}
|
237
|
+
REQUIRE(found);
|
238
|
+
}
|
239
|
+
|
240
|
+
{
|
241
|
+
bucket_settings.ram_quota_mb = old_quota_mb + 20;
|
242
|
+
auto ctx = c.buckets().update_bucket(bucket_settings, {}).get();
|
243
|
+
REQUIRE_SUCCESS(ctx.ec());
|
244
|
+
}
|
245
|
+
auto ram_quota_updated = test::utils::wait_until([&bucket_name, c, old_quota_mb]() {
|
246
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
247
|
+
return !ctx.ec() && bucket.ram_quota_mb > old_quota_mb;
|
248
|
+
});
|
249
|
+
REQUIRE(ram_quota_updated);
|
250
|
+
{
|
251
|
+
auto ctx = c.buckets().drop_bucket(bucket_name, {}).get();
|
252
|
+
REQUIRE_SUCCESS(ctx.ec());
|
253
|
+
}
|
254
|
+
{
|
255
|
+
auto bucket_not_found = test::utils::wait_until([&bucket_name, c]() {
|
256
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
257
|
+
return ctx.ec() == couchbase::errc::common::bucket_not_found;
|
258
|
+
});
|
259
|
+
REQUIRE(bucket_not_found);
|
260
|
+
}
|
261
|
+
{
|
262
|
+
auto [ctx, buckets] = c.buckets().get_all_buckets({}).get();
|
263
|
+
REQUIRE_SUCCESS(ctx.ec());
|
264
|
+
REQUIRE(!buckets.empty());
|
265
|
+
auto known_buckets =
|
266
|
+
std::count_if(buckets.begin(), buckets.end(), [&bucket_name](auto& entry) { return entry.name == bucket_name; });
|
267
|
+
REQUIRE(known_buckets == 0);
|
268
|
+
}
|
132
269
|
}
|
270
|
+
}
|
133
271
|
|
272
|
+
SECTION("flush")
|
273
|
+
{
|
274
|
+
SECTION("core api")
|
134
275
|
{
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
139
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
140
|
-
}
|
276
|
+
SECTION("flush item")
|
277
|
+
{
|
278
|
+
couchbase::core::document_id id{ bucket_name, "_default", "_default", test::utils::uniq_id("foo") };
|
141
279
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
280
|
+
{
|
281
|
+
couchbase::core::operations::management::bucket_create_request req;
|
282
|
+
req.bucket.name = bucket_name;
|
283
|
+
req.bucket.flush_enabled = true;
|
284
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
285
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
286
|
+
}
|
148
287
|
|
149
|
-
|
150
|
-
couchbase::core::operations::management::bucket_drop_request req{ bucket_name };
|
151
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
152
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
153
|
-
}
|
288
|
+
REQUIRE(test::utils::wait_until_bucket_healthy(integration.cluster, bucket_name));
|
154
289
|
|
155
|
-
|
156
|
-
couchbase::core::operations::management::bucket_get_request req{ bucket_name };
|
157
|
-
auto resp = retry_on_error(integration, req, {});
|
158
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
159
|
-
}
|
290
|
+
test::utils::open_bucket(integration.cluster, bucket_name);
|
160
291
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
}
|
170
|
-
}
|
292
|
+
{
|
293
|
+
const tao::json::value value = {
|
294
|
+
{ "a", 1.0 },
|
295
|
+
};
|
296
|
+
couchbase::core::operations::insert_request req{ id, couchbase::core::utils::json::generate_binary(value) };
|
297
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
298
|
+
REQUIRE_SUCCESS(resp.ctx.ec());
|
299
|
+
}
|
171
300
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
301
|
+
{
|
302
|
+
couchbase::core::operations::get_request req{ id };
|
303
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
304
|
+
REQUIRE_SUCCESS(resp.ctx.ec());
|
305
|
+
}
|
306
|
+
|
307
|
+
{
|
308
|
+
couchbase::core::operations::management::bucket_flush_request req{ bucket_name };
|
309
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
310
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
311
|
+
}
|
177
312
|
|
313
|
+
auto flushed = test::utils::wait_until([&integration, id]() {
|
314
|
+
couchbase::core::operations::get_request req{ id };
|
315
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
316
|
+
return resp.ctx.ec() == couchbase::errc::key_value::document_not_found;
|
317
|
+
});
|
318
|
+
REQUIRE(flushed);
|
319
|
+
}
|
320
|
+
SECTION("no bucket")
|
178
321
|
{
|
179
|
-
couchbase::core::operations::management::
|
180
|
-
req.bucket.name = bucket_name;
|
181
|
-
req.bucket.flush_enabled = true;
|
322
|
+
couchbase::core::operations::management::bucket_flush_request req{ bucket_name };
|
182
323
|
auto resp = test::utils::execute(integration.cluster, req);
|
183
|
-
|
324
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
184
325
|
}
|
185
326
|
|
186
|
-
|
327
|
+
SECTION("flush disabled")
|
328
|
+
{
|
329
|
+
{
|
330
|
+
couchbase::core::operations::management::bucket_create_request req;
|
331
|
+
req.bucket.name = bucket_name;
|
332
|
+
req.bucket.flush_enabled = false;
|
333
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
334
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
335
|
+
}
|
187
336
|
|
188
|
-
|
337
|
+
REQUIRE(test::utils::wait_until_bucket_healthy(integration.cluster, bucket_name));
|
189
338
|
|
339
|
+
{
|
340
|
+
couchbase::core::operations::management::bucket_flush_request req{ bucket_name };
|
341
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
342
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::management::bucket_not_flushable);
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
SECTION("public API")
|
347
|
+
{
|
348
|
+
couchbase::cluster c(integration.cluster);
|
349
|
+
SECTION("flush item")
|
190
350
|
{
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
351
|
+
auto id = test::utils::uniq_id("foo");
|
352
|
+
|
353
|
+
{
|
354
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
355
|
+
bucket_settings.name = bucket_name;
|
356
|
+
bucket_settings.flush_enabled = true;
|
357
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
358
|
+
REQUIRE_SUCCESS(ctx.ec());
|
359
|
+
}
|
360
|
+
|
361
|
+
REQUIRE(test::utils::wait_until_bucket_healthy(integration.cluster, bucket_name));
|
362
|
+
|
363
|
+
test::utils::open_bucket(integration.cluster, bucket_name);
|
364
|
+
|
365
|
+
auto default_coll = c.bucket(bucket_name).default_collection();
|
366
|
+
{
|
367
|
+
const tao::json::value value = {
|
368
|
+
{ "a", 1.0 },
|
369
|
+
};
|
370
|
+
|
371
|
+
auto [ctx, resp] = default_coll.insert(id, value, {}).get();
|
372
|
+
REQUIRE_SUCCESS(ctx.ec());
|
373
|
+
}
|
374
|
+
{
|
375
|
+
auto [ctx, resp] = default_coll.get(id, {}).get();
|
376
|
+
REQUIRE_SUCCESS(ctx.ec());
|
377
|
+
}
|
378
|
+
{
|
379
|
+
auto ctx = c.buckets().flush_bucket(bucket_name, {}).get();
|
380
|
+
REQUIRE_SUCCESS(ctx.ec());
|
381
|
+
}
|
382
|
+
auto flushed = test::utils::wait_until([id, default_coll]() {
|
383
|
+
auto [ctx, resp] = default_coll.get(id, {}).get();
|
384
|
+
return ctx.ec() == couchbase::errc::key_value::document_not_found;
|
385
|
+
});
|
386
|
+
REQUIRE(flushed);
|
197
387
|
}
|
198
388
|
|
389
|
+
SECTION("no bucket")
|
199
390
|
{
|
200
|
-
|
201
|
-
|
202
|
-
REQUIRE_SUCCESS(resp.ctx.ec());
|
391
|
+
auto ctx = c.buckets().flush_bucket(bucket_name, {}).get();
|
392
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::bucket_not_found);
|
203
393
|
}
|
204
394
|
|
395
|
+
SECTION("flush disabled")
|
205
396
|
{
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
397
|
+
{
|
398
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
399
|
+
bucket_settings.name = bucket_name;
|
400
|
+
bucket_settings.flush_enabled = false;
|
401
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
402
|
+
REQUIRE_SUCCESS(ctx.ec());
|
403
|
+
}
|
210
404
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
405
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
406
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
407
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
408
|
+
});
|
409
|
+
REQUIRE(bucket_exists);
|
410
|
+
|
411
|
+
{
|
412
|
+
auto ctx = c.buckets().flush_bucket(bucket_name, {}).get();
|
413
|
+
REQUIRE(ctx.ec() == couchbase::errc::management::bucket_not_flushable);
|
414
|
+
}
|
415
|
+
}
|
217
416
|
}
|
417
|
+
}
|
218
418
|
|
219
|
-
|
419
|
+
if (integration.cluster_version().supports_memcached_buckets()) {
|
420
|
+
SECTION("memcached")
|
220
421
|
{
|
221
|
-
|
222
|
-
|
223
|
-
|
422
|
+
SECTION("core api")
|
423
|
+
{
|
424
|
+
{
|
425
|
+
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
426
|
+
bucket_settings.name = bucket_name;
|
427
|
+
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::memcached;
|
428
|
+
bucket_settings.num_replicas = 0;
|
429
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
430
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
431
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
432
|
+
}
|
433
|
+
|
434
|
+
{
|
435
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
436
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
437
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::memcached);
|
438
|
+
}
|
439
|
+
}
|
440
|
+
SECTION("public api")
|
441
|
+
{
|
442
|
+
couchbase::cluster c(integration.cluster);
|
443
|
+
{
|
444
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
445
|
+
bucket_settings.name = bucket_name;
|
446
|
+
bucket_settings.bucket_type = couchbase::management::cluster::bucket_type::memcached;
|
447
|
+
bucket_settings.num_replicas = 0;
|
448
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
449
|
+
REQUIRE_SUCCESS(ctx.ec());
|
450
|
+
}
|
451
|
+
|
452
|
+
{
|
453
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, &c]() {
|
454
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
455
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
456
|
+
});
|
457
|
+
REQUIRE(bucket_exists);
|
458
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
459
|
+
REQUIRE_SUCCESS(ctx.ec());
|
460
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::memcached);
|
461
|
+
}
|
462
|
+
}
|
224
463
|
}
|
464
|
+
}
|
225
465
|
|
226
|
-
|
466
|
+
SECTION("ephemeral")
|
467
|
+
{
|
468
|
+
SECTION("core api")
|
227
469
|
{
|
470
|
+
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
471
|
+
bucket_settings.name = bucket_name;
|
472
|
+
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::ephemeral;
|
473
|
+
|
474
|
+
SECTION("default eviction")
|
228
475
|
{
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
}
|
476
|
+
{
|
477
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
478
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
479
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
480
|
+
}
|
235
481
|
|
236
|
-
|
482
|
+
{
|
483
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
484
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
485
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::ephemeral);
|
486
|
+
REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::no_eviction);
|
487
|
+
}
|
488
|
+
}
|
237
489
|
|
490
|
+
SECTION("nru eviction")
|
238
491
|
{
|
239
|
-
|
240
|
-
|
241
|
-
|
492
|
+
{
|
493
|
+
bucket_settings.eviction_policy = couchbase::core::management::cluster::bucket_eviction_policy::not_recently_used;
|
494
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
495
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
496
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
497
|
+
}
|
498
|
+
|
499
|
+
{
|
500
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
501
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
502
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::ephemeral);
|
503
|
+
REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::not_recently_used);
|
504
|
+
}
|
242
505
|
}
|
243
|
-
}
|
244
|
-
}
|
245
506
|
|
246
|
-
|
247
|
-
|
507
|
+
if (integration.cluster_version().supports_storage_backend()) {
|
508
|
+
SECTION("storage backend")
|
509
|
+
{
|
510
|
+
{
|
511
|
+
bucket_settings.storage_backend = couchbase::core::management::cluster::bucket_storage_backend::couchstore;
|
512
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
513
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
514
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
515
|
+
}
|
516
|
+
|
517
|
+
{
|
518
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
519
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
520
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::ephemeral);
|
521
|
+
REQUIRE(resp.bucket.storage_backend == couchbase::core::management::cluster::bucket_storage_backend::unknown);
|
522
|
+
}
|
523
|
+
}
|
524
|
+
}
|
525
|
+
}
|
526
|
+
SECTION("public api")
|
248
527
|
{
|
528
|
+
couchbase::cluster c(integration.cluster);
|
529
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
530
|
+
bucket_settings.name = bucket_name;
|
531
|
+
bucket_settings.bucket_type = couchbase::management::cluster::bucket_type::ephemeral;
|
532
|
+
|
533
|
+
SECTION("default eviction")
|
249
534
|
{
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
535
|
+
{
|
536
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
537
|
+
REQUIRE_SUCCESS(ctx.ec());
|
538
|
+
}
|
539
|
+
|
540
|
+
{
|
541
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
542
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
543
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
544
|
+
});
|
545
|
+
REQUIRE(bucket_exists);
|
546
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
547
|
+
REQUIRE_SUCCESS(ctx.ec());
|
548
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::ephemeral);
|
549
|
+
REQUIRE(bucket.eviction_policy == couchbase::management::cluster::bucket_eviction_policy::no_eviction);
|
550
|
+
}
|
257
551
|
}
|
258
552
|
|
553
|
+
SECTION("nru eviction")
|
259
554
|
{
|
260
|
-
|
261
|
-
|
262
|
-
|
555
|
+
{
|
556
|
+
bucket_settings.eviction_policy = couchbase::management::cluster::bucket_eviction_policy::not_recently_used;
|
557
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
558
|
+
REQUIRE_SUCCESS(ctx.ec());
|
559
|
+
}
|
560
|
+
|
561
|
+
{
|
562
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
563
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
564
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
565
|
+
});
|
566
|
+
REQUIRE(bucket_exists);
|
567
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
568
|
+
REQUIRE_SUCCESS(ctx.ec());
|
569
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::ephemeral);
|
570
|
+
REQUIRE(bucket.eviction_policy == couchbase::management::cluster::bucket_eviction_policy::not_recently_used);
|
571
|
+
}
|
572
|
+
}
|
573
|
+
if (integration.cluster_version().supports_storage_backend()) {
|
574
|
+
SECTION("storage backend")
|
575
|
+
{
|
576
|
+
{
|
577
|
+
bucket_settings.storage_backend = couchbase::management::cluster::bucket_storage_backend::couchstore;
|
578
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
579
|
+
REQUIRE_SUCCESS(ctx.ec());
|
580
|
+
}
|
581
|
+
|
582
|
+
{
|
583
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
584
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
585
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
586
|
+
});
|
587
|
+
REQUIRE(bucket_exists);
|
588
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
589
|
+
REQUIRE_SUCCESS(ctx.ec());
|
590
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::ephemeral);
|
591
|
+
REQUIRE(bucket.storage_backend == couchbase::management::cluster::bucket_storage_backend::unknown);
|
592
|
+
}
|
593
|
+
}
|
263
594
|
}
|
264
595
|
}
|
265
596
|
}
|
266
|
-
|
267
|
-
SECTION("ephemeral")
|
597
|
+
SECTION("couchbase")
|
268
598
|
{
|
269
|
-
|
270
|
-
bucket_settings.name = bucket_name;
|
271
|
-
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::ephemeral;
|
272
|
-
|
273
|
-
SECTION("default eviction")
|
599
|
+
SECTION("core api")
|
274
600
|
{
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
279
|
-
}
|
601
|
+
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
602
|
+
bucket_settings.name = bucket_name;
|
603
|
+
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::couchbase;
|
280
604
|
|
605
|
+
SECTION("default eviction")
|
281
606
|
{
|
282
|
-
|
283
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
284
|
-
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::ephemeral);
|
285
|
-
REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::no_eviction);
|
286
|
-
}
|
287
|
-
}
|
607
|
+
{
|
288
608
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
294
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
295
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
296
|
-
}
|
609
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
610
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
611
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
612
|
+
}
|
297
613
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
614
|
+
{
|
615
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
616
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
617
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
|
618
|
+
REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::value_only);
|
619
|
+
}
|
303
620
|
}
|
304
|
-
}
|
305
621
|
|
306
|
-
|
307
|
-
SECTION("storage backend")
|
622
|
+
SECTION("full eviction")
|
308
623
|
{
|
309
624
|
{
|
310
|
-
bucket_settings.
|
625
|
+
bucket_settings.eviction_policy = couchbase::core::management::cluster::bucket_eviction_policy::full;
|
311
626
|
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
312
627
|
auto resp = test::utils::execute(integration.cluster, req);
|
313
628
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
@@ -316,88 +631,144 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
316
631
|
{
|
317
632
|
auto resp = wait_for_bucket_created(integration, bucket_name);
|
318
633
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
319
|
-
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::
|
320
|
-
REQUIRE(resp.bucket.
|
634
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
|
635
|
+
REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::full);
|
321
636
|
}
|
322
637
|
}
|
323
|
-
}
|
324
|
-
}
|
325
|
-
|
326
|
-
SECTION("couchbase")
|
327
|
-
{
|
328
|
-
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
329
|
-
bucket_settings.name = bucket_name;
|
330
|
-
bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::couchbase;
|
331
638
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
639
|
+
if (integration.cluster_version().supports_storage_backend()) {
|
640
|
+
SECTION("storage backend")
|
641
|
+
{
|
642
|
+
SECTION("couchstore")
|
643
|
+
{
|
644
|
+
{
|
645
|
+
bucket_settings.storage_backend = couchbase::core::management::cluster::bucket_storage_backend::couchstore;
|
646
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
647
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
648
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
649
|
+
}
|
650
|
+
|
651
|
+
{
|
652
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
653
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
654
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
|
655
|
+
REQUIRE(resp.bucket.storage_backend ==
|
656
|
+
couchbase::core::management::cluster::bucket_storage_backend::couchstore);
|
657
|
+
}
|
658
|
+
}
|
340
659
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
660
|
+
SECTION("magma")
|
661
|
+
{
|
662
|
+
{
|
663
|
+
bucket_settings.ram_quota_mb = integration.cluster_version().is_neo() ? 1'024 : 256;
|
664
|
+
bucket_settings.storage_backend = couchbase::core::management::cluster::bucket_storage_backend::magma;
|
665
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
666
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
667
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
668
|
+
}
|
669
|
+
|
670
|
+
{
|
671
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
672
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
673
|
+
REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
|
674
|
+
REQUIRE(resp.bucket.storage_backend == couchbase::core::management::cluster::bucket_storage_backend::magma);
|
675
|
+
}
|
676
|
+
}
|
677
|
+
}
|
346
678
|
}
|
347
679
|
}
|
348
|
-
|
349
|
-
SECTION("full eviction")
|
680
|
+
SECTION("public api")
|
350
681
|
{
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
356
|
-
}
|
682
|
+
couchbase::cluster c(integration.cluster);
|
683
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
684
|
+
bucket_settings.name = bucket_name;
|
685
|
+
bucket_settings.bucket_type = couchbase::management::cluster::bucket_type::couchbase;
|
357
686
|
|
687
|
+
SECTION("default eviction")
|
358
688
|
{
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
689
|
+
{
|
690
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
691
|
+
REQUIRE_SUCCESS(ctx.ec());
|
692
|
+
}
|
693
|
+
|
694
|
+
{
|
695
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
696
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
697
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
698
|
+
});
|
699
|
+
REQUIRE(bucket_exists);
|
700
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
701
|
+
REQUIRE_SUCCESS(ctx.ec());
|
702
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::couchbase);
|
703
|
+
REQUIRE(bucket.eviction_policy == couchbase::management::cluster::bucket_eviction_policy::value_only);
|
704
|
+
}
|
363
705
|
}
|
364
|
-
}
|
365
706
|
|
366
|
-
|
367
|
-
SECTION("storage backend")
|
707
|
+
SECTION("full eviction")
|
368
708
|
{
|
369
|
-
SECTION("couchstore")
|
370
709
|
{
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
376
|
-
}
|
710
|
+
bucket_settings.eviction_policy = couchbase::management::cluster::bucket_eviction_policy::full;
|
711
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
712
|
+
REQUIRE_SUCCESS(ctx.ec());
|
713
|
+
}
|
377
714
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
715
|
+
{
|
716
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
717
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
718
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
719
|
+
});
|
720
|
+
REQUIRE(bucket_exists);
|
721
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
722
|
+
REQUIRE_SUCCESS(ctx.ec());
|
723
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::couchbase);
|
724
|
+
REQUIRE(bucket.eviction_policy == couchbase::management::cluster::bucket_eviction_policy::full);
|
384
725
|
}
|
726
|
+
}
|
385
727
|
|
386
|
-
|
728
|
+
if (integration.cluster_version().supports_storage_backend()) {
|
729
|
+
SECTION("storage backend")
|
387
730
|
{
|
731
|
+
SECTION("couchstore")
|
388
732
|
{
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
733
|
+
{
|
734
|
+
bucket_settings.storage_backend = couchbase::management::cluster::bucket_storage_backend::couchstore;
|
735
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
736
|
+
REQUIRE_SUCCESS(ctx.ec());
|
737
|
+
}
|
738
|
+
|
739
|
+
{
|
740
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
741
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
742
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
743
|
+
});
|
744
|
+
REQUIRE(bucket_exists);
|
745
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
746
|
+
REQUIRE_SUCCESS(ctx.ec());
|
747
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::couchbase);
|
748
|
+
REQUIRE(bucket.storage_backend == couchbase::management::cluster::bucket_storage_backend::couchstore);
|
749
|
+
}
|
394
750
|
}
|
395
751
|
|
752
|
+
SECTION("magma")
|
396
753
|
{
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
754
|
+
{
|
755
|
+
bucket_settings.ram_quota_mb = integration.cluster_version().is_neo() ? 1'024 : 256;
|
756
|
+
bucket_settings.storage_backend = couchbase::management::cluster::bucket_storage_backend::magma;
|
757
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
758
|
+
REQUIRE_SUCCESS(ctx.ec());
|
759
|
+
}
|
760
|
+
|
761
|
+
{
|
762
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
763
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
764
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
765
|
+
});
|
766
|
+
REQUIRE(bucket_exists);
|
767
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
768
|
+
REQUIRE_SUCCESS(ctx.ec());
|
769
|
+
REQUIRE(bucket.bucket_type == couchbase::management::cluster::bucket_type::couchbase);
|
770
|
+
REQUIRE(bucket.storage_backend == couchbase::management::cluster::bucket_storage_backend::magma);
|
771
|
+
}
|
401
772
|
}
|
402
773
|
}
|
403
774
|
}
|
@@ -406,41 +777,36 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
406
777
|
|
407
778
|
SECTION("update no bucket")
|
408
779
|
{
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
780
|
+
SECTION("core api")
|
781
|
+
{
|
782
|
+
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
783
|
+
bucket_settings.name = bucket_name;
|
784
|
+
couchbase::core::operations::management::bucket_update_request req;
|
785
|
+
req.bucket = bucket_settings;
|
786
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
787
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
788
|
+
}
|
789
|
+
SECTION("public api")
|
790
|
+
{
|
791
|
+
couchbase::cluster c(integration.cluster);
|
792
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
793
|
+
bucket_settings.name = bucket_name;
|
794
|
+
auto ctx = c.buckets().update_bucket(bucket_settings, {}).get();
|
795
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::bucket_not_found);
|
796
|
+
}
|
416
797
|
}
|
417
798
|
|
418
799
|
if (integration.cluster_version().supports_minimum_durability_level()) {
|
419
800
|
SECTION("minimum durability level")
|
420
801
|
{
|
421
|
-
|
422
|
-
bucket_settings.name = bucket_name;
|
423
|
-
|
424
|
-
SECTION("default")
|
802
|
+
SECTION("core api")
|
425
803
|
{
|
426
|
-
|
427
|
-
|
428
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
429
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
430
|
-
}
|
431
|
-
|
432
|
-
{
|
433
|
-
auto resp = wait_for_bucket_created(integration, bucket_name);
|
434
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
435
|
-
REQUIRE(resp.bucket.minimum_durability_level == couchbase::durability_level::none);
|
436
|
-
}
|
437
|
-
}
|
804
|
+
couchbase::core::management::cluster::bucket_settings bucket_settings;
|
805
|
+
bucket_settings.name = bucket_name;
|
438
806
|
|
439
|
-
|
440
|
-
SECTION("majority")
|
807
|
+
SECTION("default")
|
441
808
|
{
|
442
809
|
{
|
443
|
-
bucket_settings.minimum_durability_level = couchbase::durability_level::majority;
|
444
810
|
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
445
811
|
auto resp = test::utils::execute(integration.cluster, req);
|
446
812
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
@@ -449,7 +815,70 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
449
815
|
{
|
450
816
|
auto resp = wait_for_bucket_created(integration, bucket_name);
|
451
817
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
452
|
-
REQUIRE(resp.bucket.minimum_durability_level == couchbase::durability_level::
|
818
|
+
REQUIRE(resp.bucket.minimum_durability_level == couchbase::durability_level::none);
|
819
|
+
}
|
820
|
+
}
|
821
|
+
|
822
|
+
if (integration.number_of_nodes() >= 2) {
|
823
|
+
SECTION("majority")
|
824
|
+
{
|
825
|
+
{
|
826
|
+
bucket_settings.minimum_durability_level = couchbase::durability_level::majority;
|
827
|
+
couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
|
828
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
829
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
830
|
+
}
|
831
|
+
|
832
|
+
{
|
833
|
+
auto resp = wait_for_bucket_created(integration, bucket_name);
|
834
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
835
|
+
REQUIRE(resp.bucket.minimum_durability_level == couchbase::durability_level::majority);
|
836
|
+
}
|
837
|
+
}
|
838
|
+
}
|
839
|
+
}
|
840
|
+
SECTION("public api")
|
841
|
+
{
|
842
|
+
couchbase::cluster c(integration.cluster);
|
843
|
+
couchbase::management::cluster::bucket_settings bucket_settings;
|
844
|
+
bucket_settings.name = bucket_name;
|
845
|
+
|
846
|
+
SECTION("default")
|
847
|
+
{
|
848
|
+
{
|
849
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
850
|
+
REQUIRE_SUCCESS(ctx.ec());
|
851
|
+
}
|
852
|
+
{
|
853
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
854
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
855
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
856
|
+
});
|
857
|
+
REQUIRE(bucket_exists);
|
858
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
859
|
+
REQUIRE_SUCCESS(ctx.ec());
|
860
|
+
REQUIRE(bucket.minimum_durability_level == couchbase::durability_level::none);
|
861
|
+
}
|
862
|
+
}
|
863
|
+
if (integration.number_of_nodes() >= 2) {
|
864
|
+
SECTION("majority")
|
865
|
+
{
|
866
|
+
{
|
867
|
+
bucket_settings.minimum_durability_level = couchbase::durability_level::majority;
|
868
|
+
auto ctx = c.buckets().create_bucket(bucket_settings, {}).get();
|
869
|
+
REQUIRE_SUCCESS(ctx.ec());
|
870
|
+
}
|
871
|
+
|
872
|
+
{
|
873
|
+
auto bucket_exists = test::utils::wait_until([&bucket_name, c]() {
|
874
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
875
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
876
|
+
});
|
877
|
+
REQUIRE(bucket_exists);
|
878
|
+
auto [ctx, bucket] = c.buckets().get_bucket(bucket_name, {}).get();
|
879
|
+
REQUIRE_SUCCESS(ctx.ec());
|
880
|
+
REQUIRE(bucket.minimum_durability_level == couchbase::durability_level::majority);
|
881
|
+
}
|
453
882
|
}
|
454
883
|
}
|
455
884
|
}
|
@@ -508,7 +937,7 @@ TEST_CASE("integration: collection management", "[integration]")
|
|
508
937
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
509
938
|
|
510
939
|
if (!integration.cluster_version().supports_collections()) {
|
511
|
-
|
940
|
+
SKIP("cluster does not support collections");
|
512
941
|
}
|
513
942
|
|
514
943
|
auto scope_name = test::utils::uniq_id("scope");
|
@@ -648,7 +1077,7 @@ TEST_CASE("integration: user groups management", "[integration]")
|
|
648
1077
|
test::utils::integration_test_guard integration;
|
649
1078
|
|
650
1079
|
if (!integration.cluster_version().supports_user_groups()) {
|
651
|
-
|
1080
|
+
SKIP("cluster does not support user groups");
|
652
1081
|
}
|
653
1082
|
|
654
1083
|
SECTION("group crud")
|
@@ -859,7 +1288,7 @@ TEST_CASE("integration: user management", "[integration]")
|
|
859
1288
|
test::utils::integration_test_guard integration;
|
860
1289
|
|
861
1290
|
if (!integration.cluster_version().supports_user_management()) {
|
862
|
-
|
1291
|
+
SKIP("cluster does not support user management");
|
863
1292
|
}
|
864
1293
|
|
865
1294
|
if (!integration.cluster_version().supports_gcccp()) {
|
@@ -957,9 +1386,14 @@ TEST_CASE("integration: user management collections roles", "[integration]")
|
|
957
1386
|
test::utils::integration_test_guard integration;
|
958
1387
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
959
1388
|
|
960
|
-
if (!integration.cluster_version().supports_user_management()
|
961
|
-
|
962
|
-
|
1389
|
+
if (!integration.cluster_version().supports_user_management()) {
|
1390
|
+
SKIP("cluster does not support user management");
|
1391
|
+
}
|
1392
|
+
if (!integration.cluster_version().supports_collections()) {
|
1393
|
+
SKIP("cluster does not support collections");
|
1394
|
+
}
|
1395
|
+
if (integration.cluster_version().is_community()) {
|
1396
|
+
SKIP("cluster is community edition");
|
963
1397
|
}
|
964
1398
|
|
965
1399
|
auto scope_name = test::utils::uniq_id("scope");
|
@@ -1027,12 +1461,22 @@ TEST_CASE("integration: user management collections roles", "[integration]")
|
|
1027
1461
|
REQUIRE(resp.user.roles[0].scope == scope_name);
|
1028
1462
|
REQUIRE(resp.user.roles[0].collection == collection_name);
|
1029
1463
|
}
|
1464
|
+
|
1465
|
+
{
|
1466
|
+
couchbase::core::operations::management::scope_drop_request req{ integration.ctx.bucket, scope_name };
|
1467
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1468
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1469
|
+
}
|
1030
1470
|
}
|
1031
1471
|
|
1032
1472
|
TEST_CASE("integration: query index management", "[integration]")
|
1033
1473
|
{
|
1034
1474
|
test::utils::integration_test_guard integration;
|
1035
1475
|
|
1476
|
+
if (!integration.cluster_version().supports_query_index_management()) {
|
1477
|
+
SKIP("cluster does not support query index management");
|
1478
|
+
}
|
1479
|
+
|
1036
1480
|
if (integration.cluster_version().supports_bucket_management()) {
|
1037
1481
|
SECTION("primary index")
|
1038
1482
|
{
|
@@ -1440,8 +1884,11 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1440
1884
|
{
|
1441
1885
|
test::utils::integration_test_guard integration;
|
1442
1886
|
|
1887
|
+
if (!integration.cluster_version().supports_query_index_management()) {
|
1888
|
+
SKIP("cluster does not support query index management");
|
1889
|
+
}
|
1443
1890
|
if (!integration.cluster_version().supports_collections()) {
|
1444
|
-
|
1891
|
+
SKIP("cluster does not support collections");
|
1445
1892
|
}
|
1446
1893
|
|
1447
1894
|
auto index_name = test::utils::uniq_id("collections_index");
|
@@ -1483,7 +1930,8 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1483
1930
|
req.collection_name = collection_name;
|
1484
1931
|
req.is_primary = true;
|
1485
1932
|
resp = test::utils::execute(integration.cluster, req);
|
1486
|
-
return resp.ctx.ec != couchbase::errc::common::bucket_not_found
|
1933
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found &&
|
1934
|
+
resp.ctx.ec != couchbase::errc::common::scope_not_found;
|
1487
1935
|
});
|
1488
1936
|
REQUIRE(operation_completed);
|
1489
1937
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
@@ -1508,7 +1956,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1508
1956
|
bool operation_completed = test::utils::wait_until([&manager, &ec]() {
|
1509
1957
|
auto ctx = manager.create_primary_index({}).get();
|
1510
1958
|
ec = ctx.ec();
|
1511
|
-
return
|
1959
|
+
return ec != couchbase::errc::common::bucket_not_found && ec != couchbase::errc::common::scope_not_found;
|
1512
1960
|
});
|
1513
1961
|
|
1514
1962
|
REQUIRE(operation_completed);
|
@@ -1538,7 +1986,8 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1538
1986
|
req.index_name = index_name;
|
1539
1987
|
req.is_primary = true;
|
1540
1988
|
resp = test::utils::execute(integration.cluster, req);
|
1541
|
-
return resp.ctx.ec != couchbase::errc::common::bucket_not_found
|
1989
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found &&
|
1990
|
+
resp.ctx.ec != couchbase::errc::common::scope_not_found;
|
1542
1991
|
});
|
1543
1992
|
REQUIRE(operation_completed);
|
1544
1993
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
@@ -1612,7 +2061,8 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1612
2061
|
req.collection_name = collection_name;
|
1613
2062
|
req.fields = { "field" };
|
1614
2063
|
resp = test::utils::execute(integration.cluster, req);
|
1615
|
-
return resp.ctx.ec != couchbase::errc::common::bucket_not_found
|
2064
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found &&
|
2065
|
+
resp.ctx.ec != couchbase::errc::common::scope_not_found;
|
1616
2066
|
});
|
1617
2067
|
REQUIRE(operation_completed);
|
1618
2068
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
@@ -1765,7 +2215,8 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1765
2215
|
req.fields = { "field" };
|
1766
2216
|
req.deferred = true;
|
1767
2217
|
resp = test::utils::execute(integration.cluster, req);
|
1768
|
-
return resp.ctx.ec != couchbase::errc::common::bucket_not_found
|
2218
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found &&
|
2219
|
+
resp.ctx.ec != couchbase::errc::common::scope_not_found;
|
1769
2220
|
});
|
1770
2221
|
REQUIRE(operation_completed);
|
1771
2222
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
@@ -1938,31 +2389,34 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1938
2389
|
.ec() == couchbase::errc::common::ambiguous_timeout);
|
1939
2390
|
}
|
1940
2391
|
}
|
1941
|
-
SECTION("watch missing collection")
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
2392
|
+
SECTION("watch missing collection"){ SECTION("public API"){ couchbase::cluster c(integration.cluster);
|
2393
|
+
auto coll = c.bucket(integration.ctx.bucket).scope(scope_name).collection("missing_collection");
|
2394
|
+
REQUIRE(coll.query_indexes()
|
2395
|
+
.watch_indexes({ index_name }, couchbase::watch_query_indexes_options().timeout(std::chrono::seconds(5)))
|
2396
|
+
.get()
|
2397
|
+
.ec() == couchbase::errc::common::ambiguous_timeout);
|
2398
|
+
}
|
2399
|
+
}
|
2400
|
+
|
2401
|
+
{
|
2402
|
+
couchbase::core::operations::management::scope_drop_request req{ integration.ctx.bucket, scope_name };
|
2403
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
2404
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
2405
|
+
}
|
1953
2406
|
}
|
1954
2407
|
|
1955
2408
|
TEST_CASE("integration: analytics index management", "[integration]")
|
1956
2409
|
{
|
1957
2410
|
test::utils::integration_test_guard integration;
|
1958
2411
|
|
1959
|
-
if (!integration.cluster_version().supports_analytics()
|
1960
|
-
|
2412
|
+
if (!integration.cluster_version().supports_analytics()) {
|
2413
|
+
SKIP("cluster does not support analytics service");
|
2414
|
+
}
|
2415
|
+
if (!integration.has_analytics_service()) {
|
2416
|
+
SKIP("cluster does not have analytics service");
|
1961
2417
|
}
|
1962
|
-
|
1963
|
-
// MB-47718
|
1964
2418
|
if (integration.storage_backend() == couchbase::core::management::cluster::bucket_storage_backend::magma) {
|
1965
|
-
|
2419
|
+
SKIP("analytics does not work with magma storage backend, see MB-47718");
|
1966
2420
|
}
|
1967
2421
|
|
1968
2422
|
SECTION("crud")
|
@@ -2488,18 +2942,20 @@ TEST_CASE("integration: analytics external link management", "[integration]")
|
|
2488
2942
|
{
|
2489
2943
|
test::utils::integration_test_guard integration;
|
2490
2944
|
|
2491
|
-
if (!integration.cluster_version().
|
2492
|
-
|
2945
|
+
if (!integration.cluster_version().supports_analytics()) {
|
2946
|
+
SKIP("cluster does not support analytics service");
|
2947
|
+
}
|
2948
|
+
if (!integration.has_analytics_service()) {
|
2949
|
+
SKIP("cluster does not have analytics service");
|
2950
|
+
}
|
2951
|
+
if (!integration.cluster_version().supports_analytics_links()) {
|
2952
|
+
SKIP("analytics does not support analytics links");
|
2493
2953
|
}
|
2494
|
-
|
2495
|
-
// MB-47718
|
2496
2954
|
if (integration.storage_backend() == couchbase::core::management::cluster::bucket_storage_backend::magma) {
|
2497
|
-
|
2955
|
+
SKIP("analytics does not work with magma storage backend, see MB-47718");
|
2498
2956
|
}
|
2499
|
-
|
2500
|
-
// MB-40198
|
2501
2957
|
if (!integration.cluster_version().supports_analytics_links_cert_auth() && integration.origin.credentials().uses_certificate()) {
|
2502
|
-
|
2958
|
+
SKIP("certificate credentials selected, but analytics service does not support cert auth, see MB-40198");
|
2503
2959
|
}
|
2504
2960
|
|
2505
2961
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
@@ -2578,6 +3034,12 @@ TEST_CASE("integration: analytics external link management", "[integration]")
|
|
2578
3034
|
run_azure_link_test(integration, dataverse_name, link_name);
|
2579
3035
|
}
|
2580
3036
|
}
|
3037
|
+
|
3038
|
+
{
|
3039
|
+
couchbase::core::operations::management::scope_drop_request req{ integration.ctx.bucket, scope_name };
|
3040
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
3041
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
3042
|
+
}
|
2581
3043
|
}
|
2582
3044
|
}
|
2583
3045
|
}
|
@@ -2589,6 +3051,10 @@ TEST_CASE("integration: search index management", "[integration]")
|
|
2589
3051
|
{
|
2590
3052
|
test::utils::integration_test_guard integration;
|
2591
3053
|
|
3054
|
+
if (!integration.cluster_version().supports_search()) {
|
3055
|
+
SKIP("cluster does not support search");
|
3056
|
+
}
|
3057
|
+
|
2592
3058
|
if (!integration.cluster_version().supports_gcccp()) {
|
2593
3059
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
2594
3060
|
}
|
@@ -2639,7 +3105,7 @@ TEST_CASE("integration: search index management", "[integration]")
|
|
2639
3105
|
if (integration.cluster_version().is_serverless_config_profile()) {
|
2640
3106
|
index.plan_params_json = serverless_plan_params;
|
2641
3107
|
}
|
2642
|
-
index.params_json = R"({ "store": { "
|
3108
|
+
index.params_json = R"({ "store": { "kvStoreName": "moss" }})";
|
2643
3109
|
couchbase::core::operations::management::search_index_upsert_request req{};
|
2644
3110
|
req.index = index;
|
2645
3111
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -2880,8 +3346,12 @@ TEST_CASE("integration: search index management analyze document", "[integration
|
|
2880
3346
|
{
|
2881
3347
|
test::utils::integration_test_guard integration;
|
2882
3348
|
|
3349
|
+
if (!integration.cluster_version().supports_search()) {
|
3350
|
+
SKIP("cluster does not support search");
|
3351
|
+
}
|
3352
|
+
|
2883
3353
|
if (!integration.cluster_version().supports_search_analyze()) {
|
2884
|
-
|
3354
|
+
SKIP("cluster does not support search analyze");
|
2885
3355
|
}
|
2886
3356
|
|
2887
3357
|
auto index_name = test::utils::uniq_id("index");
|
@@ -2932,25 +3402,34 @@ TEST_CASE("integration: freeform HTTP request", "[integration]")
|
|
2932
3402
|
REQUIRE(resp.ctx.ec == couchbase::errc::common::invalid_argument);
|
2933
3403
|
}
|
2934
3404
|
|
2935
|
-
|
2936
|
-
|
2937
|
-
{
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
2943
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
2944
|
-
REQUIRE(resp.status == 200);
|
2945
|
-
REQUIRE_FALSE(resp.body.empty());
|
2946
|
-
INFO(resp.body)
|
2947
|
-
auto result = couchbase::core::utils::json::parse(resp.body);
|
2948
|
-
REQUIRE(result.is_object());
|
3405
|
+
SECTION("analytics")
|
3406
|
+
{
|
3407
|
+
if (!integration.cluster_version().supports_analytics()) {
|
3408
|
+
SKIP("cluster does not support analytics");
|
3409
|
+
}
|
3410
|
+
if (!integration.has_analytics_service()) {
|
3411
|
+
SKIP("cluster does not have analytics service");
|
2949
3412
|
}
|
3413
|
+
|
3414
|
+
couchbase::core::operations::management::freeform_request req{};
|
3415
|
+
req.type = couchbase::core::service_type::analytics;
|
3416
|
+
req.method = "GET";
|
3417
|
+
req.path = "/admin/ping";
|
3418
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
3419
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
3420
|
+
REQUIRE(resp.status == 200);
|
3421
|
+
REQUIRE_FALSE(resp.body.empty());
|
3422
|
+
INFO(resp.body);
|
3423
|
+
auto result = couchbase::core::utils::json::parse(resp.body);
|
3424
|
+
REQUIRE(result.is_object());
|
2950
3425
|
}
|
2951
3426
|
|
2952
3427
|
SECTION("search")
|
2953
3428
|
{
|
3429
|
+
if (!integration.cluster_version().supports_search()) {
|
3430
|
+
SKIP("cluster does not support search");
|
3431
|
+
}
|
3432
|
+
|
2954
3433
|
couchbase::core::operations::management::freeform_request req{};
|
2955
3434
|
req.type = couchbase::core::service_type::search;
|
2956
3435
|
req.method = "GET";
|
@@ -2965,6 +3444,10 @@ TEST_CASE("integration: freeform HTTP request", "[integration]")
|
|
2965
3444
|
|
2966
3445
|
SECTION("query")
|
2967
3446
|
{
|
3447
|
+
if (!integration.cluster_version().supports_query()) {
|
3448
|
+
SKIP("cluster does not support query");
|
3449
|
+
}
|
3450
|
+
|
2968
3451
|
couchbase::core::operations::management::freeform_request req{};
|
2969
3452
|
req.type = couchbase::core::service_type::query;
|
2970
3453
|
req.method = "GET";
|
@@ -2973,30 +3456,32 @@ TEST_CASE("integration: freeform HTTP request", "[integration]")
|
|
2973
3456
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
2974
3457
|
REQUIRE(resp.status == 200);
|
2975
3458
|
REQUIRE_FALSE(resp.body.empty());
|
2976
|
-
INFO(resp.body)
|
3459
|
+
INFO(resp.body);
|
2977
3460
|
auto result = couchbase::core::utils::json::parse(resp.body);
|
2978
3461
|
REQUIRE(result.is_object());
|
2979
3462
|
}
|
2980
3463
|
|
2981
|
-
|
2982
|
-
|
2983
|
-
{
|
2984
|
-
|
2985
|
-
auto view_name = test::utils::uniq_id("view");
|
2986
|
-
|
2987
|
-
couchbase::core::operations::management::freeform_request req{};
|
2988
|
-
req.type = couchbase::core::service_type::view;
|
2989
|
-
req.method = "POST";
|
2990
|
-
req.path = fmt::format("/{}/_design/{}/_view/{}", integration.ctx.bucket, document_name, view_name);
|
2991
|
-
req.body = R"({"keys":["foo","bar"]})";
|
2992
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
2993
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
2994
|
-
REQUIRE(resp.status == 404);
|
2995
|
-
REQUIRE_FALSE(resp.body.empty());
|
2996
|
-
auto result = couchbase::core::utils::json::parse(resp.body);
|
2997
|
-
INFO(resp.body)
|
2998
|
-
REQUIRE(result["error"].get_string() == "not_found");
|
3464
|
+
SECTION("view")
|
3465
|
+
{
|
3466
|
+
if (!integration.cluster_version().supports_views()) {
|
3467
|
+
SKIP("cluster does not support views");
|
2999
3468
|
}
|
3469
|
+
|
3470
|
+
auto document_name = test::utils::uniq_id("design_document");
|
3471
|
+
auto view_name = test::utils::uniq_id("view");
|
3472
|
+
|
3473
|
+
couchbase::core::operations::management::freeform_request req{};
|
3474
|
+
req.type = couchbase::core::service_type::view;
|
3475
|
+
req.method = "POST";
|
3476
|
+
req.path = fmt::format("/{}/_design/{}/_view/{}", integration.ctx.bucket, document_name, view_name);
|
3477
|
+
req.body = R"({"keys":["foo","bar"]})";
|
3478
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
3479
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
3480
|
+
REQUIRE(resp.status == 404);
|
3481
|
+
REQUIRE_FALSE(resp.body.empty());
|
3482
|
+
auto result = couchbase::core::utils::json::parse(resp.body);
|
3483
|
+
INFO(resp.body);
|
3484
|
+
REQUIRE(result["error"].get_string() == "not_found");
|
3000
3485
|
}
|
3001
3486
|
|
3002
3487
|
SECTION("management")
|
@@ -3010,48 +3495,59 @@ TEST_CASE("integration: freeform HTTP request", "[integration]")
|
|
3010
3495
|
REQUIRE(resp.status == 200);
|
3011
3496
|
REQUIRE_FALSE(resp.body.empty());
|
3012
3497
|
auto result = couchbase::core::utils::json::parse(resp.body);
|
3013
|
-
INFO(resp.body)
|
3498
|
+
INFO(resp.body);
|
3014
3499
|
REQUIRE(result.find("uuid") != nullptr);
|
3015
3500
|
}
|
3016
3501
|
|
3017
|
-
|
3018
|
-
|
3019
|
-
{
|
3020
|
-
|
3502
|
+
SECTION("create scope")
|
3503
|
+
{
|
3504
|
+
if (!integration.cluster_version().supports_collections()) {
|
3505
|
+
SKIP("cluster does not support collections");
|
3506
|
+
}
|
3021
3507
|
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3508
|
+
auto scope_name = test::utils::uniq_id("freeform_scope");
|
3509
|
+
|
3510
|
+
couchbase::core::operations::management::freeform_request req{};
|
3511
|
+
req.type = couchbase::core::service_type::management;
|
3512
|
+
req.method = "POST";
|
3513
|
+
req.path = fmt::format("/pools/default/buckets/{}/scopes", integration.ctx.bucket);
|
3514
|
+
req.headers["content-type"] = "application/x-www-form-urlencoded";
|
3515
|
+
req.body = fmt::format("name={}", couchbase::core::utils::string_codec::form_encode(scope_name));
|
3516
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
3517
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
3518
|
+
REQUIRE(resp.status == 200);
|
3519
|
+
REQUIRE_FALSE(resp.headers.empty());
|
3520
|
+
if (integration.cluster_version().is_mock()) {
|
3521
|
+
REQUIRE(resp.headers["content-type"].find("application/json") == std::string::npos);
|
3522
|
+
REQUIRE(resp.headers["content-type"].find("text/plain") != std::string::npos);
|
3523
|
+
} else {
|
3032
3524
|
REQUIRE(resp.headers["content-type"].find("application/json") != std::string::npos);
|
3033
|
-
auto result = couchbase::core::utils::json::parse(resp.body);
|
3034
|
-
REQUIRE(result.is_object());
|
3035
|
-
REQUIRE(result.find("uid") != nullptr);
|
3036
3525
|
}
|
3526
|
+
auto result = couchbase::core::utils::json::parse(resp.body);
|
3527
|
+
REQUIRE(result.is_object());
|
3528
|
+
REQUIRE(result.find("uid") != nullptr);
|
3037
3529
|
}
|
3038
3530
|
|
3039
|
-
|
3040
|
-
|
3041
|
-
{
|
3042
|
-
|
3043
|
-
couchbase::core::operations::management::freeform_request req{};
|
3044
|
-
req.type = couchbase::core::service_type::eventing;
|
3045
|
-
req.method = "GET";
|
3046
|
-
req.path = "/api/v1/functions";
|
3047
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
3048
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
3049
|
-
REQUIRE(resp.status == 200);
|
3050
|
-
REQUIRE_FALSE(resp.body.empty());
|
3051
|
-
auto result = couchbase::core::utils::json::parse(resp.body);
|
3052
|
-
INFO(resp.body)
|
3053
|
-
REQUIRE(result.is_array());
|
3531
|
+
SECTION("eventing")
|
3532
|
+
{
|
3533
|
+
if (!integration.cluster_version().supports_eventing_functions()) {
|
3534
|
+
SKIP("cluster does not support eventing functions");
|
3054
3535
|
}
|
3536
|
+
if (!integration.has_eventing_service()) {
|
3537
|
+
SKIP("cluster does not have eventing service");
|
3538
|
+
}
|
3539
|
+
|
3540
|
+
couchbase::core::operations::management::freeform_request req{};
|
3541
|
+
req.type = couchbase::core::service_type::eventing;
|
3542
|
+
req.method = "GET";
|
3543
|
+
req.path = "/api/v1/functions";
|
3544
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
3545
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
3546
|
+
REQUIRE(resp.status == 200);
|
3547
|
+
REQUIRE_FALSE(resp.body.empty());
|
3548
|
+
auto result = couchbase::core::utils::json::parse(resp.body);
|
3549
|
+
INFO(resp.body);
|
3550
|
+
REQUIRE(result.is_array());
|
3055
3551
|
}
|
3056
3552
|
}
|
3057
3553
|
|
@@ -3094,8 +3590,11 @@ TEST_CASE("integration: eventing functions management", "[integration]")
|
|
3094
3590
|
{
|
3095
3591
|
test::utils::integration_test_guard integration;
|
3096
3592
|
|
3097
|
-
if (!integration.cluster_version().supports_eventing_functions()
|
3098
|
-
|
3593
|
+
if (!integration.cluster_version().supports_eventing_functions()) {
|
3594
|
+
SKIP("cluster does not support eventing service");
|
3595
|
+
}
|
3596
|
+
if (!integration.has_eventing_service()) {
|
3597
|
+
SKIP("cluster does not have eventing service");
|
3099
3598
|
}
|
3100
3599
|
|
3101
3600
|
if (!integration.cluster_version().supports_gcccp()) {
|