couchbase 3.4.2 → 3.4.4

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.
Files changed (355) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/couchbase/CMakeLists.txt +71 -7
  4. data/ext/couchbase/cmake/Documentation.cmake +0 -1
  5. data/ext/couchbase/cmake/OpenSSL.cmake +98 -3
  6. data/ext/couchbase/cmake/Testing.cmake +12 -4
  7. data/ext/couchbase/cmake/build_config.hxx.in +3 -0
  8. data/ext/couchbase/core/bucket.cxx +183 -151
  9. data/ext/couchbase/core/bucket.hxx +23 -1
  10. data/ext/couchbase/core/cluster.hxx +51 -13
  11. data/ext/couchbase/core/cluster_options.cxx +2 -2
  12. data/ext/couchbase/core/cluster_options.hxx +7 -6
  13. data/ext/couchbase/core/cluster_options_fwd.hxx +26 -0
  14. data/ext/couchbase/core/config_profile.hxx +1 -54
  15. data/ext/couchbase/core/config_profiles.cxx +79 -0
  16. data/ext/couchbase/core/config_profiles.hxx +56 -0
  17. data/ext/couchbase/core/crud_component.cxx +51 -22
  18. data/ext/couchbase/core/error_context/key_value.cxx +2 -1
  19. data/ext/couchbase/core/error_context/key_value.hxx +10 -12
  20. data/ext/couchbase/core/error_context/search.hxx +1 -1
  21. data/ext/couchbase/core/impl/analytics.cxx +1 -0
  22. data/ext/couchbase/core/impl/boolean_field_query.cxx +40 -0
  23. data/ext/couchbase/core/impl/boolean_query.cxx +62 -0
  24. data/ext/couchbase/core/impl/build_deferred_query_indexes.cxx +115 -50
  25. data/ext/couchbase/core/impl/cluster.cxx +8 -0
  26. data/ext/couchbase/core/impl/conjunction_query.cxx +51 -0
  27. data/ext/couchbase/core/impl/create_bucket.cxx +155 -0
  28. data/ext/couchbase/core/impl/create_query_index.cxx +172 -59
  29. data/ext/couchbase/core/impl/date_range.cxx +89 -0
  30. data/ext/couchbase/core/impl/date_range_facet.cxx +54 -0
  31. data/ext/couchbase/core/impl/date_range_facet_result.cxx +64 -0
  32. data/ext/couchbase/core/impl/date_range_query.cxx +125 -0
  33. data/ext/couchbase/core/impl/disjunction_query.cxx +51 -0
  34. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +2 -1
  35. data/ext/couchbase/core/impl/drop_bucket.cxx +66 -0
  36. data/ext/couchbase/core/impl/drop_query_index.cxx +138 -59
  37. data/ext/couchbase/core/impl/encoded_search_facet.hxx +29 -0
  38. data/ext/couchbase/core/impl/encoded_search_query.hxx +29 -0
  39. data/ext/couchbase/core/impl/encoded_search_sort.hxx +29 -0
  40. data/ext/couchbase/core/impl/flush_bucket.cxx +66 -0
  41. data/ext/couchbase/core/impl/geo_bounding_box_query.cxx +46 -0
  42. data/ext/couchbase/core/impl/geo_distance_query.cxx +43 -0
  43. data/ext/couchbase/core/impl/geo_polygon_query.cxx +46 -0
  44. data/ext/couchbase/core/impl/get_all_buckets.cxx +163 -0
  45. data/ext/couchbase/core/impl/get_all_query_indexes.cxx +67 -37
  46. data/ext/couchbase/core/impl/get_bucket.cxx +153 -0
  47. data/ext/couchbase/core/impl/internal_date_range_facet_result.cxx +80 -0
  48. data/ext/couchbase/core/impl/internal_date_range_facet_result.hxx +48 -0
  49. data/ext/couchbase/core/impl/internal_manager_error_context.cxx +113 -0
  50. data/ext/couchbase/core/impl/internal_manager_error_context.hxx +60 -0
  51. data/ext/couchbase/core/impl/internal_numeric_range_facet_result.cxx +80 -0
  52. data/ext/couchbase/core/impl/internal_numeric_range_facet_result.hxx +48 -0
  53. data/ext/couchbase/core/impl/internal_search_error_context.cxx +141 -0
  54. data/ext/couchbase/core/impl/internal_search_error_context.hxx +61 -0
  55. data/ext/couchbase/core/impl/internal_search_meta_data.cxx +60 -0
  56. data/ext/couchbase/core/impl/internal_search_meta_data.hxx +41 -0
  57. data/ext/couchbase/core/impl/internal_search_result.cxx +84 -0
  58. data/ext/couchbase/core/impl/internal_search_result.hxx +43 -0
  59. data/ext/couchbase/core/impl/internal_search_row.cxx +82 -0
  60. data/ext/couchbase/core/impl/internal_search_row.hxx +56 -0
  61. data/ext/couchbase/core/impl/internal_search_row_location.hxx +32 -0
  62. data/ext/couchbase/core/impl/internal_search_row_locations.cxx +137 -0
  63. data/ext/couchbase/core/impl/internal_search_row_locations.hxx +45 -0
  64. data/ext/couchbase/core/impl/internal_term_facet_result.cxx +80 -0
  65. data/ext/couchbase/core/impl/internal_term_facet_result.hxx +48 -0
  66. data/ext/couchbase/core/impl/key_value_error_category.cxx +2 -4
  67. data/ext/couchbase/core/impl/key_value_error_context.cxx +98 -0
  68. data/ext/couchbase/core/impl/lookup_in.cxx +1 -0
  69. data/ext/couchbase/core/impl/lookup_in_all_replicas.cxx +176 -0
  70. data/ext/couchbase/core/impl/lookup_in_all_replicas.hxx +80 -0
  71. data/ext/couchbase/core/impl/lookup_in_any_replica.cxx +167 -0
  72. data/ext/couchbase/core/impl/lookup_in_any_replica.hxx +75 -0
  73. data/ext/couchbase/core/impl/lookup_in_replica.cxx +97 -0
  74. data/ext/couchbase/core/impl/lookup_in_replica.hxx +67 -0
  75. data/ext/couchbase/core/impl/manager_error_context.cxx +100 -0
  76. data/ext/couchbase/core/impl/match_all_query.cxx +35 -0
  77. data/ext/couchbase/core/impl/match_none_query.cxx +35 -0
  78. data/ext/couchbase/core/impl/match_phrase_query.cxx +43 -0
  79. data/ext/couchbase/core/impl/match_query.cxx +59 -0
  80. data/ext/couchbase/core/impl/numeric_range.cxx +49 -0
  81. data/ext/couchbase/core/impl/numeric_range_facet.cxx +54 -0
  82. data/ext/couchbase/core/impl/numeric_range_facet_result.cxx +64 -0
  83. data/ext/couchbase/core/impl/numeric_range_query.cxx +56 -0
  84. data/ext/couchbase/core/impl/phrase_query.cxx +42 -0
  85. data/ext/couchbase/core/impl/prefix_query.cxx +40 -0
  86. data/ext/couchbase/core/impl/query.cxx +1 -0
  87. data/ext/couchbase/core/impl/query_error_context.cxx +75 -0
  88. data/ext/couchbase/core/impl/query_string_query.cxx +37 -0
  89. data/ext/couchbase/core/impl/regexp_query.cxx +40 -0
  90. data/ext/couchbase/core/impl/search.cxx +191 -0
  91. data/ext/couchbase/core/impl/search_error_context.cxx +147 -0
  92. data/ext/couchbase/core/impl/search_meta_data.cxx +46 -0
  93. data/ext/couchbase/core/impl/search_result.cxx +66 -0
  94. data/ext/couchbase/core/impl/search_row.cxx +74 -0
  95. data/ext/couchbase/core/impl/search_row_location.cxx +64 -0
  96. data/ext/couchbase/core/impl/search_row_locations.cxx +66 -0
  97. data/ext/couchbase/core/impl/search_sort_field.cxx +104 -0
  98. data/ext/couchbase/core/impl/search_sort_id.cxx +43 -0
  99. data/ext/couchbase/core/impl/search_sort_score.cxx +43 -0
  100. data/ext/couchbase/core/impl/term_facet.cxx +36 -0
  101. data/ext/couchbase/core/impl/term_facet_result.cxx +64 -0
  102. data/ext/couchbase/core/impl/term_query.cxx +56 -0
  103. data/ext/couchbase/core/impl/term_range_query.cxx +57 -0
  104. data/ext/couchbase/core/impl/update_bucket.cxx +130 -0
  105. data/ext/couchbase/core/impl/watch_query_indexes.cxx +53 -29
  106. data/ext/couchbase/core/impl/wildcard_query.cxx +40 -0
  107. data/ext/couchbase/core/io/dns_client.cxx +111 -40
  108. data/ext/couchbase/core/io/dns_config.cxx +5 -4
  109. data/ext/couchbase/core/io/http_context.hxx +1 -1
  110. data/ext/couchbase/core/io/http_session.hxx +34 -1
  111. data/ext/couchbase/core/io/http_session_manager.hxx +5 -3
  112. data/ext/couchbase/core/io/mcbp_command.hxx +9 -2
  113. data/ext/couchbase/core/io/mcbp_session.cxx +106 -42
  114. data/ext/couchbase/core/io/mcbp_session.hxx +4 -3
  115. data/ext/couchbase/core/io/retry_orchestrator.hxx +3 -2
  116. data/ext/couchbase/core/json_string.hxx +5 -0
  117. data/ext/couchbase/core/logger/custom_rotating_file_sink.cxx +1 -1
  118. data/ext/couchbase/core/logger/logger.cxx +80 -20
  119. data/ext/couchbase/core/logger/logger.hxx +31 -0
  120. data/ext/couchbase/core/meta/features.hxx +25 -0
  121. data/ext/couchbase/core/meta/version.cxx +18 -4
  122. data/ext/couchbase/core/mozilla_ca_bundle.hxx +39 -0
  123. data/ext/couchbase/core/operations/document_analytics.cxx +1 -0
  124. data/ext/couchbase/core/operations/document_analytics.hxx +1 -0
  125. data/ext/couchbase/core/operations/document_append.hxx +1 -1
  126. data/ext/couchbase/core/operations/document_decrement.hxx +1 -1
  127. data/ext/couchbase/core/operations/document_exists.hxx +1 -1
  128. data/ext/couchbase/core/operations/document_get.hxx +1 -1
  129. data/ext/couchbase/core/operations/document_get_and_lock.hxx +1 -1
  130. data/ext/couchbase/core/operations/document_get_and_touch.hxx +1 -1
  131. data/ext/couchbase/core/operations/document_get_projected.hxx +1 -1
  132. data/ext/couchbase/core/operations/document_increment.hxx +1 -1
  133. data/ext/couchbase/core/operations/document_insert.hxx +1 -1
  134. data/ext/couchbase/core/operations/document_lookup_in.hxx +1 -1
  135. data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +192 -0
  136. data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +188 -0
  137. data/ext/couchbase/core/operations/document_mutate_in.hxx +1 -1
  138. data/ext/couchbase/core/operations/document_prepend.hxx +1 -1
  139. data/ext/couchbase/core/operations/document_query.cxx +13 -0
  140. data/ext/couchbase/core/operations/document_query.hxx +7 -0
  141. data/ext/couchbase/core/operations/document_remove.hxx +1 -1
  142. data/ext/couchbase/core/operations/document_replace.hxx +1 -1
  143. data/ext/couchbase/core/operations/document_search.cxx +4 -1
  144. data/ext/couchbase/core/operations/document_search.hxx +2 -1
  145. data/ext/couchbase/core/operations/document_touch.hxx +1 -1
  146. data/ext/couchbase/core/operations/document_unlock.hxx +1 -1
  147. data/ext/couchbase/core/operations/document_upsert.hxx +1 -1
  148. data/ext/couchbase/core/operations/document_view.hxx +1 -0
  149. data/ext/couchbase/core/operations.hxx +2 -0
  150. data/ext/couchbase/core/origin.cxx +270 -0
  151. data/ext/couchbase/core/origin.hxx +2 -0
  152. data/ext/couchbase/core/protocol/client_request.hxx +11 -2
  153. data/ext/couchbase/core/protocol/client_response.hxx +1 -0
  154. data/ext/couchbase/core/protocol/cmd_hello.hxx +1 -0
  155. data/ext/couchbase/core/protocol/cmd_lookup_in_replica.cxx +107 -0
  156. data/ext/couchbase/core/protocol/cmd_lookup_in_replica.hxx +137 -0
  157. data/ext/couchbase/core/protocol/hello_feature.hxx +6 -0
  158. data/ext/couchbase/core/protocol/hello_feature_fmt.hxx +3 -0
  159. data/ext/couchbase/core/protocol/status.cxx +2 -2
  160. data/ext/couchbase/core/public_fwd.hxx +21 -0
  161. data/ext/couchbase/core/range_scan_options.cxx +3 -27
  162. data/ext/couchbase/core/range_scan_options.hxx +13 -17
  163. data/ext/couchbase/core/range_scan_orchestrator.cxx +388 -170
  164. data/ext/couchbase/core/range_scan_orchestrator.hxx +13 -2
  165. data/ext/couchbase/core/range_scan_orchestrator_options.hxx +5 -3
  166. data/ext/couchbase/core/scan_options.hxx +0 -19
  167. data/ext/couchbase/core/scan_result.cxx +19 -5
  168. data/ext/couchbase/core/scan_result.hxx +5 -2
  169. data/ext/couchbase/core/timeout_defaults.hxx +2 -3
  170. data/ext/couchbase/core/tls_verify_mode.hxx +26 -0
  171. data/ext/couchbase/core/topology/capabilities.hxx +3 -0
  172. data/ext/couchbase/core/topology/capabilities_fmt.hxx +8 -0
  173. data/ext/couchbase/core/topology/collections_manifest_fmt.hxx +1 -1
  174. data/ext/couchbase/core/topology/configuration.cxx +15 -2
  175. data/ext/couchbase/core/topology/configuration.hxx +20 -1
  176. data/ext/couchbase/core/topology/configuration_json.hxx +6 -1
  177. data/ext/couchbase/core/transactions/attempt_context_testing_hooks.cxx +93 -0
  178. data/ext/couchbase/core/transactions/attempt_context_testing_hooks.hxx +48 -75
  179. data/ext/couchbase/core/transactions/cleanup_testing_hooks.cxx +52 -0
  180. data/ext/couchbase/core/transactions/cleanup_testing_hooks.hxx +17 -31
  181. data/ext/couchbase/core/transactions/exceptions.hxx +12 -9
  182. data/ext/couchbase/core/utils/connection_string.cxx +75 -43
  183. data/ext/couchbase/core/utils/connection_string.hxx +1 -0
  184. data/ext/couchbase/core/utils/json.cxx +4 -1
  185. data/ext/couchbase/couchbase/analytics_error_context.hxx +1 -1
  186. data/ext/couchbase/couchbase/behavior_options.hxx +27 -1
  187. data/ext/couchbase/couchbase/boolean_field_query.hxx +77 -0
  188. data/ext/couchbase/couchbase/boolean_query.hxx +223 -0
  189. data/ext/couchbase/couchbase/bucket_manager.hxx +135 -0
  190. data/ext/couchbase/couchbase/build_query_index_options.hxx +0 -30
  191. data/ext/couchbase/couchbase/cluster.hxx +56 -1
  192. data/ext/couchbase/couchbase/collection.hxx +111 -0
  193. data/ext/couchbase/couchbase/collection_query_index_manager.hxx +7 -48
  194. data/ext/couchbase/couchbase/conjunction_query.hxx +88 -0
  195. data/ext/couchbase/couchbase/create_bucket_options.hxx +41 -0
  196. data/ext/couchbase/couchbase/create_primary_query_index_options.hxx +0 -29
  197. data/ext/couchbase/couchbase/create_query_index_options.hxx +0 -33
  198. data/ext/couchbase/couchbase/date_range.hxx +69 -0
  199. data/ext/couchbase/couchbase/date_range_facet.hxx +56 -0
  200. data/ext/couchbase/couchbase/date_range_facet_result.hxx +55 -0
  201. data/ext/couchbase/couchbase/date_range_query.hxx +265 -0
  202. data/ext/couchbase/couchbase/disjunction_query.hxx +109 -0
  203. data/ext/couchbase/couchbase/doc_id_query.hxx +111 -0
  204. data/ext/couchbase/couchbase/drop_bucket_options.hxx +41 -0
  205. data/ext/couchbase/couchbase/drop_primary_query_index_options.hxx +0 -30
  206. data/ext/couchbase/couchbase/drop_query_index_options.hxx +0 -31
  207. data/ext/couchbase/couchbase/error_codes.hxx +1 -2
  208. data/ext/couchbase/couchbase/error_context.hxx +17 -8
  209. data/ext/couchbase/couchbase/flush_bucket_options.hxx +41 -0
  210. data/ext/couchbase/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
  211. data/ext/couchbase/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
  212. data/ext/couchbase/couchbase/fmt/search_scan_consistency.hxx +49 -0
  213. data/ext/couchbase/couchbase/geo_bounding_box_query.hxx +107 -0
  214. data/ext/couchbase/couchbase/geo_distance_query.hxx +109 -0
  215. data/ext/couchbase/couchbase/geo_point.hxx +32 -0
  216. data/ext/couchbase/couchbase/geo_polygon_query.hxx +85 -0
  217. data/ext/couchbase/couchbase/get_all_buckets_options.hxx +44 -0
  218. data/ext/couchbase/couchbase/get_all_query_indexes_options.hxx +0 -30
  219. data/ext/couchbase/couchbase/get_and_lock_options.hxx +2 -2
  220. data/ext/couchbase/couchbase/get_and_touch_options.hxx +2 -2
  221. data/ext/couchbase/couchbase/get_bucket_options.hxx +43 -0
  222. data/ext/couchbase/couchbase/get_options.hxx +2 -2
  223. data/ext/couchbase/couchbase/highlight_style.hxx +45 -0
  224. data/ext/couchbase/couchbase/insert_options.hxx +3 -3
  225. data/ext/couchbase/couchbase/key_value_error_context.hxx +7 -2
  226. data/ext/couchbase/couchbase/lookup_in_all_replicas_options.hxx +109 -0
  227. data/ext/couchbase/couchbase/lookup_in_any_replica_options.hxx +101 -0
  228. data/ext/couchbase/couchbase/lookup_in_options.hxx +2 -2
  229. data/ext/couchbase/couchbase/lookup_in_replica_result.hxx +74 -0
  230. data/ext/couchbase/couchbase/lookup_in_result.hxx +26 -0
  231. data/ext/couchbase/couchbase/management/bucket_settings.hxx +116 -0
  232. data/ext/couchbase/couchbase/manager_error_context.hxx +29 -53
  233. data/ext/couchbase/couchbase/match_all_query.hxx +43 -0
  234. data/ext/couchbase/couchbase/match_none_query.hxx +43 -0
  235. data/ext/couchbase/couchbase/match_operator.hxx +45 -0
  236. data/ext/couchbase/couchbase/match_phrase_query.hxx +108 -0
  237. data/ext/couchbase/couchbase/match_query.hxx +163 -0
  238. data/ext/couchbase/couchbase/mutate_in_options.hxx +2 -2
  239. data/ext/couchbase/couchbase/numeric_range.hxx +58 -0
  240. data/ext/couchbase/couchbase/numeric_range_facet.hxx +56 -0
  241. data/ext/couchbase/couchbase/numeric_range_facet_result.hxx +55 -0
  242. data/ext/couchbase/couchbase/numeric_range_query.hxx +143 -0
  243. data/ext/couchbase/couchbase/phrase_query.hxx +93 -0
  244. data/ext/couchbase/couchbase/prefix_query.hxx +82 -0
  245. data/ext/couchbase/couchbase/query_error_context.hxx +3 -1
  246. data/ext/couchbase/couchbase/query_index_manager.hxx +16 -83
  247. data/ext/couchbase/couchbase/query_options.hxx +18 -0
  248. data/ext/couchbase/couchbase/query_string_query.hxx +72 -0
  249. data/ext/couchbase/couchbase/regexp_query.hxx +82 -0
  250. data/ext/couchbase/couchbase/remove_options.hxx +2 -2
  251. data/ext/couchbase/couchbase/replace_options.hxx +3 -3
  252. data/ext/couchbase/couchbase/scope.hxx +40 -0
  253. data/ext/couchbase/couchbase/search_date_range.hxx +68 -0
  254. data/ext/couchbase/couchbase/search_error_context.hxx +138 -0
  255. data/ext/couchbase/couchbase/search_facet.hxx +60 -0
  256. data/ext/couchbase/couchbase/search_facet_result.hxx +50 -0
  257. data/ext/couchbase/couchbase/search_meta_data.hxx +85 -0
  258. data/ext/couchbase/couchbase/search_metrics.hxx +127 -0
  259. data/ext/couchbase/couchbase/search_numeric_range.hxx +69 -0
  260. data/ext/couchbase/couchbase/search_options.hxx +509 -0
  261. data/ext/couchbase/couchbase/search_query.hxx +69 -0
  262. data/ext/couchbase/couchbase/search_result.hxx +77 -0
  263. data/ext/couchbase/couchbase/search_row.hxx +104 -0
  264. data/ext/couchbase/couchbase/search_row_location.hxx +55 -0
  265. data/ext/couchbase/couchbase/search_row_locations.hxx +86 -0
  266. data/ext/couchbase/couchbase/search_scan_consistency.hxx +34 -0
  267. data/ext/couchbase/couchbase/search_sort.hxx +58 -0
  268. data/ext/couchbase/couchbase/search_sort_field.hxx +117 -0
  269. data/ext/couchbase/couchbase/search_sort_field_missing.hxx +26 -0
  270. data/ext/couchbase/couchbase/search_sort_field_mode.hxx +27 -0
  271. data/ext/couchbase/couchbase/search_sort_field_type.hxx +28 -0
  272. data/ext/couchbase/couchbase/search_sort_id.hxx +60 -0
  273. data/ext/couchbase/couchbase/search_sort_score.hxx +60 -0
  274. data/ext/couchbase/couchbase/search_term_range.hxx +51 -0
  275. data/ext/couchbase/couchbase/security_options.hxx +18 -0
  276. data/ext/couchbase/couchbase/subdocument_error_context.hxx +4 -2
  277. data/ext/couchbase/couchbase/term_facet.hxx +48 -0
  278. data/ext/couchbase/couchbase/term_facet_result.hxx +55 -0
  279. data/ext/couchbase/couchbase/term_query.hxx +151 -0
  280. data/ext/couchbase/couchbase/term_range_query.hxx +142 -0
  281. data/ext/couchbase/couchbase/touch_options.hxx +2 -2
  282. data/ext/couchbase/couchbase/tracing/request_span.hxx +63 -0
  283. data/ext/couchbase/couchbase/tracing/request_tracer.hxx +2 -40
  284. data/ext/couchbase/couchbase/transactions/async_attempt_context.hxx +83 -4
  285. data/ext/couchbase/couchbase/transactions/attempt_context.hxx +67 -0
  286. data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +2 -0
  287. data/ext/couchbase/couchbase/transactions/transaction_keyspace.hxx +11 -1
  288. data/ext/couchbase/couchbase/transactions/transaction_options.hxx +79 -8
  289. data/ext/couchbase/couchbase/transactions/transaction_query_options.hxx +128 -15
  290. data/ext/couchbase/couchbase/transactions/transaction_query_result.hxx +4 -0
  291. data/ext/couchbase/couchbase/transactions/transaction_result.hxx +1 -1
  292. data/ext/couchbase/couchbase/transactions/transactions_cleanup_config.hxx +5 -3
  293. data/ext/couchbase/couchbase/transactions/transactions_config.hxx +9 -5
  294. data/ext/couchbase/couchbase/transactions/transactions_query_config.hxx +6 -3
  295. data/ext/couchbase/couchbase/transactions.hxx +34 -1
  296. data/ext/couchbase/couchbase/unlock_options.hxx +2 -2
  297. data/ext/couchbase/couchbase/update_bucket_options.hxx +41 -0
  298. data/ext/couchbase/couchbase/upsert_options.hxx +3 -3
  299. data/ext/couchbase/couchbase/watch_query_indexes_options.hxx +0 -31
  300. data/ext/couchbase/couchbase/wildcard_query.hxx +83 -0
  301. data/ext/couchbase/test/CMakeLists.txt +8 -5
  302. data/ext/couchbase/test/benchmark_helper_integration.hxx +2 -2
  303. data/ext/couchbase/test/test_helper.hxx +5 -5
  304. data/ext/couchbase/test/test_integration_analytics.cxx +28 -6
  305. data/ext/couchbase/test/test_integration_collections.cxx +13 -3
  306. data/ext/couchbase/test/test_integration_connect.cxx +7 -3
  307. data/ext/couchbase/test/test_integration_crud.cxx +18 -3
  308. data/ext/couchbase/test/test_integration_diagnostics.cxx +11 -5
  309. data/ext/couchbase/test/test_integration_durability.cxx +12 -7
  310. data/ext/couchbase/test/test_integration_examples.cxx +419 -11
  311. data/ext/couchbase/test/test_integration_management.cxx +867 -368
  312. data/ext/couchbase/test/test_integration_query.cxx +87 -17
  313. data/ext/couchbase/test/test_integration_range_scan.cxx +363 -124
  314. data/ext/couchbase/test/test_integration_read_replica.cxx +48 -11
  315. data/ext/couchbase/test/test_integration_search.cxx +32 -3
  316. data/ext/couchbase/test/test_integration_subdoc.cxx +717 -11
  317. data/ext/couchbase/test/test_integration_tracer.cxx +5 -0
  318. data/ext/couchbase/test/test_integration_transcoders.cxx +13 -5
  319. data/ext/couchbase/test/{test_transaction_transaction_context.cxx → test_transaction_context.cxx} +1 -1
  320. data/ext/couchbase/test/test_transaction_examples.cxx +195 -0
  321. data/ext/couchbase/test/{test_transaction_transaction_public_async_api.cxx → test_transaction_public_async_api.cxx} +13 -12
  322. data/ext/couchbase/test/{test_transaction_transaction_public_blocking_api.cxx → test_transaction_public_blocking_api.cxx} +27 -21
  323. data/ext/couchbase/test/{test_transaction_transaction_simple.cxx → test_transaction_simple.cxx} +17 -5
  324. data/ext/couchbase/test/{test_transaction_transaction_simple_async.cxx → test_transaction_simple_async.cxx} +19 -21
  325. data/ext/couchbase/test/test_unit_config_profiles.cxx +1 -1
  326. data/ext/couchbase/test/test_unit_connection_string.cxx +29 -0
  327. data/ext/couchbase/test/test_unit_json_transcoder.cxx +4 -0
  328. data/ext/couchbase/test/test_unit_query.cxx +75 -0
  329. data/ext/couchbase/test/test_unit_search.cxx +427 -0
  330. data/ext/couchbase/test/test_unit_transaction_utils.cxx +10 -1
  331. data/ext/couchbase/test/test_unit_utils.cxx +8 -4
  332. data/ext/couchbase.cxx +641 -45
  333. data/ext/revisions.rb +3 -3
  334. data/lib/couchbase/authenticator.rb +0 -1
  335. data/lib/couchbase/cluster.rb +1 -5
  336. data/lib/couchbase/collection.rb +108 -0
  337. data/lib/couchbase/collection_options.rb +100 -0
  338. data/lib/couchbase/config_profiles.rb +1 -1
  339. data/lib/couchbase/errors.rb +5 -0
  340. data/lib/couchbase/json_transcoder.rb +12 -5
  341. data/lib/couchbase/key_value_scan.rb +125 -0
  342. data/lib/couchbase/management/collection_query_index_manager.rb +54 -15
  343. data/lib/couchbase/management/query_index_manager.rb +70 -5
  344. data/lib/couchbase/options.rb +151 -0
  345. data/lib/couchbase/raw_binary_transcoder.rb +37 -0
  346. data/lib/couchbase/raw_json_transcoder.rb +38 -0
  347. data/lib/couchbase/raw_string_transcoder.rb +40 -0
  348. data/lib/couchbase/scope.rb +1 -1
  349. data/lib/couchbase/search_options.rb +5 -0
  350. data/lib/couchbase/transcoder_flags.rb +62 -0
  351. data/lib/couchbase/utils/time.rb +14 -1
  352. data/lib/couchbase/version.rb +1 -1
  353. metadata +175 -13
  354. data/ext/couchbase/core/config_profile.cxx +0 -47
  355. 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
- return;
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
- couchbase::core::management::cluster::bucket_settings bucket_settings;
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::operations::management::bucket_create_request req;
89
- req.bucket = bucket_settings;
90
- auto resp = test::utils::execute(integration.cluster, req);
91
- REQUIRE_SUCCESS(resp.ctx.ec);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
96
- REQUIRE_SUCCESS(resp.ctx.ec);
97
- REQUIRE(bucket_settings.bucket_type == resp.bucket.bucket_type);
98
- REQUIRE(bucket_settings.name == resp.bucket.name);
99
- REQUIRE(Approx(bucket_settings.ram_quota_mb).margin(5) == resp.bucket.ram_quota_mb);
100
- REQUIRE(bucket_settings.num_replicas == resp.bucket.num_replicas);
101
- REQUIRE(bucket_settings.flush_enabled == resp.bucket.flush_enabled);
102
- REQUIRE(bucket_settings.max_expiry == resp.bucket.max_expiry);
103
- REQUIRE(bucket_settings.eviction_policy == resp.bucket.eviction_policy);
104
- REQUIRE(bucket_settings.compression_mode == resp.bucket.compression_mode);
105
- REQUIRE(bucket_settings.replica_indexes == resp.bucket.replica_indexes);
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
- std::uint64_t old_quota_mb{ 0 };
176
+ SECTION("public API")
108
177
  {
109
- couchbase::core::operations::management::bucket_get_all_request req{};
110
- auto resp = test::utils::execute(integration.cluster, req);
111
- INFO(resp.ctx.http_body)
112
- REQUIRE_SUCCESS(resp.ctx.ec);
113
- bool found = false;
114
- for (const auto& bucket : resp.buckets) {
115
- if (bucket.name != bucket_name) {
116
- continue;
117
- }
118
- found = true;
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
- REQUIRE(found);
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
- bucket_settings.ram_quota_mb = old_quota_mb + 20;
136
- couchbase::core::operations::management::bucket_update_request req;
137
- req.bucket = bucket_settings;
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
- auto ram_quota_updated = test::utils::wait_until([&integration, &bucket_name, old_quota_mb]() {
143
- couchbase::core::operations::management::bucket_get_request req{ bucket_name };
144
- auto resp = test::utils::execute(integration.cluster, req);
145
- return !resp.ctx.ec && resp.bucket.ram_quota_mb > old_quota_mb;
146
- });
147
- REQUIRE(ram_quota_updated);
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
- couchbase::core::operations::management::bucket_get_all_request req;
163
- auto resp = test::utils::execute(integration.cluster, req);
164
- REQUIRE_SUCCESS(resp.ctx.ec);
165
- REQUIRE(!resp.buckets.empty());
166
- auto known_buckets =
167
- std::count_if(resp.buckets.begin(), resp.buckets.end(), [&bucket_name](auto& entry) { return entry.name == bucket_name; });
168
- REQUIRE(known_buckets == 0);
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
- SECTION("flush")
173
- {
174
- SECTION("flush item")
175
- {
176
- couchbase::core::document_id id{ bucket_name, "_default", "_default", test::utils::uniq_id("foo") };
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::bucket_create_request req;
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
- REQUIRE_SUCCESS(resp.ctx.ec);
324
+ REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
184
325
  }
185
326
 
186
- REQUIRE(test::utils::wait_until_bucket_healthy(integration.cluster, bucket_name));
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
- test::utils::open_bucket(integration.cluster, bucket_name);
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
- const tao::json::value value = {
192
- { "a", 1.0 },
193
- };
194
- couchbase::core::operations::insert_request req{ id, couchbase::core::utils::json::generate_binary(value) };
195
- auto resp = test::utils::execute(integration.cluster, req);
196
- REQUIRE_SUCCESS(resp.ctx.ec());
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
- couchbase::core::operations::get_request req{ id };
201
- auto resp = test::utils::execute(integration.cluster, req);
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
- couchbase::core::operations::management::bucket_flush_request req{ bucket_name };
207
- auto resp = test::utils::execute(integration.cluster, req);
208
- REQUIRE_SUCCESS(resp.ctx.ec);
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
- auto flushed = test::utils::wait_until([&integration, id]() {
212
- couchbase::core::operations::get_request req{ id };
213
- auto resp = test::utils::execute(integration.cluster, req);
214
- return resp.ctx.ec() == couchbase::errc::key_value::document_not_found;
215
- });
216
- REQUIRE(flushed);
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
- SECTION("no bucket")
419
+ if (integration.cluster_version().supports_memcached_buckets()) {
420
+ SECTION("memcached")
220
421
  {
221
- couchbase::core::operations::management::bucket_flush_request req{ bucket_name };
222
- auto resp = test::utils::execute(integration.cluster, req);
223
- REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
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
- SECTION("flush disabled")
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
- couchbase::core::operations::management::bucket_create_request req;
230
- req.bucket.name = bucket_name;
231
- req.bucket.flush_enabled = false;
232
- auto resp = test::utils::execute(integration.cluster, req);
233
- REQUIRE_SUCCESS(resp.ctx.ec);
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
- REQUIRE(test::utils::wait_until_bucket_healthy(integration.cluster, bucket_name));
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
- couchbase::core::operations::management::bucket_flush_request req{ bucket_name };
240
- auto resp = test::utils::execute(integration.cluster, req);
241
- REQUIRE(resp.ctx.ec == couchbase::errc::management::bucket_not_flushable);
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
- if (integration.cluster_version().supports_memcached_buckets()) {
247
- SECTION("memcached")
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
- couchbase::core::management::cluster::bucket_settings bucket_settings;
251
- bucket_settings.name = bucket_name;
252
- bucket_settings.bucket_type = couchbase::core::management::cluster::bucket_type::memcached;
253
- bucket_settings.num_replicas = 0;
254
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
255
- auto resp = test::utils::execute(integration.cluster, req);
256
- REQUIRE_SUCCESS(resp.ctx.ec);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
261
- REQUIRE_SUCCESS(resp.ctx.ec);
262
- REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::memcached);
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
- couchbase::core::management::cluster::bucket_settings bucket_settings;
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
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
277
- auto resp = test::utils::execute(integration.cluster, req);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
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
- SECTION("nru eviction")
290
- {
291
- {
292
- bucket_settings.eviction_policy = couchbase::core::management::cluster::bucket_eviction_policy::not_recently_used;
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
300
- REQUIRE_SUCCESS(resp.ctx.ec);
301
- REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::ephemeral);
302
- REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::not_recently_used);
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
- if (integration.cluster_version().supports_storage_backend()) {
307
- SECTION("storage backend")
622
+ SECTION("full eviction")
308
623
  {
309
624
  {
310
- bucket_settings.storage_backend = couchbase::core::management::cluster::bucket_storage_backend::couchstore;
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::ephemeral);
320
- REQUIRE(resp.bucket.storage_backend == couchbase::core::management::cluster::bucket_storage_backend::unknown);
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
- SECTION("default eviction")
333
- {
334
- {
335
-
336
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
337
- auto resp = test::utils::execute(integration.cluster, req);
338
- REQUIRE_SUCCESS(resp.ctx.ec);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
343
- REQUIRE_SUCCESS(resp.ctx.ec);
344
- REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
345
- REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::value_only);
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
- bucket_settings.eviction_policy = couchbase::core::management::cluster::bucket_eviction_policy::full;
353
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
354
- auto resp = test::utils::execute(integration.cluster, req);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
360
- REQUIRE_SUCCESS(resp.ctx.ec);
361
- REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
362
- REQUIRE(resp.bucket.eviction_policy == couchbase::core::management::cluster::bucket_eviction_policy::full);
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
- if (integration.cluster_version().supports_storage_backend()) {
367
- SECTION("storage backend")
707
+ SECTION("full eviction")
368
708
  {
369
- SECTION("couchstore")
370
709
  {
371
- {
372
- bucket_settings.storage_backend = couchbase::core::management::cluster::bucket_storage_backend::couchstore;
373
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
374
- auto resp = test::utils::execute(integration.cluster, req);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
380
- REQUIRE_SUCCESS(resp.ctx.ec);
381
- REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
382
- REQUIRE(resp.bucket.storage_backend == couchbase::core::management::cluster::bucket_storage_backend::couchstore);
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
- SECTION("magma")
728
+ if (integration.cluster_version().supports_storage_backend()) {
729
+ SECTION("storage backend")
387
730
  {
731
+ SECTION("couchstore")
388
732
  {
389
- bucket_settings.ram_quota_mb = integration.cluster_version().is_neo() ? 1'024 : 256;
390
- bucket_settings.storage_backend = couchbase::core::management::cluster::bucket_storage_backend::magma;
391
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
392
- auto resp = test::utils::execute(integration.cluster, req);
393
- REQUIRE_SUCCESS(resp.ctx.ec);
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
- auto resp = wait_for_bucket_created(integration, bucket_name);
398
- REQUIRE_SUCCESS(resp.ctx.ec);
399
- REQUIRE(resp.bucket.bucket_type == couchbase::core::management::cluster::bucket_type::couchbase);
400
- REQUIRE(resp.bucket.storage_backend == couchbase::core::management::cluster::bucket_storage_backend::magma);
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
- couchbase::core::management::cluster::bucket_settings bucket_settings;
411
- bucket_settings.name = bucket_name;
412
- couchbase::core::operations::management::bucket_update_request req;
413
- req.bucket = bucket_settings;
414
- auto resp = test::utils::execute(integration.cluster, req);
415
- REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
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
- couchbase::core::management::cluster::bucket_settings bucket_settings;
422
- bucket_settings.name = bucket_name;
423
-
424
- SECTION("default")
802
+ SECTION("core api")
425
803
  {
426
- {
427
- couchbase::core::operations::management::bucket_create_request req{ bucket_settings };
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
- if (integration.number_of_nodes() >= 2) {
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::majority);
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
- return;
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
- return;
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
- return;
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() || !integration.cluster_version().supports_collections() ||
961
- integration.cluster_version().is_community()) {
962
- return;
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
- return;
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 ctx.ec() != couchbase::errc::common::bucket_not_found;
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
- SECTION("public API")
1944
- {
1945
- couchbase::cluster c(integration.cluster);
1946
- auto coll = c.bucket(integration.ctx.bucket).scope(scope_name).collection("missing_collection");
1947
- REQUIRE(coll.query_indexes()
1948
- .watch_indexes({ index_name }, couchbase::watch_query_indexes_options().timeout(std::chrono::seconds(5)))
1949
- .get()
1950
- .ec() == couchbase::errc::common::ambiguous_timeout);
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() || !integration.has_analytics_service()) {
1960
- return;
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
- return;
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().supports_analytics_links() || !integration.has_analytics_service()) {
2492
- return;
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
- return;
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
- return;
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": { "indexType": "upside_down", "kvStoreName": "moss" }})";
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
- return;
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
- if (integration.cluster_version().supports_analytics() && integration.has_analytics_service()) {
2936
- SECTION("analytics")
2937
- {
2938
- couchbase::core::operations::management::freeform_request req{};
2939
- req.type = couchbase::core::service_type::analytics;
2940
- req.method = "GET";
2941
- req.path = "/admin/ping";
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
- if (integration.cluster_version().supports_views()) {
2982
- SECTION("view")
2983
- {
2984
- auto document_name = test::utils::uniq_id("design_document");
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
- if (integration.cluster_version().supports_collections()) {
3018
- SECTION("create scope")
3019
- {
3020
- auto scope_name = test::utils::uniq_id("freeform_scope");
3502
+ SECTION("create scope")
3503
+ {
3504
+ if (!integration.cluster_version().supports_collections()) {
3505
+ SKIP("cluster does not support collections");
3506
+ }
3021
3507
 
3022
- couchbase::core::operations::management::freeform_request req{};
3023
- req.type = couchbase::core::service_type::management;
3024
- req.method = "POST";
3025
- req.path = fmt::format("/pools/default/buckets/{}/scopes", integration.ctx.bucket);
3026
- req.headers["content-type"] = "application/x-www-form-urlencoded";
3027
- req.body = fmt::format("name={}", couchbase::core::utils::string_codec::form_encode(scope_name));
3028
- auto resp = test::utils::execute(integration.cluster, req);
3029
- REQUIRE_SUCCESS(resp.ctx.ec);
3030
- REQUIRE(resp.status == 200);
3031
- REQUIRE_FALSE(resp.headers.empty());
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
- if (integration.cluster_version().supports_eventing_functions() && integration.has_eventing_service()) {
3040
- SECTION("eventing")
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() || !integration.has_eventing_service()) {
3098
- return;
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()) {