opensearch-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/.gitignore +17 -0
  4. data/Gemfile +48 -0
  5. data/LICENSE +202 -0
  6. data/README.md +194 -0
  7. data/Rakefile +131 -0
  8. data/lib/opensearch/api/actions/abort_benchmark.rb +49 -0
  9. data/lib/opensearch/api/actions/benchmark.rb +89 -0
  10. data/lib/opensearch/api/actions/bulk.rb +97 -0
  11. data/lib/opensearch/api/actions/cat/aliases.rb +79 -0
  12. data/lib/opensearch/api/actions/cat/allocation.rb +81 -0
  13. data/lib/opensearch/api/actions/cat/count.rb +75 -0
  14. data/lib/opensearch/api/actions/cat/fielddata.rb +77 -0
  15. data/lib/opensearch/api/actions/cat/health.rb +72 -0
  16. data/lib/opensearch/api/actions/cat/help.rb +61 -0
  17. data/lib/opensearch/api/actions/cat/indices.rb +91 -0
  18. data/lib/opensearch/api/actions/cat/master.rb +71 -0
  19. data/lib/opensearch/api/actions/cat/nodeattrs.rb +71 -0
  20. data/lib/opensearch/api/actions/cat/nodes.rb +80 -0
  21. data/lib/opensearch/api/actions/cat/params_registry.rb +69 -0
  22. data/lib/opensearch/api/actions/cat/pending_tasks.rb +74 -0
  23. data/lib/opensearch/api/actions/cat/plugins.rb +73 -0
  24. data/lib/opensearch/api/actions/cat/recovery.rb +84 -0
  25. data/lib/opensearch/api/actions/cat/repositories.rb +72 -0
  26. data/lib/opensearch/api/actions/cat/segments.rb +76 -0
  27. data/lib/opensearch/api/actions/cat/shards.rb +83 -0
  28. data/lib/opensearch/api/actions/cat/snapshots.rb +80 -0
  29. data/lib/opensearch/api/actions/cat/tasks.rb +77 -0
  30. data/lib/opensearch/api/actions/cat/templates.rb +78 -0
  31. data/lib/opensearch/api/actions/cat/thread_pool.rb +82 -0
  32. data/lib/opensearch/api/actions/clear_scroll.rb +62 -0
  33. data/lib/opensearch/api/actions/close_point_in_time.rb +50 -0
  34. data/lib/opensearch/api/actions/cluster/allocation_explain.rb +67 -0
  35. data/lib/opensearch/api/actions/cluster/delete_component_template.rb +66 -0
  36. data/lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb +59 -0
  37. data/lib/opensearch/api/actions/cluster/exists_component_template.rb +68 -0
  38. data/lib/opensearch/api/actions/cluster/get_component_template.rb +68 -0
  39. data/lib/opensearch/api/actions/cluster/get_settings.rb +65 -0
  40. data/lib/opensearch/api/actions/cluster/health.rb +86 -0
  41. data/lib/opensearch/api/actions/cluster/params_registry.rb +69 -0
  42. data/lib/opensearch/api/actions/cluster/pending_tasks.rb +62 -0
  43. data/lib/opensearch/api/actions/cluster/post_voting_config_exclusions.rb +63 -0
  44. data/lib/opensearch/api/actions/cluster/put_component_template.rb +70 -0
  45. data/lib/opensearch/api/actions/cluster/put_settings.rb +66 -0
  46. data/lib/opensearch/api/actions/cluster/remote_info.rb +51 -0
  47. data/lib/opensearch/api/actions/cluster/reroute.rb +70 -0
  48. data/lib/opensearch/api/actions/cluster/state.rb +85 -0
  49. data/lib/opensearch/api/actions/cluster/stats.rb +68 -0
  50. data/lib/opensearch/api/actions/count.rb +101 -0
  51. data/lib/opensearch/api/actions/create.rb +61 -0
  52. data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +68 -0
  53. data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +67 -0
  54. data/lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb +51 -0
  55. data/lib/opensearch/api/actions/dangling_indices/params_registry.rb +69 -0
  56. data/lib/opensearch/api/actions/delete.rb +96 -0
  57. data/lib/opensearch/api/actions/delete_by_query.rb +140 -0
  58. data/lib/opensearch/api/actions/delete_by_query_rethrottle.rb +62 -0
  59. data/lib/opensearch/api/actions/delete_by_rethrottle.rb +55 -0
  60. data/lib/opensearch/api/actions/delete_script.rb +64 -0
  61. data/lib/opensearch/api/actions/exists.rb +101 -0
  62. data/lib/opensearch/api/actions/exists_source.rb +96 -0
  63. data/lib/opensearch/api/actions/explain.rb +106 -0
  64. data/lib/opensearch/api/actions/features/get_features.rb +59 -0
  65. data/lib/opensearch/api/actions/features/params_registry.rb +69 -0
  66. data/lib/opensearch/api/actions/features/reset_features.rb +55 -0
  67. data/lib/opensearch/api/actions/field_caps.rb +78 -0
  68. data/lib/opensearch/api/actions/get.rb +100 -0
  69. data/lib/opensearch/api/actions/get_script.rb +62 -0
  70. data/lib/opensearch/api/actions/get_script_context.rb +53 -0
  71. data/lib/opensearch/api/actions/get_script_languages.rb +53 -0
  72. data/lib/opensearch/api/actions/get_source.rb +94 -0
  73. data/lib/opensearch/api/actions/index.rb +103 -0
  74. data/lib/opensearch/api/actions/indices/add_block.rb +76 -0
  75. data/lib/opensearch/api/actions/indices/analyze.rb +71 -0
  76. data/lib/opensearch/api/actions/indices/clear_cache.rb +79 -0
  77. data/lib/opensearch/api/actions/indices/clone.rb +73 -0
  78. data/lib/opensearch/api/actions/indices/close.rb +74 -0
  79. data/lib/opensearch/api/actions/indices/create.rb +71 -0
  80. data/lib/opensearch/api/actions/indices/delete.rb +76 -0
  81. data/lib/opensearch/api/actions/indices/delete_alias.rb +72 -0
  82. data/lib/opensearch/api/actions/indices/delete_index_template.rb +66 -0
  83. data/lib/opensearch/api/actions/indices/delete_template.rb +70 -0
  84. data/lib/opensearch/api/actions/indices/disk_usage.rb +76 -0
  85. data/lib/opensearch/api/actions/indices/exists.rb +79 -0
  86. data/lib/opensearch/api/actions/indices/exists_alias.rb +82 -0
  87. data/lib/opensearch/api/actions/indices/exists_index_template.rb +70 -0
  88. data/lib/opensearch/api/actions/indices/exists_template.rb +73 -0
  89. data/lib/opensearch/api/actions/indices/exists_type.rb +79 -0
  90. data/lib/opensearch/api/actions/indices/field_usage_stats.rb +74 -0
  91. data/lib/opensearch/api/actions/indices/flush.rb +74 -0
  92. data/lib/opensearch/api/actions/indices/flush_synced.rb +79 -0
  93. data/lib/opensearch/api/actions/indices/forcemerge.rb +76 -0
  94. data/lib/opensearch/api/actions/indices/get.rb +78 -0
  95. data/lib/opensearch/api/actions/indices/get_alias.rb +79 -0
  96. data/lib/opensearch/api/actions/indices/get_field_mapping.rb +92 -0
  97. data/lib/opensearch/api/actions/indices/get_index_template.rb +70 -0
  98. data/lib/opensearch/api/actions/indices/get_mapping.rb +88 -0
  99. data/lib/opensearch/api/actions/indices/get_settings.rb +85 -0
  100. data/lib/opensearch/api/actions/indices/get_template.rb +72 -0
  101. data/lib/opensearch/api/actions/indices/get_upgrade.rb +75 -0
  102. data/lib/opensearch/api/actions/indices/open.rb +74 -0
  103. data/lib/opensearch/api/actions/indices/params_registry.rb +69 -0
  104. data/lib/opensearch/api/actions/indices/put_alias.rb +73 -0
  105. data/lib/opensearch/api/actions/indices/put_index_template.rb +70 -0
  106. data/lib/opensearch/api/actions/indices/put_mapping.rb +91 -0
  107. data/lib/opensearch/api/actions/indices/put_settings.rb +81 -0
  108. data/lib/opensearch/api/actions/indices/put_template.rb +72 -0
  109. data/lib/opensearch/api/actions/indices/recovery.rb +68 -0
  110. data/lib/opensearch/api/actions/indices/refresh.rb +70 -0
  111. data/lib/opensearch/api/actions/indices/resolve_index.rb +68 -0
  112. data/lib/opensearch/api/actions/indices/rollover.rb +81 -0
  113. data/lib/opensearch/api/actions/indices/segments.rb +72 -0
  114. data/lib/opensearch/api/actions/indices/shard_stores.rb +72 -0
  115. data/lib/opensearch/api/actions/indices/shrink.rb +75 -0
  116. data/lib/opensearch/api/actions/indices/simulate_index_template.rb +69 -0
  117. data/lib/opensearch/api/actions/indices/simulate_template.rb +71 -0
  118. data/lib/opensearch/api/actions/indices/split.rb +75 -0
  119. data/lib/opensearch/api/actions/indices/stats.rb +100 -0
  120. data/lib/opensearch/api/actions/indices/update_aliases.rb +64 -0
  121. data/lib/opensearch/api/actions/indices/upgrade.rb +79 -0
  122. data/lib/opensearch/api/actions/indices/validate_query.rb +104 -0
  123. data/lib/opensearch/api/actions/info.rb +49 -0
  124. data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +66 -0
  125. data/lib/opensearch/api/actions/ingest/geo_ip_stats.rb +51 -0
  126. data/lib/opensearch/api/actions/ingest/get_pipeline.rb +68 -0
  127. data/lib/opensearch/api/actions/ingest/params_registry.rb +69 -0
  128. data/lib/opensearch/api/actions/ingest/processor_grok.rb +51 -0
  129. data/lib/opensearch/api/actions/ingest/put_pipeline.rb +68 -0
  130. data/lib/opensearch/api/actions/ingest/simulate.rb +69 -0
  131. data/lib/opensearch/api/actions/mget.rb +91 -0
  132. data/lib/opensearch/api/actions/msearch.rb +112 -0
  133. data/lib/opensearch/api/actions/msearch_template.rb +96 -0
  134. data/lib/opensearch/api/actions/mtermvectors.rb +107 -0
  135. data/lib/opensearch/api/actions/nodes/hot_threads.rb +81 -0
  136. data/lib/opensearch/api/actions/nodes/info.rb +75 -0
  137. data/lib/opensearch/api/actions/nodes/params_registry.rb +69 -0
  138. data/lib/opensearch/api/actions/nodes/reload_secure_settings.rb +67 -0
  139. data/lib/opensearch/api/actions/nodes/shutdown.rb +65 -0
  140. data/lib/opensearch/api/actions/nodes/stats.rb +96 -0
  141. data/lib/opensearch/api/actions/nodes/usage.rb +73 -0
  142. data/lib/opensearch/api/actions/open_point_in_time.rb +72 -0
  143. data/lib/opensearch/api/actions/params_registry.rb +67 -0
  144. data/lib/opensearch/api/actions/ping.rb +57 -0
  145. data/lib/opensearch/api/actions/put_script.rb +74 -0
  146. data/lib/opensearch/api/actions/rank_eval.rb +77 -0
  147. data/lib/opensearch/api/actions/reindex.rb +76 -0
  148. data/lib/opensearch/api/actions/reindex_rethrottle.rb +62 -0
  149. data/lib/opensearch/api/actions/remote/info.rb +45 -0
  150. data/lib/opensearch/api/actions/render_search_template.rb +62 -0
  151. data/lib/opensearch/api/actions/scripts_painless_execute.rb +59 -0
  152. data/lib/opensearch/api/actions/scroll.rb +78 -0
  153. data/lib/opensearch/api/actions/search.rb +165 -0
  154. data/lib/opensearch/api/actions/search_shards.rb +74 -0
  155. data/lib/opensearch/api/actions/search_template.rb +101 -0
  156. data/lib/opensearch/api/actions/shutdown/delete_node.rb +60 -0
  157. data/lib/opensearch/api/actions/shutdown/get_node.rb +62 -0
  158. data/lib/opensearch/api/actions/shutdown/params_registry.rb +69 -0
  159. data/lib/opensearch/api/actions/shutdown/put_node.rb +62 -0
  160. data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +66 -0
  161. data/lib/opensearch/api/actions/snapshot/clone.rb +74 -0
  162. data/lib/opensearch/api/actions/snapshot/create.rb +71 -0
  163. data/lib/opensearch/api/actions/snapshot/create_repository.rb +70 -0
  164. data/lib/opensearch/api/actions/snapshot/delete.rb +72 -0
  165. data/lib/opensearch/api/actions/snapshot/delete_repository.rb +70 -0
  166. data/lib/opensearch/api/actions/snapshot/get.rb +80 -0
  167. data/lib/opensearch/api/actions/snapshot/get_features.rb +59 -0
  168. data/lib/opensearch/api/actions/snapshot/get_repository.rb +72 -0
  169. data/lib/opensearch/api/actions/snapshot/params_registry.rb +69 -0
  170. data/lib/opensearch/api/actions/snapshot/repository_analyze.rb +84 -0
  171. data/lib/opensearch/api/actions/snapshot/restore.rb +71 -0
  172. data/lib/opensearch/api/actions/snapshot/status.rb +77 -0
  173. data/lib/opensearch/api/actions/snapshot/verify_repository.rb +66 -0
  174. data/lib/opensearch/api/actions/tasks/cancel.rb +76 -0
  175. data/lib/opensearch/api/actions/tasks/get.rb +68 -0
  176. data/lib/opensearch/api/actions/tasks/list.rb +75 -0
  177. data/lib/opensearch/api/actions/tasks/params_registry.rb +69 -0
  178. data/lib/opensearch/api/actions/termvectors.rb +115 -0
  179. data/lib/opensearch/api/actions/update.rb +106 -0
  180. data/lib/opensearch/api/actions/update_by_query.rb +144 -0
  181. data/lib/opensearch/api/actions/update_by_query_rethrottle.rb +62 -0
  182. data/lib/opensearch/api/namespace/cat.rb +45 -0
  183. data/lib/opensearch/api/namespace/cluster.rb +46 -0
  184. data/lib/opensearch/api/namespace/common.rb +53 -0
  185. data/lib/opensearch/api/namespace/dangling_indices.rb +44 -0
  186. data/lib/opensearch/api/namespace/features.rb +45 -0
  187. data/lib/opensearch/api/namespace/indices.rb +46 -0
  188. data/lib/opensearch/api/namespace/ingest.rb +46 -0
  189. data/lib/opensearch/api/namespace/nodes.rb +46 -0
  190. data/lib/opensearch/api/namespace/remote.rb +46 -0
  191. data/lib/opensearch/api/namespace/security.rb +45 -0
  192. data/lib/opensearch/api/namespace/shutdown.rb +46 -0
  193. data/lib/opensearch/api/namespace/snapshot.rb +46 -0
  194. data/lib/opensearch/api/namespace/tasks.rb +46 -0
  195. data/lib/opensearch/api/utils.rb +297 -0
  196. data/lib/opensearch/api/version.rb +31 -0
  197. data/lib/opensearch/api.rb +101 -0
  198. data/lib/opensearch-api.rb +27 -0
  199. data/opensearch-api.gemspec +92 -0
  200. data/spec/opensearch/api/actions/abort_benchmark_spec.rb +43 -0
  201. data/spec/opensearch/api/actions/benchmark_spec.rb +43 -0
  202. data/spec/opensearch/api/actions/bulk_spec.rb +148 -0
  203. data/spec/opensearch/api/actions/cat/aliases_spec.rb +44 -0
  204. data/spec/opensearch/api/actions/cat/allocation_spec.rb +44 -0
  205. data/spec/opensearch/api/actions/cat/count_spec.rb +44 -0
  206. data/spec/opensearch/api/actions/cat/fielddata_spec.rb +61 -0
  207. data/spec/opensearch/api/actions/cat/health_spec.rb +44 -0
  208. data/spec/opensearch/api/actions/cat/help_spec.rb +44 -0
  209. data/spec/opensearch/api/actions/cat/indices_spec.rb +44 -0
  210. data/spec/opensearch/api/actions/cat/master_spec.rb +44 -0
  211. data/spec/opensearch/api/actions/cat/nodeattrs_spec.rb +44 -0
  212. data/spec/opensearch/api/actions/cat/nodes_spec.rb +44 -0
  213. data/spec/opensearch/api/actions/cat/pending_tasks_spec.rb +44 -0
  214. data/spec/opensearch/api/actions/cat/plugins_spec.rb +44 -0
  215. data/spec/opensearch/api/actions/cat/recovery_spec.rb +44 -0
  216. data/spec/opensearch/api/actions/cat/repositories_spec.rb +44 -0
  217. data/spec/opensearch/api/actions/cat/segments_spec.rb +58 -0
  218. data/spec/opensearch/api/actions/cat/shards_spec.rb +44 -0
  219. data/spec/opensearch/api/actions/cat/snapshot_spec.rb +44 -0
  220. data/spec/opensearch/api/actions/cat/tasks_spec.rb +44 -0
  221. data/spec/opensearch/api/actions/cat/templates_spec.rb +44 -0
  222. data/spec/opensearch/api/actions/cat/thread_pool_spec.rb +44 -0
  223. data/spec/opensearch/api/actions/clear_scroll_spec.rb +61 -0
  224. data/spec/opensearch/api/actions/close_point_in_time_spec.rb +43 -0
  225. data/spec/opensearch/api/actions/cluster/allocation_explain_spec.rb +44 -0
  226. data/spec/opensearch/api/actions/cluster/get_settings_spec.rb +44 -0
  227. data/spec/opensearch/api/actions/cluster/health_spec.rb +78 -0
  228. data/spec/opensearch/api/actions/cluster/pending_tasks_spec.rb +44 -0
  229. data/spec/opensearch/api/actions/cluster/put_settings_spec.rb +44 -0
  230. data/spec/opensearch/api/actions/cluster/remote_info_spec.rb +44 -0
  231. data/spec/opensearch/api/actions/cluster/reroute_spec.rb +61 -0
  232. data/spec/opensearch/api/actions/cluster/state_spec.rb +61 -0
  233. data/spec/opensearch/api/actions/cluster/stats_spec.rb +44 -0
  234. data/spec/opensearch/api/actions/count_spec.rb +78 -0
  235. data/spec/opensearch/api/actions/create_document_spec.rb +95 -0
  236. data/spec/opensearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb +57 -0
  237. data/spec/opensearch/api/actions/dangling_indices/import_dangling_indices_spec.rb +57 -0
  238. data/spec/opensearch/api/actions/dangling_indices/list_dangling_indices_spec.rb +45 -0
  239. data/spec/opensearch/api/actions/delete_by_query_spec.rb +89 -0
  240. data/spec/opensearch/api/actions/delete_document_spec.rb +121 -0
  241. data/spec/opensearch/api/actions/delete_script_spec.rb +46 -0
  242. data/spec/opensearch/api/actions/exists_document_spec.rb +136 -0
  243. data/spec/opensearch/api/actions/explain_document_spec.rb +108 -0
  244. data/spec/opensearch/api/actions/features/get_features_spec.rb +43 -0
  245. data/spec/opensearch/api/actions/features/reset_features_spec.rb +43 -0
  246. data/spec/opensearch/api/actions/field_caps_spec.rb +44 -0
  247. data/spec/opensearch/api/actions/get_document_source_spec.rb +110 -0
  248. data/spec/opensearch/api/actions/get_document_spec.rb +133 -0
  249. data/spec/opensearch/api/actions/get_script_spec.rb +59 -0
  250. data/spec/opensearch/api/actions/hashie_spec.rb +98 -0
  251. data/spec/opensearch/api/actions/index_document_spec.rb +146 -0
  252. data/spec/opensearch/api/actions/indices/add_block_spec.rb +72 -0
  253. data/spec/opensearch/api/actions/indices/analyze_spec.rb +77 -0
  254. data/spec/opensearch/api/actions/indices/clear_cache_spec.rb +89 -0
  255. data/spec/opensearch/api/actions/indices/clone_spec.rb +131 -0
  256. data/spec/opensearch/api/actions/indices/close_spec.rb +94 -0
  257. data/spec/opensearch/api/actions/indices/create_spec.rb +94 -0
  258. data/spec/opensearch/api/actions/indices/delete_alias_spec.rb +92 -0
  259. data/spec/opensearch/api/actions/indices/delete_spec.rb +117 -0
  260. data/spec/opensearch/api/actions/indices/delete_template_spec.rb +95 -0
  261. data/spec/opensearch/api/actions/indices/disk_usage_spec.rb +57 -0
  262. data/spec/opensearch/api/actions/indices/exists_alias_spec.rb +117 -0
  263. data/spec/opensearch/api/actions/indices/exists_spec.rb +117 -0
  264. data/spec/opensearch/api/actions/indices/exists_template_spec.rb +102 -0
  265. data/spec/opensearch/api/actions/indices/exists_type_spec.rb +117 -0
  266. data/spec/opensearch/api/actions/indices/field_usage_stats_spec.rb +55 -0
  267. data/spec/opensearch/api/actions/indices/flush_spec.rb +100 -0
  268. data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +99 -0
  269. data/spec/opensearch/api/actions/indices/forcemerge_spec.rb +44 -0
  270. data/spec/opensearch/api/actions/indices/get_alias_spec.rb +70 -0
  271. data/spec/opensearch/api/actions/indices/get_field_mapping_spec.rb +70 -0
  272. data/spec/opensearch/api/actions/indices/get_mapping_spec.rb +92 -0
  273. data/spec/opensearch/api/actions/indices/get_settings_spec.rb +81 -0
  274. data/spec/opensearch/api/actions/indices/get_spec.rb +63 -0
  275. data/spec/opensearch/api/actions/indices/open_spec.rb +74 -0
  276. data/spec/opensearch/api/actions/indices/put_alias_spec.rb +98 -0
  277. data/spec/opensearch/api/actions/indices/put_mapping_spec.rb +111 -0
  278. data/spec/opensearch/api/actions/indices/put_settings_spec.rb +117 -0
  279. data/spec/opensearch/api/actions/indices/put_template_spec.rb +116 -0
  280. data/spec/opensearch/api/actions/indices/recovery_spec.rb +44 -0
  281. data/spec/opensearch/api/actions/indices/refresh_spec.rb +100 -0
  282. data/spec/opensearch/api/actions/indices/rollover_spec.rb +67 -0
  283. data/spec/opensearch/api/actions/indices/segments_spec.rb +100 -0
  284. data/spec/opensearch/api/actions/indices/shard_stores_spec.rb +44 -0
  285. data/spec/opensearch/api/actions/indices/shrink_spec.rb +51 -0
  286. data/spec/opensearch/api/actions/indices/split_spec.rb +44 -0
  287. data/spec/opensearch/api/actions/indices/stats_spec.rb +133 -0
  288. data/spec/opensearch/api/actions/indices/update_aliases_spec.rb +76 -0
  289. data/spec/opensearch/api/actions/indices/upgrade_spec.rb +44 -0
  290. data/spec/opensearch/api/actions/indices/validate_query_spec.rb +131 -0
  291. data/spec/opensearch/api/actions/info_spec.rb +44 -0
  292. data/spec/opensearch/api/actions/ingest/delete_pipeline_spec.rb +69 -0
  293. data/spec/opensearch/api/actions/ingest/geo_ip_stats_spec.rb +43 -0
  294. data/spec/opensearch/api/actions/ingest/get_pipeline_spec.rb +59 -0
  295. data/spec/opensearch/api/actions/ingest/put_pipeline_spec.rb +69 -0
  296. data/spec/opensearch/api/actions/ingest/simulate_spec.rb +58 -0
  297. data/spec/opensearch/api/actions/json_builders_spec.rb +93 -0
  298. data/spec/opensearch/api/actions/mget_spec.rb +111 -0
  299. data/spec/opensearch/api/actions/msearch_spec.rb +160 -0
  300. data/spec/opensearch/api/actions/msearch_template_spec.rb +102 -0
  301. data/spec/opensearch/api/actions/mtermvectors_spec.rb +55 -0
  302. data/spec/opensearch/api/actions/nodes/hot_threads_spec.rb +70 -0
  303. data/spec/opensearch/api/actions/nodes/info_spec.rb +111 -0
  304. data/spec/opensearch/api/actions/nodes/reload_secure_settings_spec.rb +93 -0
  305. data/spec/opensearch/api/actions/nodes/shutdown_spec.rb +85 -0
  306. data/spec/opensearch/api/actions/nodes/stats_spec.rb +85 -0
  307. data/spec/opensearch/api/actions/open_point_in_time_spec.rb +53 -0
  308. data/spec/opensearch/api/actions/ping_spec.rb +85 -0
  309. data/spec/opensearch/api/actions/put_script_spec.rb +65 -0
  310. data/spec/opensearch/api/actions/reindex_spec.rb +44 -0
  311. data/spec/opensearch/api/actions/remote/info_spec.rb +44 -0
  312. data/spec/opensearch/api/actions/render_search_template_spec.rb +61 -0
  313. data/spec/opensearch/api/actions/scroll_spec.rb +61 -0
  314. data/spec/opensearch/api/actions/search_shards_spec.rb +44 -0
  315. data/spec/opensearch/api/actions/search_spec.rb +143 -0
  316. data/spec/opensearch/api/actions/search_template_spec.rb +43 -0
  317. data/spec/opensearch/api/actions/shutdown/delete_node_spec.rb +53 -0
  318. data/spec/opensearch/api/actions/shutdown/get_node_spec.rb +55 -0
  319. data/spec/opensearch/api/actions/shutdown/put_node_spec.rb +59 -0
  320. data/spec/opensearch/api/actions/snapshot/clone_spec.rb +76 -0
  321. data/spec/opensearch/api/actions/snapshot/create_repository_spec.rb +60 -0
  322. data/spec/opensearch/api/actions/snapshot/create_spec.rb +60 -0
  323. data/spec/opensearch/api/actions/snapshot/delete_repository_spec.rb +59 -0
  324. data/spec/opensearch/api/actions/snapshot/delete_spec.rb +60 -0
  325. data/spec/opensearch/api/actions/snapshot/get_features_spec.rb +47 -0
  326. data/spec/opensearch/api/actions/snapshot/get_repository_spec.rb +44 -0
  327. data/spec/opensearch/api/actions/snapshot/get_spec.rb +60 -0
  328. data/spec/opensearch/api/actions/snapshot/repository_analize_spec.rb +57 -0
  329. data/spec/opensearch/api/actions/snapshot/restore_spec.rb +60 -0
  330. data/spec/opensearch/api/actions/snapshot/status_spec.rb +59 -0
  331. data/spec/opensearch/api/actions/snapshot/verify_repository_spec.rb +44 -0
  332. data/spec/opensearch/api/actions/tasks/cancel_spec.rb +59 -0
  333. data/spec/opensearch/api/actions/tasks/get_spec.rb +44 -0
  334. data/spec/opensearch/api/actions/tasks/list_spec.rb +48 -0
  335. data/spec/opensearch/api/actions/termvectors_spec.rb +75 -0
  336. data/spec/opensearch/api/actions/update_by_query_spec.rb +44 -0
  337. data/spec/opensearch/api/actions/update_document_spec.rb +131 -0
  338. data/spec/opensearch/api/api_spec.rb +52 -0
  339. data/spec/opensearch/api/client_spec.rb +55 -0
  340. data/spec/opensearch/api/rest_api_yaml_spec.rb +169 -0
  341. data/spec/opensearch/api/utils_spec.rb +439 -0
  342. data/spec/rest_yaml_tests_helper.rb +89 -0
  343. data/spec/skipped_tests.yml +29 -0
  344. data/spec/spec_helper.rb +84 -0
  345. data.tar.gz.sig +0 -0
  346. metadata +860 -0
  347. metadata.gz.sig +0 -0
@@ -0,0 +1,439 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'spec_helper'
28
+
29
+ describe OpenSearch::API::Utils do
30
+
31
+ let(:utils) do
32
+ Class.new { include OpenSearch::API::Utils }.new
33
+ end
34
+
35
+ describe '#__escape' do
36
+
37
+ it 'encodes Unicode characters' do
38
+ expect(utils.__escape('中文')).to eq('%E4%B8%AD%E6%96%87')
39
+ end
40
+
41
+ it 'encodes special characters' do
42
+ expect(utils.__escape('foo bar')).to eq('foo+bar')
43
+ expect(utils.__escape('foo/bar')).to eq('foo%2Fbar')
44
+ expect(utils.__escape('foo^bar')).to eq('foo%5Ebar')
45
+ end
46
+
47
+ it 'does not encode asterisks' do
48
+ expect(utils.__escape('*')).to eq('*')
49
+ end
50
+
51
+ it 'users CGI.escape by default' do
52
+ expect(CGI).to receive(:escape).and_call_original
53
+ expect(utils.__escape('foo bar')).to eq('foo+bar')
54
+ end
55
+
56
+ it 'uses the escape_utils gem when available', unless: defined?(JRUBY_VERSION) do
57
+ require 'escape_utils'
58
+ expect(CGI).not_to receive(:escape)
59
+ expect(EscapeUtils).to receive(:escape_url).and_call_original
60
+ expect(utils.__escape('foo bar')).to eq('foo+bar')
61
+ end
62
+ end
63
+
64
+ describe '#__listify' do
65
+
66
+ it 'creates a list from a single value' do
67
+ expect(utils.__listify('foo')).to eq('foo')
68
+ end
69
+
70
+ it 'creates a list from an array' do
71
+ expect(utils.__listify(['foo', 'bar'])).to eq('foo,bar')
72
+ end
73
+
74
+ it 'creates a list from multiple arguments' do
75
+ expect(utils.__listify('foo', 'bar')).to eq('foo,bar')
76
+ end
77
+
78
+ it 'ignores nil values' do
79
+ expect(utils.__listify(['foo', nil, 'bar'])).to eq('foo,bar')
80
+ end
81
+
82
+ it 'ignores special characters' do
83
+ expect(utils.__listify(['foo', 'bar^bam'])).to eq('foo,bar%5Ebam')
84
+ end
85
+
86
+ context 'when the escape option is set to false' do
87
+
88
+ it 'does not escape the characters' do
89
+ expect(utils.__listify(['foo', 'bar^bam'], :escape => false)).to eq('foo,bar^bam')
90
+ end
91
+ end
92
+ end
93
+
94
+ describe '#__pathify' do
95
+
96
+ it 'creates a path from a single value' do
97
+ expect(utils.__pathify('foo')).to eq('foo')
98
+ end
99
+
100
+ it 'creates a path from an array' do
101
+ expect(utils.__pathify(['foo', 'bar'])).to eq('foo/bar')
102
+ end
103
+
104
+ it 'ignores nil values' do
105
+ expect(utils.__pathify(['foo', nil, 'bar'])).to eq('foo/bar')
106
+ end
107
+
108
+ it 'ignores empty string values' do
109
+ expect(utils.__pathify(['foo', '', 'bar'])).to eq('foo/bar')
110
+ end
111
+ end
112
+
113
+ describe '#__bulkify' do
114
+
115
+ context 'when the input is an array of hashes' do
116
+
117
+ let(:result) do
118
+ utils.__bulkify [
119
+ { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
120
+ { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
121
+ { :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } }
122
+ ]
123
+ end
124
+
125
+ let(:expected_string) do
126
+ <<-PAYLOAD.gsub(/^\s+/, '')
127
+ {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
128
+ {"title":"Test"}
129
+ {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
130
+ {"doc":{"title":"Update"}}
131
+ {"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
132
+ PAYLOAD
133
+ end
134
+
135
+ it 'serializes the hashes' do
136
+ expect(result).to eq(expected_string)
137
+ end
138
+ end
139
+
140
+ context 'when the input is an array of strings' do
141
+
142
+ let(:result) do
143
+ utils.__bulkify(['{"foo":"bar"}','{"moo":"bam"}'])
144
+ end
145
+
146
+ let(:expected_string) do
147
+ <<-PAYLOAD.gsub(/^\s+/, '')
148
+ {"foo":"bar"}
149
+ {"moo":"bam"}
150
+ PAYLOAD
151
+ end
152
+
153
+ it 'serializes the array of strings' do
154
+ expect(result).to eq(expected_string)
155
+ end
156
+ end
157
+
158
+ context 'when the input is an array of header/data pairs' do
159
+
160
+ let(:result) do
161
+ utils.__bulkify([{ foo: 'bar' }, { moo: 'bam' },{ foo: 'baz' }])
162
+ end
163
+
164
+ let(:expected_string) do
165
+ <<-PAYLOAD.gsub(/^\s+/, '')
166
+ {"foo":"bar"}
167
+ {"moo":"bam"}
168
+ {"foo":"baz"}
169
+ PAYLOAD
170
+ end
171
+
172
+ it 'serializes the array of strings' do
173
+ expect(result).to eq(expected_string)
174
+ end
175
+ end
176
+
177
+ context 'when the payload has the :data option' do
178
+
179
+ let(:input) do
180
+ { index: { foo: 'bar', data: { moo: 'bam' } } }
181
+ end
182
+
183
+ let(:result) do
184
+ utils.__bulkify([input])
185
+ end
186
+
187
+ let(:expected_string) do
188
+ <<-PAYLOAD.gsub(/^\s+/, '')
189
+ {"index":{"foo":"bar"}}
190
+ {"moo":"bam"}
191
+ PAYLOAD
192
+ end
193
+
194
+ it 'does not mutate the input' do
195
+ expect(input[:index][:data]).to eq(moo: 'bam')
196
+ end
197
+
198
+ it 'serializes the array of strings' do
199
+ expect(result).to eq(expected_string)
200
+ end
201
+ end
202
+
203
+ context 'when the payload has nested :data options' do
204
+
205
+ let(:data) do
206
+ { data: { a: 'b', data: { c: 'd' } } }
207
+ end
208
+
209
+ let(:result) do
210
+ utils.__bulkify([{ index: { foo: 'bar'} } , data])
211
+ end
212
+
213
+ let(:lines) do
214
+ result.split("\n")
215
+ end
216
+
217
+ let(:header) do
218
+ MultiJson.load(lines.first)
219
+ end
220
+
221
+ let(:data_string) do
222
+ MultiJson.load(lines.last)
223
+ end
224
+
225
+ it 'does not mutate the input' do
226
+ expect(data[:data]).to eq(a: 'b', data: { c: 'd' })
227
+ end
228
+
229
+ it 'serializes the array of strings' do
230
+ expect(header['index']['foo']).to eq('bar')
231
+ expect(data_string['data']['a']).to eq('b')
232
+ expect(data_string['data']['data']['c']).to eq('d')
233
+ end
234
+ end
235
+ end
236
+
237
+ context '#__validate_and_extract_params' do
238
+
239
+ it 'listify Arrays' do
240
+ expect(utils.__validate_and_extract_params({ foo: ['a', 'b'] }, [:foo] )).to eq(foo: 'a,b')
241
+ end
242
+
243
+ it 'does not escape the parameters' do
244
+ expect(utils.__validate_and_extract_params({ foo: ['a.*', 'b.*'] }, [:foo] )).to eq(foo: 'a.*,b.*')
245
+ end
246
+
247
+ context 'when the params are valid' do
248
+
249
+ it 'extracts the valid params from the hash' do
250
+ expect(utils.__validate_and_extract_params({ foo: 'qux' }, [:foo, :bar]) ).to eq(foo: 'qux')
251
+ end
252
+ end
253
+
254
+ context 'when the params are invalid' do
255
+
256
+ it 'raises an ArgumentError' do
257
+ expect {
258
+ utils.__validate_and_extract_params({ foo: 'qux', bam: 'mux' }, [:foo, :bar])
259
+ }.to raise_exception(ArgumentError)
260
+ end
261
+ end
262
+
263
+ context 'when COMMON_PARAMS are provided' do
264
+
265
+ it 'extracts the params' do
266
+ expect(utils.__validate_and_extract_params({ index: 'foo'}, [:foo])).to eq({})
267
+ end
268
+ end
269
+
270
+ context 'when COMMON_QUERY_PARAMS are provided' do
271
+
272
+ it 'extracts the params' do
273
+ expect(utils.__validate_and_extract_params(format: 'yaml')).to eq(format: 'yaml')
274
+ end
275
+ end
276
+
277
+ context 'when the :skip_paramter_validation option is set' do
278
+
279
+ let(:result) do
280
+ utils.__validate_and_extract_params( { foo: 'q', bam: 'm' }, [:foo, :bar], { skip_parameter_validation: true } )
281
+ end
282
+
283
+ it 'skips parameter validation' do
284
+ expect(result).to eq(foo: 'q', bam: 'm')
285
+ end
286
+ end
287
+
288
+ context 'when the module has the setting to skip parameter validation' do
289
+
290
+ around do |example|
291
+ original_value = OpenSearch::API.settings[:skip_parameter_validation]
292
+ OpenSearch::API.settings[:skip_parameter_validation] = true
293
+ example.run
294
+ OpenSearch::API.settings[:skip_parameter_validation] = original_value
295
+ end
296
+
297
+ let(:result) do
298
+ utils.__validate_and_extract_params( { foo: 'q', bam: 'm' }, [:foo, :bar])
299
+ end
300
+
301
+ it 'applies the module setting' do
302
+ expect(result).to eq(foo: 'q', bam: 'm')
303
+ end
304
+ end
305
+ end
306
+
307
+ describe '#__extract_parts' do
308
+
309
+ it 'extracts parts with true value from a Hash' do
310
+ expect(utils.__extract_parts({ foo: true, moo: 'blah' }, [:foo, :bar])).to eq(['foo'])
311
+ end
312
+
313
+ it 'extracts parts with string value from a Hash' do
314
+ expect(utils.__extract_parts({ foo: 'qux', moo: 'blah' }, [:foo, :bar])).to eq(['qux'])
315
+ end
316
+ end
317
+
318
+ context '#__rescue_from_not_found' do
319
+
320
+ it 'returns false if exception class name contains \'NotFound\'' do
321
+ expect(utils.__rescue_from_not_found { raise NotFound }).to be(false)
322
+ end
323
+
324
+ it 'returns false if exception message contains \'Not Found\'' do
325
+ expect(utils.__rescue_from_not_found { raise StandardError.new "Not Found" }).to be(false)
326
+ expect(utils.__rescue_from_not_found { raise StandardError.new "NotFound" }).to be(false)
327
+ end
328
+
329
+ it 'raises the exception if the class name and message do not include \'NotFound\'' do
330
+ expect {
331
+ utils.__rescue_from_not_found { raise StandardError.new "Any other exception" }
332
+ }.to raise_exception(StandardError)
333
+ end
334
+ end
335
+
336
+ context '#__report_unsupported_parameters' do
337
+
338
+ context 'when the parameters are passed as Symbols' do
339
+
340
+ let(:arguments) do
341
+ { foo: 'bar', moo: 'bam', baz: 'qux' }
342
+ end
343
+
344
+ let(:unsupported_params) do
345
+ [ :foo, :moo]
346
+ end
347
+
348
+ let(:message) do
349
+ message = ''
350
+ expect(Kernel).to receive(:warn) { |msg| message = msg }
351
+ utils.__report_unsupported_parameters(arguments, unsupported_params)
352
+ message
353
+ end
354
+
355
+ it 'prints the unsupported parameters' do
356
+ expect(message).to match(/You are using unsupported parameter \[\:foo\]/)
357
+ expect(message).to match(/You are using unsupported parameter \[\:moo\]/)
358
+ end
359
+ end
360
+
361
+ context 'when the parameters are passed as Hashes' do
362
+
363
+ let(:arguments) do
364
+ { foo: 'bar', moo: 'bam', baz: 'qux' }
365
+ end
366
+
367
+ let(:unsupported_params) do
368
+ [ :foo, :moo]
369
+ end
370
+
371
+ let(:message) do
372
+ message = ''
373
+ expect(Kernel).to receive(:warn) { |msg| message = msg }
374
+ utils.__report_unsupported_parameters(arguments, unsupported_params)
375
+ message
376
+ end
377
+
378
+ it 'prints the unsupported parameters' do
379
+ expect(message).to match(/You are using unsupported parameter \[\:foo\]/)
380
+ expect(message).to match(/You are using unsupported parameter \[\:moo\]/)
381
+ end
382
+ end
383
+
384
+ context 'when the parameters are passed as a mix of Hashes and Symbols' do
385
+
386
+ let(:arguments) do
387
+ { foo: 'bar', moo: 'bam', baz: 'qux' }
388
+ end
389
+
390
+ let(:unsupported_params) do
391
+ [ { :foo => { :explanation => 'NOT_SUPPORTED'} }, :moo ]
392
+ end
393
+
394
+
395
+ let(:message) do
396
+ message = ''
397
+ expect(Kernel).to receive(:warn) { |msg| message = msg }
398
+ utils.__report_unsupported_parameters(arguments, unsupported_params)
399
+ message
400
+ end
401
+
402
+ it 'prints the unsupported parameters' do
403
+ expect(message).to match(/You are using unsupported parameter \[\:foo\]/)
404
+ expect(message).to match(/You are using unsupported parameter \[\:moo\]/)
405
+ expect(message).to match(/NOT_SUPPORTED/)
406
+ end
407
+ end
408
+
409
+ context 'when unsupported parameters are unused' do
410
+
411
+ let(:arguments) do
412
+ { moo: 'bam', baz: 'qux' }
413
+ end
414
+
415
+ let(:unsupported_params) do
416
+ [ :foo ]
417
+ end
418
+
419
+ it 'prints the unsupported parameters' do
420
+ expect(Kernel).not_to receive(:warn)
421
+ utils.__report_unsupported_parameters(arguments, unsupported_params)
422
+ end
423
+ end
424
+ end
425
+
426
+ describe '#__report_unsupported_method' do
427
+
428
+ let(:message) do
429
+ message = ''
430
+ expect(Kernel).to receive(:warn) { |msg| message = msg }
431
+ utils.__report_unsupported_method(:foo)
432
+ message
433
+ end
434
+
435
+ it 'prints a warning' do
436
+ expect(message).to match(/foo/)
437
+ end
438
+ end
439
+ end
@@ -0,0 +1,89 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require "#{File.expand_path(File.dirname('..'), '..')}/api-spec-testing/test_file"
28
+ require "#{File.expand_path(File.dirname('..'), '..')}/api-spec-testing/rspec_matchers"
29
+ include OpenSearch::RestAPIYAMLTests
30
+
31
+ TRANSPORT_OPTIONS = {}
32
+ PROJECT_PATH = File.join(File.dirname(__FILE__), '..')
33
+
34
+ if (hosts = OPENSEARCH_URL)
35
+ split_hosts = hosts.split(',').map do |host|
36
+ /(http\:\/\/)?\S+/.match(host)
37
+ end
38
+ uri = URI.parse(split_hosts.first[0])
39
+ TEST_HOST = uri.host
40
+ TEST_PORT = uri.port
41
+ else
42
+ TEST_HOST, TEST_PORT = 'localhost', '9200'
43
+ end
44
+
45
+ if defined?(TEST_HOST) && defined?(TEST_PORT)
46
+ URL = "http://#{TEST_HOST}:#{TEST_PORT}"
47
+
48
+ ADMIN_CLIENT = OpenSearch::Client.new(host: URL, transport_options: TRANSPORT_OPTIONS)
49
+
50
+ if ENV['QUIET'] == 'true'
51
+ DEFAULT_CLIENT = OpenSearch::Client.new(host: URL, transport_options: TRANSPORT_OPTIONS)
52
+ else
53
+ DEFAULT_CLIENT = OpenSearch::Client.new(host: URL,
54
+ transport_options: TRANSPORT_OPTIONS,
55
+ tracer: Logger.new($stdout))
56
+ end
57
+ end
58
+
59
+ YAML_FILES_DIRECTORY = "#{PROJECT_PATH}/../tmp/rest-api-spec/test/free"
60
+
61
+ SINGLE_TEST = if ENV['SINGLE_TEST'] && !ENV['SINGLE_TEST'].empty?
62
+ test_target = ENV['SINGLE_TEST']
63
+
64
+ if test_target.match?(/\.yml$/)
65
+ ["#{PROJECT_PATH}/../tmp/rest-api-spec/test/free/#{test_target}"]
66
+ else
67
+ Dir.glob(
68
+ ["#{PROJECT_PATH}/../tmp/rest-api-spec/test/free/#{test_target}/*.yml"]
69
+ )
70
+ end
71
+ end
72
+
73
+ # Skipped tests
74
+ file = File.expand_path("#{__dir__}/skipped_tests.yml")
75
+ skipped_tests = YAML.load_file(file)
76
+
77
+ # The directory of rest api YAML files.
78
+ REST_API_YAML_FILES = if ENV['RUN_SKIPPED_TESTS'] # only run the skipped tests if true
79
+ SKIPPED_TESTS = []
80
+ skipped_tests.map { |test| "#{YAML_FILES_DIRECTORY}/#{test[:file]}" }
81
+ else
82
+ # If not, define the skipped tests constant and try the single test or all
83
+ # the tests
84
+ SKIPPED_TESTS = skipped_tests
85
+ SINGLE_TEST || Dir.glob("#{YAML_FILES_DIRECTORY}/**/*.yml")
86
+ end
87
+
88
+ # The features to skip
89
+ REST_API_YAML_SKIP_FEATURES = ['warnings', 'node_selector'].freeze
@@ -0,0 +1,29 @@
1
+ # Response from OpenSearch is just a String, so it's not possible to compare using headers.
2
+ -
3
+ :file: 'cat.aliases/20_headers.yml'
4
+ :description: 'Simple alias with yaml body through Accept header'
5
+
6
+ # Check version skip logic
7
+ -
8
+ :file: 'create/15_without_id.yml'
9
+ :description: 'Create without ID'
10
+
11
+ # No error is raised
12
+ -
13
+ :file: 'create/15_without_id_with_types.yml'
14
+ :description: 'Create without ID'
15
+
16
+ # Error message doesn't match
17
+ -
18
+ :file: 'tasks.get/10_basic.yml'
19
+ :description: 'get task test'
20
+
21
+ # Figure out how to match response when there is an error
22
+ -
23
+ :file: 'delete/70_mix_typeless_typeful.yml'
24
+ :description: '*'
25
+
26
+ # Figure out how to match response when there is an error
27
+ -
28
+ :file: 'cat.templates/10_basic.yml'
29
+ :description: '*'
@@ -0,0 +1,84 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ if ENV['COVERAGE'] && ENV['CI'].nil?
28
+ require 'simplecov'
29
+ SimpleCov.start { add_filter %r{^/test|spec/} }
30
+ end
31
+
32
+ if defined?(JRUBY_VERSION)
33
+ require 'pry-nav'
34
+ else
35
+ require 'pry-byebug'
36
+ end
37
+ require 'ansi'
38
+ require 'opensearch'
39
+ require 'opensearch-api'
40
+ require 'opensearch-transport'
41
+ require 'jbuilder'
42
+ require 'jsonify'
43
+ require 'yaml'
44
+
45
+ tracer = ::Logger.new(STDERR)
46
+ tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
47
+
48
+ unless defined?(OPENSEARCH_URL)
49
+ OPENSEARCH_URL = ENV['OPENSEARCH_URL'] ||
50
+ ENV['TEST_OPENSEARCH_SERVER'] ||
51
+ "http://localhost:#{(ENV['TEST_CLUSTER_PORT'] || 9200)}"
52
+ end
53
+
54
+ DEFAULT_CLIENT = OpenSearch::Client.new(host: OPENSEARCH_URL,
55
+ tracer: (tracer unless ENV['QUIET']))
56
+
57
+ module HelperModule
58
+ def self.included(context)
59
+ context.let(:client_double) do
60
+ Class.new { include OpenSearch::API }.new.tap do |client|
61
+ expect(client).to receive(:perform_request).with(*expected_args).and_return(response_double)
62
+ end
63
+ end
64
+
65
+ context.let(:client) do
66
+ Class.new { include OpenSearch::API }.new.tap do |client|
67
+ expect(client).to receive(:perform_request).with(*expected_args).and_return(response_double)
68
+ end
69
+ end
70
+
71
+ context.let(:response_double) do
72
+ double('response', status: 200, body: {}, headers: {})
73
+ end
74
+ end
75
+ end
76
+
77
+ RSpec.configure do |config|
78
+ config.include(HelperModule)
79
+ config.formatter = 'documentation'
80
+ config.color = true
81
+ config.add_formatter('RspecJunitFormatter', 'tmp/opensearch-api-junit.xml')
82
+ end
83
+
84
+ class NotFound < StandardError; end
data.tar.gz.sig ADDED
Binary file