File tree 4 files changed +21
-4
lines changed
lib/elasticsearch/extensions/test
4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Elasticsearch::Extensions
2
2
3
- This library provides a set of extensions to the
4
- [ ` elasticsearch ` ] ( https://github.com/elasticsearch/elasticsearch-ruby ) Rubygem.
3
+ This library provides a set of extensions to the [ ` elasticsearch ` ] ( https://github.com/elasticsearch/elasticsearch-ruby ) Rubygem.
5
4
6
5
## Installation
7
6
Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ def __determine_version
530
530
raise RuntimeError , "Cannot determine Elasticsearch version from [#{ arguments [ :command ] } --version] or [#{ arguments [ :command ] } -v]"
531
531
end
532
532
533
- if m = output . match ( /Version: (\d \. \d .\d ).*,/ )
533
+ if ( m = output . match ( /Version: (\d + \. \d + .\d + ).*,/ ) )
534
534
m [ 1 ]
535
535
else
536
536
raise RuntimeError , "Cannot determine Elasticsearch version from elasticsearch --version output [#{ output } ]"
Original file line number Diff line number Diff line change @@ -291,6 +291,24 @@ class Elasticsearch::Extensions::TestClusterTest < Elasticsearch::Test::UnitTest
291
291
assert_equal '2.0' , @subject . __determine_version
292
292
end
293
293
294
+ should "return version from `elasticsearch --version` when version reaches double digits" do
295
+ File . expects ( :exist? ) . with ( '/foo/bar/bin/../lib/' ) . returns ( false )
296
+ File . expects ( :exist? ) . with ( '/foo/bar/bin/elasticsearch' ) . returns ( true )
297
+
298
+ io = mock ( 'IO' )
299
+ io . expects ( :pid ) . returns ( 123 )
300
+ io . expects ( :read ) . returns ( 'Version: 7.11.0-SNAPSHOT, Build: d1c86b0/2016-03-30T10:43:20Z, JVM: 1.8.0_60' )
301
+ io . expects ( :closed? ) . returns ( false )
302
+ io . expects ( :close )
303
+ IO . expects ( :popen ) . returns ( io )
304
+
305
+ Process . stubs ( :wait )
306
+ Process . expects ( :kill ) . with ( 'INT' , 123 )
307
+
308
+ assert_equal '7.0' , @subject . __determine_version
309
+ end
310
+
311
+
294
312
should "return version from arguments" do
295
313
cluster = Elasticsearch ::Extensions ::Test ::Cluster ::Cluster . new command : '/foo/bar/bin/elasticsearch' , version : '5.2'
296
314
assert_equal '5.0' , cluster . __determine_version
Original file line number Diff line number Diff line change 25
25
26
26
JRUBY = defined? ( JRUBY_VERSION )
27
27
28
- if ENV [ 'COVERAGE' ] && ENV [ 'CI' ] . nil? && ! RUBY_1_8
28
+ if ENV [ 'COVERAGE' ] && ENV [ 'CI' ] . nil?
29
29
require 'simplecov'
30
30
SimpleCov . start { add_filter "/test|test_" }
31
31
end
You can’t perform that action at this time.
0 commit comments