File tree Expand file tree Collapse file tree 3 files changed +31
-22
lines changed
elasticsearch/spec/integration/helpers Expand file tree Collapse file tree 3 files changed +31
-22
lines changed Original file line number Diff line number Diff line change 14
14
# KIND, either express or implied. See the License for the
15
15
# specific language governing permissions and limitations
16
16
# under the License.
17
- ELASTICSEARCH_URL = ENV [ 'TEST_ES_SERVER' ] || "http://localhost:#{ ( ENV [ 'PORT' ] || 9200 ) } "
18
- raise URI ::InvalidURIError unless ELASTICSEARCH_URL =~ /\A #{ URI ::DEFAULT_PARSER . make_regexp } \z /
19
-
17
+ require_relative 'helpers_spec_helper'
20
18
require 'elasticsearch/helpers/bulk_helper'
21
- require 'spec_helper'
22
19
require 'tempfile'
23
20
24
21
context 'Elasticsearch client helpers' do
25
22
context 'Bulk helper' do
26
- let ( :client ) do
27
- Elasticsearch ::Client . new (
28
- host : ELASTICSEARCH_URL ,
29
- user : 'elastic' ,
30
- password : 'changeme'
31
- )
32
- end
33
23
let ( :index ) { 'bulk_animals' }
34
24
let ( :params ) { { refresh : 'wait_for' } }
35
25
let ( :bulk_helper ) { Elasticsearch ::Helpers ::BulkHelper . new ( client , index , params ) }
Original file line number Diff line number Diff line change
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ require 'spec_helper'
19
+
20
+ ELASTICSEARCH_URL = ENV [ 'TEST_ES_SERVER' ] || "http://localhost:#{ ( ENV [ 'PORT' ] || 9200 ) } "
21
+ raise URI ::InvalidURIError unless ELASTICSEARCH_URL =~ /\A #{ URI ::DEFAULT_PARSER . make_regexp } \z /
22
+
23
+ def client
24
+ @client ||= Elasticsearch ::Client . new (
25
+ host : ELASTICSEARCH_URL ,
26
+ user : 'elastic' ,
27
+ password : 'changeme'
28
+ )
29
+ end
Original file line number Diff line number Diff line change 14
14
# KIND, either express or implied. See the License for the
15
15
# specific language governing permissions and limitations
16
16
# under the License.
17
- ELASTICSEARCH_URL = ENV [ 'TEST_ES_SERVER' ] || "http://localhost:#{ ( ENV [ 'PORT' ] || 9200 ) } "
18
- raise URI ::InvalidURIError unless ELASTICSEARCH_URL =~ /\A #{ URI ::DEFAULT_PARSER . make_regexp } \z /
19
-
20
- require 'spec_helper'
17
+ require_relative 'helpers_spec_helper'
21
18
require 'elasticsearch/helpers/scroll_helper'
22
19
23
20
context 'Elasticsearch client helpers' do
24
- let ( :client ) do
25
- Elasticsearch ::Client . new (
26
- host : ELASTICSEARCH_URL ,
27
- user : 'elastic' ,
28
- password : 'changeme'
29
- )
30
- end
31
21
let ( :index ) { 'books' }
32
22
let ( :body ) { { size : 12 , query : { match_all : { } } } }
33
23
let ( :scroll_helper ) { Elasticsearch ::Helpers ::ScrollHelper . new ( client , index , body ) }
You can’t perform that action at this time.
0 commit comments