elastomer-cli 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,212 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:9200/_cluster/health
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.0
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - '*/*'
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=UTF-8
23
+ Content-Length:
24
+ - '224'
25
+ body:
26
+ encoding: UTF-8
27
+ string: '{"cluster_name":"elasticsearch","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0}'
28
+ http_version:
29
+ recorded_at: Sat, 07 Jun 2014 19:57:26 GMT
30
+ - request:
31
+ method: get
32
+ uri: http://localhost:9200/_nodes/_local/hot_threads
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ''
36
+ headers:
37
+ User-Agent:
38
+ - Faraday v0.9.0
39
+ Accept-Encoding:
40
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
41
+ Accept:
42
+ - '*/*'
43
+ response:
44
+ status:
45
+ code: 200
46
+ message: OK
47
+ headers:
48
+ Content-Type:
49
+ - text/plain; charset=UTF-8
50
+ Content-Length:
51
+ - '1861'
52
+ body:
53
+ encoding: UTF-8
54
+ string: "::: [Bug][ZkvnK0A8QCOfoPeqEe-Nrw][grants-mbp-2][inet[/192.168.1.185:9300]]\n
55
+ \ \n 0.1% (401micros out of 500ms) cpu usage by thread 'elasticsearch[Bug][scheduler][T#1]'\n
56
+ \ 10/10 snapshots sharing following 9 elements\n sun.misc.Unsafe.park(Native
57
+ Method)\n java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)\n
58
+ \ java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082)\n
59
+ \ java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)\n
60
+ \ java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)\n
61
+ \ java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)\n
62
+ \ java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)\n
63
+ \ java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\n
64
+ \ java.lang.Thread.run(Thread.java:745)\n \n 0.0% (244micros out
65
+ of 500ms) cpu usage by thread 'elasticsearch[Bug][transport_client_timer][T#1]{Hashed
66
+ wheel timer #1}'\n 10/10 snapshots sharing following 5 elements\n java.lang.Thread.sleep(Native
67
+ Method)\n org.elasticsearch.common.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:483)\n
68
+ \ org.elasticsearch.common.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:392)\n
69
+ \ org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)\n
70
+ \ java.lang.Thread.run(Thread.java:745)\n \n 0.0% (93micros out
71
+ of 500ms) cpu usage by thread 'elasticsearch[Bug][[timer]]'\n 10/10 snapshots
72
+ sharing following 2 elements\n java.lang.Thread.sleep(Native Method)\n
73
+ \ org.elasticsearch.threadpool.ThreadPool$EstimatedTimeThread.run(ThreadPool.java:518)\n\n"
74
+ http_version:
75
+ recorded_at: Wed, 18 Jun 2014 01:14:57 GMT
76
+ - request:
77
+ method: get
78
+ uri: http://localhost:9200/_nodes/_local
79
+ body:
80
+ encoding: US-ASCII
81
+ string: ''
82
+ headers:
83
+ User-Agent:
84
+ - Faraday v0.9.0
85
+ Accept-Encoding:
86
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
87
+ Accept:
88
+ - '*/*'
89
+ response:
90
+ status:
91
+ code: 200
92
+ message: OK
93
+ headers:
94
+ Content-Type:
95
+ - application/json; charset=UTF-8
96
+ Content-Length:
97
+ - '2843'
98
+ body:
99
+ encoding: UTF-8
100
+ string: '{"cluster_name":"elasticsearch","nodes":{"ZkvnK0A8QCOfoPeqEe-Nrw":{"name":"Bug","transport_address":"inet[/192.168.1.185:9300]","host":"grants-mbp-2","ip":"192.168.1.185","version":"1.2.1","build":"6c95b75","http_address":"inet[/192.168.1.185:9200]","settings":{"path":{"logs":"/Users/grantr/scratch/elasticsearch-1.2.1/logs","home":"/Users/grantr/scratch/elasticsearch-1.2.1"},"cluster":{"name":"elasticsearch"},"cloud":{"aws":{"region":"us-west-2"}},"foreground":"yes","name":"Bug"},"os":{"refresh_interval_in_millis":1000,"available_processors":8,"cpu":{"vendor":"Intel","model":"MacBookPro10,1","mhz":2800,"total_cores":8,"total_sockets":8,"cores_per_socket":16,"cache_size_in_bytes":256},"mem":{"total_in_bytes":17179869184},"swap":{"total_in_bytes":1073741824}},"process":{"refresh_interval_in_millis":1000,"id":26535,"max_file_descriptors":10240,"mlockall":false},"jvm":{"pid":26535,"version":"1.7.0_55","vm_name":"Java
101
+ HotSpot(TM) 64-Bit Server VM","vm_version":"24.55-b03","vm_vendor":"Oracle
102
+ Corporation","start_time_in_millis":1403052039020,"mem":{"heap_init_in_bytes":268435456,"heap_max_in_bytes":1037959168,"non_heap_init_in_bytes":24313856,"non_heap_max_in_bytes":136314880,"direct_max_in_bytes":1037959168},"gc_collectors":["ParNew","ConcurrentMarkSweep"],"memory_pools":["Code
103
+ Cache","Par Eden Space","Par Survivor Space","CMS Old Gen","CMS Perm Gen"]},"thread_pool":{"generic":{"type":"cached","keep_alive":"30s"},"index":{"type":"fixed","min":8,"max":8,"queue_size":"200"},"snapshot_data":{"type":"scaling","min":1,"max":5,"keep_alive":"5m"},"bench":{"type":"scaling","min":1,"max":4,"keep_alive":"5m"},"get":{"type":"fixed","min":8,"max":8,"queue_size":"1k"},"snapshot":{"type":"scaling","min":1,"max":4,"keep_alive":"5m"},"merge":{"type":"scaling","min":1,"max":4,"keep_alive":"5m"},"suggest":{"type":"fixed","min":8,"max":8,"queue_size":"1k"},"bulk":{"type":"fixed","min":8,"max":8,"queue_size":"50"},"optimize":{"type":"fixed","min":1,"max":1},"warmer":{"type":"scaling","min":1,"max":4,"keep_alive":"5m"},"flush":{"type":"scaling","min":1,"max":4,"keep_alive":"5m"},"search":{"type":"fixed","min":24,"max":24,"queue_size":"1k"},"percolate":{"type":"fixed","min":8,"max":8,"queue_size":"1k"},"management":{"type":"scaling","min":1,"max":5,"keep_alive":"5m"},"refresh":{"type":"scaling","min":1,"max":4,"keep_alive":"5m"}},"network":{"refresh_interval_in_millis":5000,"primary_interface":{"address":"192.168.1.185","name":"en0","mac_address":"28:CF:E9:12:EB:D3"}},"transport":{"bound_address":"inet[/0:0:0:0:0:0:0:0:9300]","publish_address":"inet[/192.168.1.185:9300]"},"http":{"bound_address":"inet[/0:0:0:0:0:0:0:0:9200]","publish_address":"inet[/192.168.1.185:9200]","max_content_length_in_bytes":104857600},"plugins":[{"name":"cloud-aws","version":"2.1.1","description":"Cloud
104
+ AWS Plugin","jvm":true,"site":false}]}}}'
105
+ http_version:
106
+ recorded_at: Wed, 18 Jun 2014 01:28:06 GMT
107
+ - request:
108
+ method: get
109
+ uri: http://localhost:9200/_cluster/settings?flat_settings=true
110
+ body:
111
+ encoding: US-ASCII
112
+ string: ''
113
+ headers:
114
+ User-Agent:
115
+ - Faraday v0.9.0
116
+ Accept-Encoding:
117
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
118
+ Accept:
119
+ - '*/*'
120
+ response:
121
+ status:
122
+ code: 200
123
+ message: OK
124
+ headers:
125
+ Content-Type:
126
+ - application/json; charset=UTF-8
127
+ Content-Length:
128
+ - '129'
129
+ body:
130
+ encoding: UTF-8
131
+ string: '{"persistent":{"indices.ttl.interval":"50"},"transient":{"indices.ttl.interval":"60","cluster.routing.allocation.enable":"true"}}'
132
+ http_version:
133
+ recorded_at: Wed, 18 Jun 2014 01:48:45 GMT
134
+ - request:
135
+ method: get
136
+ uri: http://localhost:9200/
137
+ body:
138
+ encoding: US-ASCII
139
+ string: ''
140
+ headers:
141
+ User-Agent:
142
+ - Faraday v0.9.0
143
+ Accept-Encoding:
144
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
145
+ Accept:
146
+ - '*/*'
147
+ response:
148
+ status:
149
+ code: 200
150
+ message: OK
151
+ headers:
152
+ Content-Type:
153
+ - application/json; charset=UTF-8
154
+ Content-Length:
155
+ - '292'
156
+ body:
157
+ encoding: UTF-8
158
+ string: |
159
+ {
160
+ "status" : 200,
161
+ "name" : "Bug",
162
+ "version" : {
163
+ "number" : "1.2.1",
164
+ "build_hash" : "6c95b759f9e7ef0f8e17f77d850da43ce8a4b364",
165
+ "build_timestamp" : "2014-06-03T15:02:52Z",
166
+ "build_snapshot" : false,
167
+ "lucene_version" : "4.8"
168
+ },
169
+ "tagline" : "You Know, for Search"
170
+ }
171
+ http_version:
172
+ recorded_at: Wed, 18 Jun 2014 02:19:40 GMT
173
+ - request:
174
+ method: get
175
+ uri: http://localhost:9200/
176
+ body:
177
+ encoding: US-ASCII
178
+ string: ''
179
+ headers:
180
+ User-Agent:
181
+ - Faraday v0.9.0
182
+ Accept-Encoding:
183
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
184
+ Accept:
185
+ - '*/*'
186
+ response:
187
+ status:
188
+ code: 200
189
+ message: OK
190
+ headers:
191
+ Content-Type:
192
+ - application/json; charset=UTF-8
193
+ Content-Length:
194
+ - '292'
195
+ body:
196
+ encoding: UTF-8
197
+ string: |
198
+ {
199
+ "status" : 200,
200
+ "name" : "Bug",
201
+ "version" : {
202
+ "number" : "1.2.1",
203
+ "build_hash" : "6c95b759f9e7ef0f8e17f77d850da43ce8a4b364",
204
+ "build_timestamp" : "2014-06-03T15:02:52Z",
205
+ "build_snapshot" : false,
206
+ "lucene_version" : "4.8"
207
+ },
208
+ "tagline" : "You Know, for Search"
209
+ }
210
+ http_version:
211
+ recorded_at: Wed, 18 Jun 2014 02:19:40 GMT
212
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,30 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:9201/_cluster/health
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.0
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=UTF-8
23
+ Content-Length:
24
+ - '227'
25
+ body:
26
+ encoding: UTF-8
27
+ string: "{\"cluster_name\":\"elasticsearch\",\"status\":\"green\",\"timed_out\":false,\"number_of_nodes\":2,\"number_of_data_nodes\":2,\"active_primary_shards\":93,\"active_shards\":183,\"relocating_shards\":0,\"initializing_shards\":0,\"unassigned_shards\":0}"
28
+ http_version:
29
+ recorded_at: Tue, 24 Jun 2014 21:06:25 GMT
30
+ recorded_with: VCR 2.9.2
data/test/node_test.rb ADDED
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../test_helper', __FILE__)
2
+
3
+ describe Elastomer::CLI::Node do
4
+ describe 'hot_threads' do
5
+ it 'should get local hot_threads' do
6
+ VCR.use_cassette('default') do
7
+ elastomer 'node hot_threads'
8
+ @out.must_match(/^:::/)
9
+ end
10
+ end
11
+ end
12
+
13
+ describe 'list' do
14
+ it 'should get a node list' do
15
+ VCR.use_cassette('default') do
16
+ elastomer 'node list'
17
+ @out.must_match "Bug"
18
+ @out.must_match "grants-mbp-2"
19
+ @out.must_match "1.2.1"
20
+ @out.must_match "inet[/192.168.1.185:9200]"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,47 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ require 'minitest/autorun'
5
+ require 'webmock'
6
+ require 'vcr'
7
+
8
+ require 'elastomer/cli'
9
+
10
+ # Don't raise errors, test output instead
11
+ ENV['THOR_DEBUG'] = '0'
12
+
13
+ VCR.configure do |c|
14
+ c.cassette_library_dir = File.expand_path('../fixtures/vcr_cassettes', __FILE__)
15
+ c.hook_into :webmock
16
+ end
17
+
18
+ module CLITestSupport
19
+ # Run the elastomer cli app in process and capture the output.
20
+ #
21
+ # argv - The list of arguments to the command. Can be specified as a string,
22
+ # a list of strings, or an array of strings. In the string form,
23
+ # arguments are split on spaces, so use the list or array form to
24
+ # preserve spaces.
25
+ #
26
+ # Examples
27
+ #
28
+ # elastomer "foo bar"
29
+ # elastomer "foo", "bar with spaces"
30
+ # elastomer ["foo", "bar with spaces"]
31
+ #
32
+ # Returns the captured stdout and stderr content, and sets @out and @err with
33
+ # the same content.
34
+ def elastomer(*argv)
35
+ argv = argv.flatten
36
+ if argv.size == 1
37
+ argv = argv.first.split(" ")
38
+ end
39
+ @out, @err = capture_io do
40
+ Elastomer::CLI.start(argv)
41
+ end
42
+ end
43
+ end
44
+
45
+ class Minitest::Test
46
+ include CLITestSupport
47
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elastomer-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Grant Rodgers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: terminal-table
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: elastomer-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.3.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: vcr
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: ''
126
+ email:
127
+ - grant.rodgers@github.com
128
+ executables:
129
+ - elastomer
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".ruby-version"
135
+ - CHANGELOG.md
136
+ - Gemfile
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - bin/elastomer
141
+ - elastomer-cli.gemspec
142
+ - lib/elastomer/cli.rb
143
+ - lib/elastomer/cli/application.rb
144
+ - lib/elastomer/cli/base.rb
145
+ - lib/elastomer/cli/cluster.rb
146
+ - lib/elastomer/cli/node.rb
147
+ - lib/elastomer/cli/version.rb
148
+ - script/bootstrap
149
+ - script/cibuild
150
+ - script/console
151
+ - script/test
152
+ - test/application_test.rb
153
+ - test/cluster_test.rb
154
+ - test/fixtures/vcr_cassettes/0_20.yml
155
+ - test/fixtures/vcr_cassettes/0_90.yml
156
+ - test/fixtures/vcr_cassettes/1_x.yml
157
+ - test/fixtures/vcr_cassettes/default.yml
158
+ - test/fixtures/vcr_cassettes/default_9201.yml
159
+ - test/node_test.rb
160
+ - test/test_helper.rb
161
+ homepage: https://github.com/github/elastomer-cli
162
+ licenses:
163
+ - MIT
164
+ metadata: {}
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ requirements: []
180
+ rubyforge_project:
181
+ rubygems_version: 2.2.0
182
+ signing_key:
183
+ specification_version: 4
184
+ summary: Command line interface for elastomer
185
+ test_files:
186
+ - test/application_test.rb
187
+ - test/cluster_test.rb
188
+ - test/fixtures/vcr_cassettes/0_20.yml
189
+ - test/fixtures/vcr_cassettes/0_90.yml
190
+ - test/fixtures/vcr_cassettes/1_x.yml
191
+ - test/fixtures/vcr_cassettes/default.yml
192
+ - test/fixtures/vcr_cassettes/default_9201.yml
193
+ - test/node_test.rb
194
+ - test/test_helper.rb