elasticsearch-api 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +50 -13
- data/elasticsearch-api.gemspec +0 -1
- data/lib/elasticsearch/api/actions/cluster/node_hot_threads.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/node_info.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/node_shutdown.rb +1 -1
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/unit/cluster/node_hot_threads_test.rb +3 -3
- data/test/unit/cluster/node_info_test.rb +3 -3
- data/test/unit/cluster/node_shutdown_test.rb +3 -3
- metadata +2 -18
data/Rakefile
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
__current__
|
3
|
+
def __current__
|
4
|
+
Pathname( File.expand_path('..', __FILE__) )
|
5
|
+
end
|
6
|
+
|
7
|
+
def git_specs(command, options={})
|
8
|
+
sh "git --git-dir=#{__current__.join('../support/elasticsearch/.git')} --work-tree=#{__current__.join('../support/elasticsearch')} #{command}", options
|
9
|
+
end
|
4
10
|
|
5
|
-
|
6
|
-
task
|
7
|
-
task :test => 'test:unit'
|
11
|
+
task(:default) { system "rake --tasks" }
|
12
|
+
task :test => 'test:unit'
|
8
13
|
|
9
14
|
# ----- Test tasks ------------------------------------------------------------
|
10
15
|
|
11
16
|
require 'rake/testtask'
|
12
17
|
namespace :test do
|
18
|
+
|
19
|
+
desc "Update the repository with YAML tests"
|
20
|
+
task :update do
|
21
|
+
git_specs "fetch origin --verbose", :verbose => true
|
22
|
+
end
|
23
|
+
|
13
24
|
task :ci_reporter do
|
14
25
|
ENV['CI_REPORTS'] ||= 'tmp/reports'
|
15
26
|
if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
|
@@ -33,7 +44,19 @@ namespace :test do
|
|
33
44
|
task :integration do
|
34
45
|
require 'elasticsearch'
|
35
46
|
|
36
|
-
|
47
|
+
branches = `git --git-dir=#{__current__.join('../support/elasticsearch/.git')} --work-tree=#{__current__.join('../support/elasticsearch')} branch --no-color`
|
48
|
+
|
49
|
+
current_branch = branches
|
50
|
+
.split("\n")
|
51
|
+
.select { |b| b =~ /^\*/ }
|
52
|
+
.reject { |b| b =~ /detached/ }
|
53
|
+
.map { |b| b.gsub(/^\*\s*/, '') }
|
54
|
+
.first
|
55
|
+
|
56
|
+
unless current_branch
|
57
|
+
STDERR.puts "[!] Unable to determine current branch, defaulting to 'master'"
|
58
|
+
current_branch = 'master'
|
59
|
+
end
|
37
60
|
|
38
61
|
# Define the task
|
39
62
|
t = Rake::TestTask.new(:integration) do |test|
|
@@ -42,6 +65,7 @@ namespace :test do
|
|
42
65
|
test.test_files = FileList["test/integration/yaml_test_runner.rb", "test/integration/**/*_test.rb"]
|
43
66
|
end
|
44
67
|
|
68
|
+
# Check if a test cluster is running
|
45
69
|
begin
|
46
70
|
client = Elasticsearch::Client.new host: "localhost:#{ENV['TEST_CLUSTER_PORT'] || 9250}"
|
47
71
|
es_version_info = client.info['version']
|
@@ -52,12 +76,24 @@ namespace :test do
|
|
52
76
|
cluster_running = false
|
53
77
|
end
|
54
78
|
|
55
|
-
|
56
|
-
checkout_build_hash
|
79
|
+
checkout_specs_version = ENV['TEST_NO_CHECKOUT'].nil? ? true : false
|
80
|
+
checkout_build_hash = ENV['TEST_BUILD_REF'] || build_hash
|
57
81
|
|
58
82
|
begin
|
59
|
-
|
60
|
-
|
83
|
+
unless checkout_specs_version
|
84
|
+
STDERR.puts '-'*80, "YAML tests: Not switching, TEST_NO_CHECKOUT=y", '-'*80
|
85
|
+
end
|
86
|
+
|
87
|
+
if checkout_specs_version && !checkout_build_hash
|
88
|
+
STDERR.puts "[!] Cannot determine checkout build hash -- server not running or TEST_BUILD_REF not specified"
|
89
|
+
exit(1)
|
90
|
+
end
|
91
|
+
|
92
|
+
if checkout_specs_version && checkout_build_hash
|
93
|
+
# Checkout the commit corresponding to the running server build, or passed TEST_BUILD_REF
|
94
|
+
STDERR.puts '-'*80, "YAML tests: Switching to [\e[1m#{checkout_build_hash}\e[0m]", '-'*80
|
95
|
+
git_specs "checkout #{checkout_build_hash} --force --quiet"
|
96
|
+
end
|
61
97
|
|
62
98
|
# Path to the API specs
|
63
99
|
ENV['TEST_REST_API_SPEC'] = __current__.join('../support/elasticsearch/rest-api-spec/test/').to_s
|
@@ -74,14 +110,15 @@ namespace :test do
|
|
74
110
|
end
|
75
111
|
|
76
112
|
ensure
|
77
|
-
|
113
|
+
git_specs "checkout --force --quiet #{current_branch}" if checkout_specs_version
|
78
114
|
end
|
79
115
|
end
|
80
116
|
|
81
|
-
|
117
|
+
desc "Run unit and integration tests"
|
118
|
+
task :all do
|
82
119
|
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
|
83
|
-
|
84
|
-
|
120
|
+
Rake::Task['test:unit'].invoke
|
121
|
+
Rake::Task['test:integration'].invoke
|
85
122
|
end
|
86
123
|
|
87
124
|
namespace :cluster do
|
data/elasticsearch-api.gemspec
CHANGED
@@ -38,7 +38,6 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_development_dependency "ci_reporter"
|
39
39
|
|
40
40
|
# Gems for testing integrations
|
41
|
-
s.add_development_dependency "multi_json"
|
42
41
|
s.add_development_dependency "jbuilder"
|
43
42
|
s.add_development_dependency "jsonify"
|
44
43
|
s.add_development_dependency "hashie"
|
@@ -33,7 +33,7 @@ module Elasticsearch
|
|
33
33
|
:type ]
|
34
34
|
|
35
35
|
method = 'GET'
|
36
|
-
path = Utils.__pathify '
|
36
|
+
path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'hot_threads'
|
37
37
|
|
38
38
|
params = Utils.__validate_and_extract_params arguments, valid_params
|
39
39
|
body = nil
|
@@ -46,7 +46,7 @@ module Elasticsearch
|
|
46
46
|
:transport ]
|
47
47
|
|
48
48
|
method = 'GET'
|
49
|
-
path = Utils.__pathify '
|
49
|
+
path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id])
|
50
50
|
|
51
51
|
params = Utils.__validate_and_extract_params arguments, valid_params
|
52
52
|
body = nil
|
@@ -23,7 +23,7 @@ module Elasticsearch
|
|
23
23
|
:exit ]
|
24
24
|
|
25
25
|
method = 'POST'
|
26
|
-
path = Utils.__pathify '
|
26
|
+
path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), '_shutdown'
|
27
27
|
|
28
28
|
params = Utils.__validate_and_extract_params arguments, valid_params
|
29
29
|
body = nil
|
@@ -10,7 +10,7 @@ module Elasticsearch
|
|
10
10
|
should "perform correct request" do
|
11
11
|
subject.expects(:perform_request).with do |method, url, params, body|
|
12
12
|
assert_equal 'GET', method
|
13
|
-
assert_equal '
|
13
|
+
assert_equal '_nodes/hot_threads', url
|
14
14
|
assert_equal Hash.new, params
|
15
15
|
assert_nil body
|
16
16
|
true
|
@@ -21,7 +21,7 @@ module Elasticsearch
|
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
23
23
|
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
-
assert_equal '
|
24
|
+
assert_equal '_nodes/foo/hot_threads', url
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
@@ -30,7 +30,7 @@ module Elasticsearch
|
|
30
30
|
|
31
31
|
should "URL-escape the parts" do
|
32
32
|
subject.expects(:perform_request).with do |method, url, params, body|
|
33
|
-
assert_equal '
|
33
|
+
assert_equal '_nodes/foo%5Ebar/hot_threads', url
|
34
34
|
true
|
35
35
|
end.returns(FakeResponse.new)
|
36
36
|
|
@@ -10,7 +10,7 @@ module Elasticsearch
|
|
10
10
|
should "perform correct request" do
|
11
11
|
subject.expects(:perform_request).with do |method, url, params, body|
|
12
12
|
assert_equal 'GET', method
|
13
|
-
assert_equal '
|
13
|
+
assert_equal '_nodes', url
|
14
14
|
assert_equal Hash.new, params
|
15
15
|
assert_nil body
|
16
16
|
true
|
@@ -21,7 +21,7 @@ module Elasticsearch
|
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
23
23
|
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
-
assert_equal '
|
24
|
+
assert_equal '_nodes/foo', url
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
@@ -30,7 +30,7 @@ module Elasticsearch
|
|
30
30
|
|
31
31
|
should "send multiple :node_id-s correctly" do
|
32
32
|
subject.expects(:perform_request).with do |method, url, params, body|
|
33
|
-
assert_equal '
|
33
|
+
assert_equal '_nodes/A,B,C', url
|
34
34
|
true
|
35
35
|
end.returns(FakeResponse.new).twice
|
36
36
|
|
@@ -10,7 +10,7 @@ module Elasticsearch
|
|
10
10
|
should "perform correct request" do
|
11
11
|
subject.expects(:perform_request).with do |method, url, params, body|
|
12
12
|
assert_equal 'POST', method
|
13
|
-
assert_equal '
|
13
|
+
assert_equal '_nodes/_shutdown', url
|
14
14
|
assert_equal Hash.new, params
|
15
15
|
assert_nil body
|
16
16
|
true
|
@@ -21,7 +21,7 @@ module Elasticsearch
|
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
23
23
|
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
-
assert_equal '
|
24
|
+
assert_equal '_nodes/foo/_shutdown', url
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
@@ -30,7 +30,7 @@ module Elasticsearch
|
|
30
30
|
|
31
31
|
should "send multiple :node_id-s correctly" do
|
32
32
|
subject.expects(:perform_request).with do |method, url, params, body|
|
33
|
-
assert_equal '
|
33
|
+
assert_equal '_nodes/A,B,C/_shutdown', url
|
34
34
|
true
|
35
35
|
end.returns(FakeResponse.new).twice
|
36
36
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -219,22 +219,6 @@ dependencies:
|
|
219
219
|
- - ! '>='
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
|
-
- !ruby/object:Gem::Dependency
|
223
|
-
name: multi_json
|
224
|
-
requirement: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
|
-
requirements:
|
227
|
-
- - ! '>='
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
none: false
|
234
|
-
requirements:
|
235
|
-
- - ! '>='
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
version: '0'
|
238
222
|
- !ruby/object:Gem::Dependency
|
239
223
|
name: jbuilder
|
240
224
|
requirement: !ruby/object:Gem::Requirement
|