fog-hadoop 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ Shindo.tests('Fog::Compute[:hadoop] | info request', ['hadoop', 'compute']) do
2
+
3
+ @info_format = {
4
+ "id" => Integer,
5
+ "startedOn" => Integer,
6
+ "state" => String,
7
+ "resourceManagerVersion" => String,
8
+ "resourceManagerBuildVersion" => String,
9
+ "resourceManagerVersionBuiltOn" => String,
10
+ "hadoopVersion" => String,
11
+ "hadoopBuildVersion" => String,
12
+ "hadoopVersionBuiltOn" => String
13
+ }
14
+
15
+ tests('success') do
16
+ tests('#get_info') do
17
+ info = hadoop_compute_service.get_info
18
+ test 'returns a Hash' do
19
+ info.body.is_a? Hash
20
+ end
21
+ if Fog.mock?
22
+ tests('Info').formats(@info_format, false) do
23
+ info.body
24
+ end
25
+ else
26
+ returns(200) { info.status }
27
+ returns(true) { info.body.is_a? Hash }
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,45 @@
1
+ Shindo.tests('Fog::Compute[:hadoop] | metrics request', ['hadoop', 'compute']) do
2
+
3
+ @metrics_format = {
4
+ "appsSubmitted" => Integer,
5
+ "appsCompleted" => Integer,
6
+ "appsPending" => Integer,
7
+ "appsRunning" => Integer,
8
+ "appsFailed" => Integer,
9
+ "appsKilled" => Integer,
10
+ "reservedMB" => Integer,
11
+ "availableMB" => Integer,
12
+ "allocatedMB" => Integer,
13
+ "reservedVirtualCores" => Integer,
14
+ "availableVirtualCores" => Integer,
15
+ "allocatedVirtualCores" => Integer,
16
+ "containersAllocated" => Integer,
17
+ "containersReserved" => Integer,
18
+ "containersPending" => Integer,
19
+ "totalMB" => Integer,
20
+ "totalVirtualCores" => Integer,
21
+ "totalNodes" => Integer,
22
+ "lostNodes" => Integer,
23
+ "unhealthyNodes" => Integer,
24
+ "decommissionedNodes" => Integer,
25
+ "rebootedNodes" => Integer,
26
+ "activeNodes" => Integer
27
+ }
28
+
29
+ tests('success') do
30
+ tests('#get_metrics') do
31
+ metrics = hadoop_compute_service.get_metrics
32
+ test 'returns a Hash' do
33
+ metrics.body.is_a? Hash
34
+ end
35
+ if Fog.mock?
36
+ tests('Metrics').formats(@metrics_format, false) do
37
+ metrics.body
38
+ end
39
+ else
40
+ returns(200) { metrics.status }
41
+ returns(true) { metrics.body.is_a? Hash }
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,52 @@
1
+
2
+ Shindo.tests('Fog::Compute[:hadoop] | nodes request', %w(hadoop compute)) do
3
+
4
+ @node_format = {
5
+ 'rack' => String,
6
+ 'state' => String,
7
+ 'id' => String,
8
+ 'nodeHostName' => String,
9
+ 'nodeHTTPAddress' => String,
10
+ 'healthStatus' => String,
11
+ 'lastHealthUpdate' => Integer,
12
+ 'healthReport' => String,
13
+ 'numContainers' => Integer,
14
+ 'usedMemoryMB' => Integer,
15
+ 'availMemoryMB' => Integer,
16
+ 'usedVirtualCores' => Integer,
17
+ 'availableVirtualCores' => Integer
18
+ }
19
+
20
+ tests('#list_nodes') do
21
+ list_nodes = hadoop_compute_service.list_nodes
22
+ test 'returns a Hash' do
23
+ list_nodes.body.is_a? Array
24
+ end
25
+ if Fog.mock?
26
+ tests('List_Nodes').formats(@node_format, false) do
27
+ list_nodes.body.first
28
+ end
29
+ tests('List_Nodes').formats(@node_format, false) do
30
+ list_nodes.body.last
31
+ end
32
+ else
33
+ returns(200) { list_nodes.status }
34
+ returns(true) { list_nodes.body.is_a? Array }
35
+ end
36
+ end
37
+
38
+ tests('#get_nodes') do
39
+ get_node = hadoop_compute_service.get_node('sample')
40
+ test 'returns a Hash' do
41
+ get_node.body.is_a? Hash
42
+ end
43
+ if Fog.mock?
44
+ tests('Nodes').formats(@node_format, false) do
45
+ get_node.body
46
+ end
47
+ else
48
+ returns(200) { get_node.status }
49
+ returns(true) { get_node.body.is_a? Hash }
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,22 @@
1
+ ## Initialize credentials
2
+ ENV['FOG_RC'] = ENV['FOG_RC'] || File.expand_path('../.fog', __FILE__)
3
+
4
+ ## From fog-core
5
+ require 'fog/test_helpers'
6
+ require 'fog/hadoop'
7
+ require "simplecov"
8
+ SimpleCov.start
9
+
10
+ if ENV['FOG_MOCK'] == 'true'
11
+ Fog.mock!
12
+ end
13
+
14
+ if Fog.mock?
15
+ Fog.credentials = {
16
+ hadoop_compute_api_url: 'http://localhost:8088'
17
+ }.merge(Fog.credentials)
18
+ end
19
+
20
+ def hadoop_compute_service
21
+ Fog::Compute[:hadoop]
22
+ end
metadata ADDED
@@ -0,0 +1,275 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fog-hadoop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Alberto Gutierrez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fog-core
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: fog-json
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
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: rbvmomi
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: yard
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: thor
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
+ - !ruby/object:Gem::Dependency
126
+ name: rbovirt
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.0.24
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.0.24
139
+ - !ruby/object:Gem::Dependency
140
+ name: shindo
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.3.4
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.3.4
153
+ - !ruby/object:Gem::Dependency
154
+ name: fission
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: codeclimate-test-reporter
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 1.0.0
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 1.0.0
209
+ description: |-
210
+ This library can be used as a module for `fog` or as standalone provider
211
+ to use the Hadoop services in applications..
212
+ email:
213
+ - aljesusg@gmail.com
214
+ executables: []
215
+ extensions: []
216
+ extra_rdoc_files: []
217
+ files:
218
+ - ".gitignore"
219
+ - ".rubocop.yml"
220
+ - ".ruby-gemset"
221
+ - ".ruby-version"
222
+ - ".travis.yml"
223
+ - CONTRIBUTING.md
224
+ - CONTRIBUTORS.md
225
+ - Gemfile
226
+ - LICENSE
227
+ - README.md
228
+ - Rakefile
229
+ - bin/console
230
+ - bin/setup
231
+ - docs/yarn.md
232
+ - fog-hadoop.gemspec
233
+ - lib/fog/hadoop.rb
234
+ - lib/fog/hadoop/compute.rb
235
+ - lib/fog/hadoop/requests/compute/get_app_stats.rb
236
+ - lib/fog/hadoop/requests/compute/get_app_stats_detail.rb
237
+ - lib/fog/hadoop/requests/compute/get_info.rb
238
+ - lib/fog/hadoop/requests/compute/get_metrics.rb
239
+ - lib/fog/hadoop/requests/compute/get_node.rb
240
+ - lib/fog/hadoop/requests/compute/list_nodes.rb
241
+ - lib/fog/hadoop/script.rb
242
+ - lib/fog/hadoop/utils/request.rb
243
+ - lib/fog/hadoop/version.rb
244
+ - spec/spec_helper.rb
245
+ - supported.md
246
+ - tests/hadoop/requests/compute/app_stats_tests.rb
247
+ - tests/hadoop/requests/compute/info_tests.rb
248
+ - tests/hadoop/requests/compute/metric_tests.rb
249
+ - tests/hadoop/requests/compute/nodes_tests.rb
250
+ - tests/helper.rb
251
+ homepage: http://github.com/fog/fog-hadoop
252
+ licenses:
253
+ - MIT
254
+ metadata: {}
255
+ post_install_message:
256
+ rdoc_options: []
257
+ require_paths:
258
+ - lib
259
+ required_ruby_version: !ruby/object:Gem::Requirement
260
+ requirements:
261
+ - - ">="
262
+ - !ruby/object:Gem::Version
263
+ version: '0'
264
+ required_rubygems_version: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - ">="
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
269
+ requirements: []
270
+ rubyforge_project:
271
+ rubygems_version: 2.5.1
272
+ signing_key:
273
+ specification_version: 4
274
+ summary: Module for the 'fog' gem to support Hadoop services.
275
+ test_files: []