test/test/cluster/unit/cluster_test.rb in elasticsearch-extensions-0.0.31 vs test/test/cluster/unit/cluster_test.rb in elasticsearch-extensions-0.0.32
- old
+ new
@@ -1,5 +1,22 @@
+# Licensed to Elasticsearch B.V. under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Elasticsearch B.V. licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
require 'test_helper'
require 'elasticsearch/extensions/test/cluster'
class Elasticsearch::Extensions::TestClusterTest < Elasticsearch::Test::UnitTestCase
@@ -271,9 +288,27 @@
Process.stubs(:wait)
Process.expects(:kill).with('INT', 123)
assert_equal '2.0', @subject.__determine_version
end
+
+ should "return version from `elasticsearch --version` when version reaches double digits" do
+ File.expects(:exist?).with('/foo/bar/bin/../lib/').returns(false)
+ File.expects(:exist?).with('/foo/bar/bin/elasticsearch').returns(true)
+
+ io = mock('IO')
+ io.expects(:pid).returns(123)
+ io.expects(:read).returns('Version: 7.11.0-SNAPSHOT, Build: d1c86b0/2016-03-30T10:43:20Z, JVM: 1.8.0_60')
+ io.expects(:closed?).returns(false)
+ io.expects(:close)
+ IO.expects(:popen).returns(io)
+
+ Process.stubs(:wait)
+ Process.expects(:kill).with('INT', 123)
+
+ assert_equal '7.0', @subject.__determine_version
+ end
+
should "return version from arguments" do
cluster = Elasticsearch::Extensions::Test::Cluster::Cluster.new command: '/foo/bar/bin/elasticsearch', version: '5.2'
assert_equal '5.0', cluster.__determine_version
end