allq_rest 1.2.4 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -32
- data/allq_rest-1.2.5.gem +0 -0
- data/allq_rest-1.2.6.gem +0 -0
- data/allq_rest.gemspec +2 -8
- data/deploy.sh +1 -1
- data/lib/allq_rest/api_client.rb +1 -0
- data/lib/allq_rest/configuration.rb +0 -1
- data/lib/allq_rest/models/stats_tube.rb +24 -3
- data/lib/allq_rest/version.rb +1 -1
- data/spec/api/actions_api_spec.rb +96 -91
- data/spec/spec_helper.rb +2 -0
- metadata +7 -126
- data/allq_rest-1.2.3.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c894f6fe084a132d3a7c91b3950eb33720577989fe902f5b2e932fdd9906f5b1
|
4
|
+
data.tar.gz: c223af34965d58659dd116568268ef12dad30c473dba5db0d894a8fbd01958e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da34829fbc9288c6161c74b8f4595608c3e16568e34ae977e41960b2e9b36225af3acbece2b96f49df6245bbcc4c93e3f8aea608e0836a25402b7f73a5466e2d
|
7
|
+
data.tar.gz: c69151989a83c5d1bf2344876430254dd88e32fdc9eeeba7e99cb562cde2ff4cc96dca19972231de53e0372d3f4c82db3901a3af82656bf02bc1676dc57a60ff
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
allq_rest (1.2.
|
4
|
+
allq_rest (1.2.7)
|
5
5
|
json (~> 2.1, >= 2.1.0)
|
6
6
|
typhoeus (~> 1.0, >= 1.0.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
ZenTest (4.12.0)
|
12
|
-
addressable (2.7.0)
|
13
|
-
public_suffix (>= 2.0.2, < 5.0)
|
14
|
-
autotest (4.4.6)
|
15
|
-
ZenTest (>= 4.4.1)
|
16
|
-
autotest-fsevent (0.2.17)
|
17
|
-
sys-uname
|
18
|
-
autotest-growl (0.2.16)
|
19
|
-
autotest-rails-pure (4.1.2)
|
20
|
-
crack (0.4.3)
|
21
|
-
safe_yaml (~> 1.0.0)
|
22
11
|
diff-lcs (1.4.4)
|
23
|
-
ethon (0.
|
24
|
-
ffi (>= 1.
|
25
|
-
ffi (1.
|
26
|
-
|
27
|
-
json (2.3.1)
|
28
|
-
public_suffix (4.0.6)
|
12
|
+
ethon (0.15.0)
|
13
|
+
ffi (>= 1.15.0)
|
14
|
+
ffi (1.15.5)
|
15
|
+
json (2.6.1)
|
29
16
|
rake (12.0.0)
|
30
17
|
rspec (3.9.0)
|
31
18
|
rspec-core (~> 3.9.0)
|
@@ -40,28 +27,16 @@ GEM
|
|
40
27
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
28
|
rspec-support (~> 3.9.0)
|
42
29
|
rspec-support (3.9.3)
|
43
|
-
safe_yaml (1.0.5)
|
44
|
-
sys-uname (1.2.1)
|
45
|
-
ffi (>= 1.0.0)
|
46
30
|
typhoeus (1.4.0)
|
47
31
|
ethon (>= 0.9.0)
|
48
|
-
vcr (3.0.3)
|
49
|
-
webmock (1.24.6)
|
50
|
-
addressable (>= 2.3.6)
|
51
|
-
crack (>= 0.3.2)
|
52
|
-
hashdiff
|
53
32
|
|
54
33
|
PLATFORMS
|
55
34
|
ruby
|
56
35
|
|
57
36
|
DEPENDENCIES
|
58
37
|
allq_rest!
|
59
|
-
autotest (~> 4.4, >= 4.4.6)
|
60
|
-
autotest-fsevent (~> 0.2, >= 0.2.12)
|
61
|
-
autotest-growl (~> 0.2, >= 0.2.16)
|
62
|
-
autotest-rails-pure (~> 4.1, >= 4.1.2)
|
63
38
|
rake (~> 12.0.0)
|
64
39
|
rspec (~> 3.6, >= 3.6.0)
|
65
|
-
vcr (~> 3.0, >= 3.0.1)
|
66
|
-
webmock (~> 1.24, >= 1.24.3)
|
67
40
|
|
41
|
+
BUNDLED WITH
|
42
|
+
2.2.3
|
data/allq_rest-1.2.5.gem
ADDED
Binary file
|
data/allq_rest-1.2.6.gem
ADDED
Binary file
|
data/allq_rest.gemspec
CHANGED
@@ -13,20 +13,14 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.summary = "Ruby REST client for Allq platform"
|
14
14
|
s.description = "Allq API Client"
|
15
15
|
# TODO uncommnet and update below with a proper license
|
16
|
-
|
16
|
+
s.license = "Apache 2.0"
|
17
17
|
s.required_ruby_version = "> 2.3"
|
18
18
|
|
19
19
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
20
20
|
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
|
21
21
|
|
22
22
|
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
23
|
-
|
24
|
-
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
|
25
|
-
s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
|
26
|
-
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
|
27
|
-
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
28
|
-
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
29
|
-
|
23
|
+
|
30
24
|
s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
|
31
25
|
s.test_files = `find spec/*`.split("\n")
|
32
26
|
s.executables = []
|
data/deploy.sh
CHANGED
data/lib/allq_rest/api_client.rb
CHANGED
@@ -30,6 +30,7 @@ module Allq
|
|
30
30
|
# Initializes the ApiClient
|
31
31
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
32
|
def initialize(config = Configuration.default)
|
33
|
+
Ethon.logger = Logger.new(nil)
|
33
34
|
@config = config
|
34
35
|
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
|
35
36
|
@default_headers = {
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.21
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -33,6 +33,12 @@ module Allq
|
|
33
33
|
# TPS of throttle
|
34
34
|
attr_accessor :throttle_size
|
35
35
|
|
36
|
+
# Average duration of job
|
37
|
+
attr_accessor :avg
|
38
|
+
|
39
|
+
# Average duration of job
|
40
|
+
attr_accessor :tps
|
41
|
+
|
36
42
|
# Name of tube
|
37
43
|
attr_accessor :tube
|
38
44
|
|
@@ -45,6 +51,8 @@ module Allq
|
|
45
51
|
:'buried' => :'buried',
|
46
52
|
:'parents' => :'parents',
|
47
53
|
:'throttle_size' => :'throttle_size',
|
54
|
+
:'avg' => :'avg',
|
55
|
+
:'tps' => :'tps',
|
48
56
|
:'tube' => :'tube'
|
49
57
|
}
|
50
58
|
end
|
@@ -58,6 +66,8 @@ module Allq
|
|
58
66
|
:'buried' => :'Integer',
|
59
67
|
:'parents' => :'Integer',
|
60
68
|
:'throttle_size' => :'Integer',
|
69
|
+
:'avg' => :'Integer',
|
70
|
+
:'tps' => :'tps',
|
61
71
|
:'tube' => :'String'
|
62
72
|
}
|
63
73
|
end
|
@@ -104,6 +114,14 @@ module Allq
|
|
104
114
|
self.throttle_size = attributes[:'throttle_size']
|
105
115
|
end
|
106
116
|
|
117
|
+
if attributes.has_key?(:'avg')
|
118
|
+
self.avg = attributes[:'avg']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'tps')
|
122
|
+
self.tps = attributes[:'tps']
|
123
|
+
end
|
124
|
+
|
107
125
|
if attributes.has_key?(:'tube')
|
108
126
|
self.tube = attributes[:'tube']
|
109
127
|
end
|
@@ -163,6 +181,8 @@ module Allq
|
|
163
181
|
buried == o.buried &&
|
164
182
|
parents == o.parents &&
|
165
183
|
throttle_size == o.throttle_size &&
|
184
|
+
avg == o.avg &&
|
185
|
+
tps == o.tps &&
|
166
186
|
tube == o.tube
|
167
187
|
end
|
168
188
|
|
@@ -175,7 +195,7 @@ module Allq
|
|
175
195
|
# Calculates hash code according to all attributes.
|
176
196
|
# @return [Fixnum] Hash code
|
177
197
|
def hash
|
178
|
-
[ready, delayed, reserved, buried, parents, throttle_size, tube].hash
|
198
|
+
[ready, delayed, reserved, buried, parents, throttle_size, avg, tube].hash
|
179
199
|
end
|
180
200
|
|
181
201
|
# Builds the object from hash
|
@@ -185,7 +205,7 @@ module Allq
|
|
185
205
|
return nil unless attributes.is_a?(Hash)
|
186
206
|
self.class.swagger_types.each_pair do |key, type|
|
187
207
|
if type =~ /\AArray<(.*)>/i
|
188
|
-
# check to ensure the input is an array given that the
|
208
|
+
# check to ensure the input is an array given that the attribute
|
189
209
|
# is documented as an array but the input is not
|
190
210
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
191
211
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -281,5 +301,6 @@ module Allq
|
|
281
301
|
value
|
282
302
|
end
|
283
303
|
end
|
304
|
+
|
284
305
|
end
|
285
306
|
end
|
data/lib/allq_rest/version.rb
CHANGED
@@ -24,10 +24,13 @@ describe 'ActionsApi' do
|
|
24
24
|
allq_conf = Allq::Configuration.new do |config|
|
25
25
|
config.host = ENV['ALLQ_CLIENT_LOCATION'] || 'localhost:8091'
|
26
26
|
end
|
27
|
-
|
28
27
|
raw_client = Allq::ApiClient.new(allq_conf)
|
29
28
|
@instance = Allq::ActionsApi.new(raw_client)
|
30
|
-
|
29
|
+
@admin_tools = Allq::AdminApi.new(raw_client)
|
30
|
+
|
31
|
+
@allq_tool = AllQTools.new(@instance, @admin_tools)
|
32
|
+
|
33
|
+
stats_result = @allq_tool.get_stats[0]
|
31
34
|
stats_result.stats.each do |stat|
|
32
35
|
@instance.tube_delete(stat.tube)
|
33
36
|
end
|
@@ -51,12 +54,12 @@ describe 'ActionsApi' do
|
|
51
54
|
# @return [BasicResponse]
|
52
55
|
describe 'bury_put test' do
|
53
56
|
it "should work" do
|
54
|
-
|
55
|
-
expect(
|
57
|
+
@allq_tool.add_job
|
58
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
56
59
|
job = @instance.job_get(DEFAULT_TUBE)
|
57
60
|
@instance.bury_put(job.id)
|
58
|
-
expect(
|
59
|
-
expect(
|
61
|
+
expect(@allq_tool.get_buried(DEFAULT_TUBE)).to eq(1)
|
62
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
@@ -69,11 +72,11 @@ describe 'ActionsApi' do
|
|
69
72
|
# @return [BasicResponse]
|
70
73
|
describe 'job_delete test' do
|
71
74
|
it "should work" do
|
72
|
-
|
73
|
-
expect(
|
75
|
+
@allq_tool.add_job
|
76
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
74
77
|
job = @instance.peek_get(DEFAULT_TUBE)
|
75
78
|
@instance.job_delete(job.id, tube: DEFAULT_TUBE)
|
76
|
-
expect(
|
79
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
77
80
|
end
|
78
81
|
end
|
79
82
|
|
@@ -85,9 +88,9 @@ describe 'ActionsApi' do
|
|
85
88
|
# @return [JobResponse]
|
86
89
|
describe 'job_get test' do
|
87
90
|
it "should work" do
|
88
|
-
|
91
|
+
@allq_tool.add_job
|
89
92
|
job = @instance.job_get(DEFAULT_TUBE)
|
90
|
-
expect(
|
93
|
+
expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
|
91
94
|
expect(job.id).to be_truthy
|
92
95
|
end
|
93
96
|
end
|
@@ -101,19 +104,19 @@ describe 'ActionsApi' do
|
|
101
104
|
describe 'mulitple_job_get test' do
|
102
105
|
it "should work" do
|
103
106
|
1.upto(6) do
|
104
|
-
|
107
|
+
@allq_tool.add_job
|
105
108
|
end
|
106
109
|
multiple_jobs = @instance.multiple_job_get(DEFAULT_TUBE, 4)
|
107
110
|
expect(multiple_jobs.jobs.length).to eq(4)
|
108
|
-
expect(
|
111
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
|
109
112
|
multiple_jobs.jobs.each do |job|
|
110
113
|
@instance.job_delete(job.id)
|
111
114
|
end
|
112
|
-
expect(
|
115
|
+
expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(0)
|
113
116
|
|
114
117
|
multiple_jobs = @instance.multiple_job_get(DEFAULT_TUBE, 4)
|
115
118
|
expect(multiple_jobs.jobs.length).to eq(2)
|
116
|
-
expect(
|
119
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
117
120
|
end
|
118
121
|
end
|
119
122
|
|
@@ -125,8 +128,8 @@ describe 'ActionsApi' do
|
|
125
128
|
# @return [JobRef]
|
126
129
|
describe 'job_post test' do
|
127
130
|
it "should work" do
|
128
|
-
|
129
|
-
expect(
|
131
|
+
@allq_tool.add_job
|
132
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
130
133
|
job = @instance.job_get(DEFAULT_TUBE)
|
131
134
|
expect(job.id).to be_truthy
|
132
135
|
end
|
@@ -149,18 +152,18 @@ describe 'ActionsApi' do
|
|
149
152
|
run_on_timeout: false,
|
150
153
|
limit: 2)
|
151
154
|
new_parent_job_response = @instance.parent_job_post(new_parent_job)
|
152
|
-
expect(
|
153
|
-
job =
|
155
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
|
156
|
+
job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
|
154
157
|
@instance.job_post(job)
|
155
|
-
job =
|
158
|
+
job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
|
156
159
|
@instance.job_post(job)
|
157
|
-
expect(
|
158
|
-
|
159
|
-
|
160
|
-
expect(
|
161
|
-
expect(
|
162
|
-
|
163
|
-
expect(
|
160
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
|
161
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
162
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
163
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
164
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
|
165
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
166
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
164
167
|
end
|
165
168
|
end
|
166
169
|
|
@@ -181,19 +184,19 @@ describe 'ActionsApi' do
|
|
181
184
|
run_on_timeout: false,
|
182
185
|
limit: 2)
|
183
186
|
new_parent_job_response = @instance.parent_job_post(new_parent_job)
|
184
|
-
expect(
|
187
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
|
185
188
|
|
186
|
-
job =
|
189
|
+
job = @allq_tool.new_job('foo', nil, new_parent_job_response.job_id)
|
187
190
|
@instance.job_post(job)
|
188
|
-
job =
|
191
|
+
job = @allq_tool.new_job('foo', nil, new_parent_job_response.job_id)
|
189
192
|
@instance.job_post(job)
|
190
|
-
expect(
|
191
|
-
|
192
|
-
|
193
|
-
expect(
|
194
|
-
expect(
|
195
|
-
|
196
|
-
expect(
|
193
|
+
expect(@allq_tool.get_ready('foo')).to eq(2)
|
194
|
+
@allq_tool.get_finish('foo')
|
195
|
+
@allq_tool.get_finish('foo')
|
196
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
197
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
|
198
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
199
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
197
200
|
end
|
198
201
|
end
|
199
202
|
|
@@ -214,16 +217,16 @@ describe 'ActionsApi' do
|
|
214
217
|
run_on_timeout: true,
|
215
218
|
limit: 2)
|
216
219
|
new_parent_job_response = @instance.parent_job_post(new_parent_job)
|
217
|
-
expect(
|
220
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
|
218
221
|
|
219
|
-
job =
|
222
|
+
job = @allq_tool.new_job('foo', nil, new_parent_job_response.job_id)
|
220
223
|
@instance.job_post(job)
|
221
|
-
expect(
|
222
|
-
expect(
|
224
|
+
expect(@allq_tool.get_ready('foo')).to eq(1)
|
225
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
|
223
226
|
|
224
227
|
sleep(7)
|
225
|
-
expect(
|
226
|
-
expect(
|
228
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
|
229
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
227
230
|
end
|
228
231
|
end
|
229
232
|
|
@@ -236,7 +239,7 @@ describe 'ActionsApi' do
|
|
236
239
|
# @return [JobResponse]
|
237
240
|
describe 'peek_get test' do
|
238
241
|
it "should work" do
|
239
|
-
|
242
|
+
@allq_tool.add_job
|
240
243
|
job = @instance.peek_get(DEFAULT_TUBE)
|
241
244
|
expect(job.id).to be_truthy
|
242
245
|
end
|
@@ -244,7 +247,7 @@ describe 'ActionsApi' do
|
|
244
247
|
|
245
248
|
describe 'peek_get buried test' do
|
246
249
|
it "should work" do
|
247
|
-
|
250
|
+
@allq_tool.add_job
|
248
251
|
job = @instance.peek_get(DEFAULT_TUBE, buried: true)
|
249
252
|
expect(job.id).to be_falsey
|
250
253
|
job = @instance.job_get(DEFAULT_TUBE)
|
@@ -277,20 +280,20 @@ describe 'ActionsApi' do
|
|
277
280
|
# @return [BasicResponse]
|
278
281
|
describe 'release_put test' do
|
279
282
|
it "should work" do
|
280
|
-
|
281
|
-
expect(
|
283
|
+
@allq_tool.add_job
|
284
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
282
285
|
job = @instance.job_get(DEFAULT_TUBE)
|
283
|
-
expect(
|
286
|
+
expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
|
284
287
|
expect(job.id).to be_truthy
|
285
288
|
@instance.release_put(job.id)
|
286
|
-
expect(
|
289
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
287
290
|
end
|
288
291
|
end
|
289
292
|
|
290
293
|
describe 'release should increment release' do
|
291
294
|
it "should work" do
|
292
|
-
|
293
|
-
expect(
|
295
|
+
@allq_tool.add_job
|
296
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
294
297
|
job = @instance.job_get(DEFAULT_TUBE)
|
295
298
|
expect(job.releases).to eq(0)
|
296
299
|
@instance.release_put(job.id)
|
@@ -322,25 +325,25 @@ describe 'ActionsApi' do
|
|
322
325
|
run_on_timeout: false,
|
323
326
|
limit: nil)
|
324
327
|
new_parent_job_response = @instance.parent_job_post(new_parent_job)
|
325
|
-
expect(
|
326
|
-
job =
|
328
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
|
329
|
+
job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
|
327
330
|
@instance.job_post(job)
|
328
|
-
job =
|
331
|
+
job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
|
329
332
|
@instance.job_post(job)
|
330
|
-
expect(
|
331
|
-
|
332
|
-
|
333
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
|
334
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
335
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
333
336
|
# After jobs have already finished
|
334
|
-
expect(
|
337
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
335
338
|
# Parent still waiting
|
336
|
-
expect(
|
339
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
|
337
340
|
# Set limit on parent
|
338
341
|
@instance.set_children_started_put(new_parent_job_response.job_id)
|
339
342
|
# Now parent gets moved to ready
|
340
|
-
expect(
|
341
|
-
expect(
|
342
|
-
|
343
|
-
expect(
|
343
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
344
|
+
expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
|
345
|
+
@allq_tool.get_finish(DEFAULT_TUBE)
|
346
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
|
344
347
|
end
|
345
348
|
end
|
346
349
|
|
@@ -365,10 +368,10 @@ describe 'ActionsApi' do
|
|
365
368
|
# @return [TubeRef]
|
366
369
|
describe 'throttle_post test' do
|
367
370
|
it "should work" do
|
368
|
-
|
369
|
-
expect(
|
371
|
+
@allq_tool.add_job
|
372
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
370
373
|
@instance.job_get(DEFAULT_TUBE)
|
371
|
-
stats_result =
|
374
|
+
stats_result = @allq_tool.get_stats[0]
|
372
375
|
expect(stats_result.action_count > 1).to eq(true)
|
373
376
|
end
|
374
377
|
end
|
@@ -381,8 +384,8 @@ describe 'ActionsApi' do
|
|
381
384
|
# @return [BasicResponse]
|
382
385
|
describe 'touch_put test' do
|
383
386
|
it "should work" do
|
384
|
-
|
385
|
-
expect(
|
387
|
+
@allq_tool.add_job
|
388
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
|
386
389
|
job = @instance.job_get(DEFAULT_TUBE)
|
387
390
|
@instance.touch_put(job.id)
|
388
391
|
end
|
@@ -432,31 +435,31 @@ describe 'ActionsApi' do
|
|
432
435
|
priority: 5,
|
433
436
|
parent_id: nil)
|
434
437
|
@instance.job_post(new_job)
|
435
|
-
expect(
|
438
|
+
expect(@allq_tool.get_ready("alt_tube2")).to eq(2) # OK..it's there
|
436
439
|
reserved_job = @instance.job_get("alt_tube2")
|
437
440
|
|
438
441
|
# Other tube has 1 ready, 1 reserved
|
439
|
-
expect(
|
440
|
-
expect(
|
442
|
+
expect(@allq_tool.get_ready("alt_tube2")).to eq(1)
|
443
|
+
expect(@allq_tool.get_reserved("alt_tube2")).to eq(1)
|
441
444
|
|
442
445
|
# Get 1 into buried, 1 into reserved, and 1 in ready so we can clear it
|
443
|
-
expect(
|
446
|
+
expect(@allq_tool.get_ready(alt_tube_name)).to eq(3) # OK..it's there
|
444
447
|
reserved_job = @instance.job_get(alt_tube_name)
|
445
|
-
expect(
|
448
|
+
expect(@allq_tool.get_reserved(alt_tube_name)).to eq(1) # OK..it's there
|
446
449
|
reserved_job = @instance.job_get(alt_tube_name)
|
447
|
-
expect(
|
450
|
+
expect(@allq_tool.get_reserved(alt_tube_name)).to eq(2) # OK..it's there
|
448
451
|
@instance.bury_put(reserved_job.id)
|
449
|
-
expect(
|
452
|
+
expect(@allq_tool.get_buried(alt_tube_name)).to eq(1)
|
450
453
|
|
451
454
|
# Now check that first tube is empty
|
452
455
|
@instance.tube_delete(alt_tube_name)
|
453
|
-
expect(
|
454
|
-
expect(
|
455
|
-
expect(
|
456
|
+
expect(@allq_tool.get_buried(alt_tube_name)).to eq(0)
|
457
|
+
expect(@allq_tool.get_reserved(alt_tube_name)).to eq(0) # OK..it's there
|
458
|
+
expect(@allq_tool.get_ready(alt_tube_name)).to eq(0)
|
456
459
|
|
457
460
|
# ..and other tubes are fine
|
458
|
-
expect(
|
459
|
-
expect(
|
461
|
+
expect(@allq_tool.get_ready("alt_tube2")).to eq(1)
|
462
|
+
expect(@allq_tool.get_reserved("alt_tube2")).to eq(1)
|
460
463
|
end
|
461
464
|
end
|
462
465
|
|
@@ -471,9 +474,9 @@ describe 'ActionsApi' do
|
|
471
474
|
priority: 5,
|
472
475
|
parent_id: nil)
|
473
476
|
@instance.job_post(new_job)
|
474
|
-
expect(
|
477
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0) # Too soon to show up
|
475
478
|
sleep(4)
|
476
|
-
expect(
|
479
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1) # OK..it's there
|
477
480
|
end
|
478
481
|
end
|
479
482
|
|
@@ -490,18 +493,21 @@ describe 'ActionsApi' do
|
|
490
493
|
@instance.job_post(new_job)
|
491
494
|
sleep(1)
|
492
495
|
@instance.job_get(DEFAULT_TUBE)
|
493
|
-
expect(
|
496
|
+
expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
|
494
497
|
sleep(5)
|
495
|
-
expect(
|
496
|
-
expect(
|
498
|
+
expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(0) # Should expire
|
499
|
+
expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1) # ..and be back in ready
|
497
500
|
end
|
498
501
|
end
|
499
502
|
|
500
503
|
end
|
501
504
|
|
502
505
|
|
503
|
-
|
504
|
-
|
506
|
+
class AllQTools
|
507
|
+
def initialize(action_client, admin_client)
|
508
|
+
@action_client = action_client
|
509
|
+
@admin_client = admin_client
|
510
|
+
end
|
505
511
|
|
506
512
|
def new_job(tube = 'default', body = nil, parent_id = nil)
|
507
513
|
body = (0...8).map { (65 + rand(26)).chr }.join unless body
|
@@ -516,20 +522,20 @@ module AllQTools
|
|
516
522
|
end
|
517
523
|
|
518
524
|
def add_job(tube = DEFAULT_TUBE)
|
519
|
-
client =
|
525
|
+
client = @action_client
|
520
526
|
job = new_job(tube)
|
521
527
|
job = client.job_post(new_job)
|
522
528
|
return job
|
523
529
|
end
|
524
530
|
|
525
531
|
def get_finish(tube)
|
526
|
-
client =
|
532
|
+
client = @action_client
|
527
533
|
job = client.job_get(tube)
|
528
534
|
client.job_delete(job.id)
|
529
535
|
end
|
530
536
|
|
531
537
|
def get_stats
|
532
|
-
client =
|
538
|
+
client = @admin_client
|
533
539
|
client.stats_get
|
534
540
|
end
|
535
541
|
|
@@ -576,5 +582,4 @@ module AllQTools
|
|
576
582
|
end
|
577
583
|
end
|
578
584
|
end
|
579
|
-
end
|
580
585
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allq_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- support@blitline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -70,126 +70,6 @@ dependencies:
|
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '3.6'
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: vcr
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '3.0'
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 3.0.1
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.0'
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 3.0.1
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: webmock
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '1.24'
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 1.24.3
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '1.24'
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: 1.24.3
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: autotest
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '4.4'
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 4.4.6
|
123
|
-
type: :development
|
124
|
-
prerelease: false
|
125
|
-
version_requirements: !ruby/object:Gem::Requirement
|
126
|
-
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '4.4'
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 4.4.6
|
133
|
-
- !ruby/object:Gem::Dependency
|
134
|
-
name: autotest-rails-pure
|
135
|
-
requirement: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - "~>"
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '4.1'
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: 4.1.2
|
143
|
-
type: :development
|
144
|
-
prerelease: false
|
145
|
-
version_requirements: !ruby/object:Gem::Requirement
|
146
|
-
requirements:
|
147
|
-
- - "~>"
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '4.1'
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 4.1.2
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: autotest-growl
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0.2'
|
160
|
-
- - ">="
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: 0.2.16
|
163
|
-
type: :development
|
164
|
-
prerelease: false
|
165
|
-
version_requirements: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: '0.2'
|
170
|
-
- - ">="
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: 0.2.16
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
name: autotest-fsevent
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
176
|
-
requirements:
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '0.2'
|
180
|
-
- - ">="
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version: 0.2.12
|
183
|
-
type: :development
|
184
|
-
prerelease: false
|
185
|
-
version_requirements: !ruby/object:Gem::Requirement
|
186
|
-
requirements:
|
187
|
-
- - "~>"
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0.2'
|
190
|
-
- - ">="
|
191
|
-
- !ruby/object:Gem::Version
|
192
|
-
version: 0.2.12
|
193
73
|
description: Allq API Client
|
194
74
|
email:
|
195
75
|
- support@blitline.com
|
@@ -201,7 +81,8 @@ files:
|
|
201
81
|
- Gemfile.lock
|
202
82
|
- README.md
|
203
83
|
- Rakefile
|
204
|
-
- allq_rest-1.2.
|
84
|
+
- allq_rest-1.2.5.gem
|
85
|
+
- allq_rest-1.2.6.gem
|
205
86
|
- allq_rest.gemspec
|
206
87
|
- deploy.sh
|
207
88
|
- docs/ActionsApi.md
|
@@ -257,7 +138,8 @@ files:
|
|
257
138
|
- spec/models/tube_ref_spec.rb
|
258
139
|
- spec/spec_helper.rb
|
259
140
|
homepage: http://www.blitline.com
|
260
|
-
licenses:
|
141
|
+
licenses:
|
142
|
+
- Apache 2.0
|
261
143
|
metadata: {}
|
262
144
|
post_install_message:
|
263
145
|
rdoc_options: []
|
@@ -274,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
156
|
- !ruby/object:Gem::Version
|
275
157
|
version: '0'
|
276
158
|
requirements: []
|
277
|
-
|
278
|
-
rubygems_version: 2.7.9
|
159
|
+
rubygems_version: 3.0.9
|
279
160
|
signing_key:
|
280
161
|
specification_version: 4
|
281
162
|
summary: Ruby REST client for Allq platform
|
data/allq_rest-1.2.3.gem
DELETED
Binary file
|