elasticsearch-test-runner 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d09d996ce00f24cbdd34e54d447eff53c19a0a023fa55a61043a5215626e21a8
4
- data.tar.gz: 77fc59d5846f32c165dcb3ac72bf475c0e572a12f03e7aab80a85030b6e6d7c0
3
+ metadata.gz: 7452d0963f9177b56e8dbfdbe0ee2d779e4e733ecff9f21be71263611b8bfe4a
4
+ data.tar.gz: 72100349de35737ec78f2b6617b68fb9beef9a64d3ee59b3be06bfebd30cefd2
5
5
  SHA512:
6
- metadata.gz: 69587a3c06c098c03c74e2b26f114228012ee97d73267a5623e44e0d689e776d0c9dc85a1cc503a0ac397c68d9939c338bd6a88bcaf0ffacf2cbf77a31d0cc17
7
- data.tar.gz: 4b4e6315e953fbc534b8fdbc06db5462e7656cee80c1f5edfbd21cbede0956513e2f7d45faff87c77b5cf61a34526d89d9a9b907d4887ff8e9d4cbf4258b6b1b
6
+ metadata.gz: e2709d1814074c2b29ffb9ba9066a1003ea3f074aaa13f1ceac0534c41b5b97e37e87ee42ea4525f320bf0f5e1dcafc0a55197c70afb312fad61f3c5c2d93f74
7
+ data.tar.gz: b2c440af0a742182c36b1c53aae1db3adc2b52ce0930ab88383c62203c9358f2589e34265bcb0180da4db4179096f0780d4775aa5ddbbb5f3f90a36fdf862631
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.0] - 2024-08-15
4
+
5
+ - Better display of action and response when `ENV['DEBUG']` is true.
6
+ - Checks for more error types when catching exceptions.
7
+ - Better matching for regular expressions.
8
+ - Refactors `set_param_variable` for better substitution.
9
+
3
10
  ## [0.8.0] - 2024-08-14
4
11
 
5
12
  - Adds support for variable keys (`$`).
@@ -54,7 +54,7 @@ module Elasticsearch
54
54
  method = arrayed_method.last
55
55
  end
56
56
  @response = client.send(method.to_sym, process_params(params))
57
- puts @response if ENV['DEBUG']
57
+ puts "Action: #{action}\nResponse: #{@response}\n\n" if ENV['DEBUG']
58
58
  @response
59
59
  rescue StandardError => e
60
60
  raise e unless expected_exception?(catchable, e)
@@ -66,7 +66,7 @@ module Elasticsearch
66
66
  case error_type
67
67
  when 'request_timeout'
68
68
  e.is_a?(Elastic::Transport::Transport::Errors::RequestTimeout)
69
- when 'missing'
69
+ when 'missing', /resource_not_found_exception/
70
70
  e.is_a?(Elastic::Transport::Transport::Errors::NotFound)
71
71
  when 'conflict'
72
72
  e.is_a?(Elastic::Transport::Transport::Errors::Conflict)
@@ -85,6 +85,8 @@ module Elasticsearch
85
85
  e.is_a?(Elastic::Transport::Transport::Errors::BadRequest)
86
86
  when /NullPointerException/
87
87
  e.message =~ /\[400\]/
88
+ when /status_exception/
89
+ e.message =~ /\[409\]/
88
90
  else
89
91
  e.message =~ /#{error_type}/
90
92
  end
@@ -109,7 +111,9 @@ module Elasticsearch
109
111
  end
110
112
 
111
113
  def match_regexp(expected, result)
112
- expected.is_a?(String) && expected.match?(/^\//) && result.match?(Regexp.new(expected.gsub('/', '')))
114
+ expected.is_a?(String) &&
115
+ expected.match?(/^\//) &&
116
+ result.match?(Regexp.new(expected.gsub('/', '').strip))
113
117
  end
114
118
 
115
119
  def do_length(action)
@@ -200,7 +204,13 @@ module Elasticsearch
200
204
  end
201
205
 
202
206
  def set_param_variable(params, key, param)
203
- params[key] = instance_variable_get(param.gsub('$', '@')) if param.is_a?(String) && param.include?('$')
207
+ return unless param.is_a?(String) && param.include?("$")
208
+
209
+ # Param can be a single '$value' string or '{ something: $value }'
210
+ repleacable = param.match(/(\$[0-9a-z_-]+)/)[0]
211
+ value = instance_variable_get(repleacable.gsub("$", "@"))
212
+ content = param.gsub(repleacable, value)
213
+ params[key] = content
204
214
  end
205
215
 
206
216
  # Given a list of keys, find the value in a recursively nested document.
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elasticsearch
21
21
  module Tests
22
- VERSION = '0.8.0'
22
+ VERSION = '0.9.0'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-test-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch