Skip to content

Commit d7bc81b

Browse files
committed
[CI] Adds client options for running Serverless YAML tests
1 parent 61b8ff6 commit d7bc81b

File tree

1 file changed

+20
-2
lines changed
  • elasticsearch-api/spec/yaml-test-runner

1 file changed

+20
-2
lines changed

elasticsearch-api/spec/yaml-test-runner/run.rb

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@
2929
password = ENV['ELASTIC_PASSWORD'] || 'changeme'
3030
uri = URI.parse(host)
3131

32+
def serverless?
33+
ENV['TEST_SUITE'] == 'serverless'
34+
end
35+
3236
if uri.is_a?(URI::HTTPS)
3337
raw_certificate = File.read("#{CERTS_PATH}/testnode.crt")
3438
certificate = OpenSSL::X509::Certificate.new(raw_certificate)
3539
raw_key = File.read("#{CERTS_PATH}/testnode.key")
3640
key = OpenSSL::PKey::RSA.new(raw_key)
3741
ca_file = File.expand_path("#{CERTS_PATH}/ca.crt")
38-
host = "https://elastic:#{password}@#{uri.host}:#{uri.port}".freeze unless ENV['TEST_SUITE'] == 'serverless'
42+
host = "https://elastic:#{password}@#{uri.host}:#{uri.port}".freeze unless serverless?
3943
transport_options = {
4044
ssl: {
4145
client_cert: certificate,
@@ -49,8 +53,22 @@
4953
transport_options = {}
5054
end
5155

52-
options = { host: host, transport_options: transport_options, compression: true }
56+
options = {
57+
host: host,
58+
transport_options: transport_options,
59+
}
5360
options.merge!({ api_key: ENV['ES_API_KEY'] }) if ENV['ES_API_KEY']
61+
62+
if serverless?
63+
options.merge!(
64+
{
65+
retry_on_status: [409],
66+
retry_on_failure: 10,
67+
delay_on_retry: 60_000,
68+
request_timeout: 120
69+
}
70+
)
71+
end
5472
CLIENT = Elasticsearch::Client.new(options)
5573

5674
tests_path = File.expand_path('./tmp', __dir__)

0 commit comments

Comments
 (0)