|
35 | 35 | TEST_HOST, TEST_PORT = 'localhost', '9200'
|
36 | 36 | end
|
37 | 37 |
|
| 38 | +test_suite = ENV['TEST_SUITE'] || 'free' |
| 39 | +password = ENV['ELASTIC_PASSWORD'] || 'changeme' |
| 40 | +user = ENV['ELASTIC_USER'] || 'elastic' |
| 41 | + |
38 | 42 | if defined?(TEST_HOST) && defined?(TEST_PORT)
|
39 |
| - URL = "http://#{TEST_HOST}:#{TEST_PORT}" |
| 43 | + URL = "http://#{TEST_HOST}:#{TEST_PORT}".freeze |
40 | 44 |
|
41 | 45 | if STACK_VERSION.match?(/^8\./)
|
42 |
| - user = 'elastic'.freeze |
43 |
| - password = 'changeme'.freeze |
44 |
| - ADMIN_CLIENT = Elasticsearch::Client.new( |
45 |
| - host: URL, |
46 |
| - transport_options: TRANSPORT_OPTIONS, |
47 |
| - user: user, |
48 |
| - password: password |
49 |
| - ) |
| 46 | + if ENV['TEST_SUITE'] == 'platinum' |
| 47 | + raw_certificate = File.read(File.join(PROJECT_PATH, '../.ci/certs/testnode.crt')) |
| 48 | + certificate = OpenSSL::X509::Certificate.new(raw_certificate) |
| 49 | + raw_key = File.read(File.join(PROJECT_PATH, '../.ci/certs/testnode.key')) |
| 50 | + key = OpenSSL::PKey::RSA.new(raw_key) |
| 51 | + ca_file = File.expand_path(File.join(PROJECT_PATH, '/.ci/certs/ca.crt')) |
| 52 | + host = "https://elastic:#{password}@#{uri.host}:#{uri.port}".freeze |
| 53 | + transport_options = { ssl: { verify: false, client_cert: certificate, client_key: key, ca_file: ca_file } } |
| 54 | + else |
| 55 | + host = "http://elastic:#{password}@#{uri.host}:#{uri.port}".freeze |
| 56 | + transport_options = {} |
| 57 | + end |
| 58 | + |
| 59 | + ADMIN_CLIENT = Elasticsearch::Client.new(host: host, transport_options: transport_options) |
| 60 | + |
| 61 | + DEFAULT_CLIENT = if ENV['QUIET'] == 'true' |
| 62 | + Elasticsearch::Client.new(host: host, transport_options: transport_options) |
| 63 | + else |
| 64 | + Elasticsearch::Client.new( |
| 65 | + host: host, |
| 66 | + tracer: Logger.new($stdout), |
| 67 | + transport_options: transport_options |
| 68 | + ) |
| 69 | + end |
50 | 70 |
|
51 | 71 | if ENV['QUIET'] == 'true'
|
52 | 72 | DEFAULT_CLIENT = Elasticsearch::Client.new(
|
|
0 commit comments