hastci 0.1.1 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/hastci/ack_worker.rb +1 -1
- data/lib/hastci/adapters/rspec/runner.rb +10 -19
- data/lib/hastci/api_client.rb +8 -4
- data/lib/hastci/cli.rb +44 -18
- data/lib/hastci/config.rb +1 -1
- data/lib/hastci/session.rb +2 -2
- data/lib/hastci/task_buffer.rb +19 -13
- data/lib/hastci/version.rb +1 -1
- data/spec/pacts/hastci_rspec-hastci_api.json +82 -33
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c539e7bbcfc1e63ae87f60a4802989e13917dfd260c90f5b4ae034790351bfc5
|
|
4
|
+
data.tar.gz: 3246b32dbd057b5435404c37d1938049e96bbcb27643df0a69cb1f07c4b6d2d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fbd3844f3a7791f4ca01a315bce6e999b5431dbe7aeb89e70e897c1ba467664d985943bd50bcd7b71854e4c563624a8fe54001da2f22424371857a71af800c1
|
|
7
|
+
data.tar.gz: 86d5796be2b12d15b5a5b26b9ec57ad8c7862a88cf4d57af663db85164608a49483048eb747c99a4799326d788aa881eed99059c7f3236a24455a077f68f9f32
|
data/lib/hastci/ack_worker.rb
CHANGED
|
@@ -4,7 +4,7 @@ module HastCI
|
|
|
4
4
|
class AckWorker
|
|
5
5
|
DEFAULT_QUEUE_SIZE = 1000
|
|
6
6
|
DEFAULT_FLUSH_TIMEOUT = 10
|
|
7
|
-
EMPTY_QUEUE_POLL_INTERVAL = 0.
|
|
7
|
+
EMPTY_QUEUE_POLL_INTERVAL = 0.5
|
|
8
8
|
SHUTDOWN_TIMEOUT = 10
|
|
9
9
|
|
|
10
10
|
private_constant :DEFAULT_QUEUE_SIZE, :DEFAULT_FLUSH_TIMEOUT, :EMPTY_QUEUE_POLL_INTERVAL,
|
|
@@ -147,27 +147,18 @@ module HastCI
|
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def build_logs(failed_examples)
|
|
150
|
-
|
|
151
|
-
summary: summary_for(failed_examples),
|
|
152
|
-
failures: failed_examples.map { |example| failure_payload(example) }
|
|
153
|
-
}
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def summary_for(failed_examples)
|
|
157
|
-
return "passed" if failed_examples.empty?
|
|
150
|
+
return [] if failed_examples.empty?
|
|
158
151
|
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
failed_examples.map do |example|
|
|
153
|
+
exception = example.exception
|
|
161
154
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
backtrace: Array(exception&.backtrace)
|
|
170
|
-
}
|
|
155
|
+
{
|
|
156
|
+
file: example.metadata[:file_path],
|
|
157
|
+
line: example.metadata[:line_number],
|
|
158
|
+
message: exception&.message,
|
|
159
|
+
backtrace: Array(exception&.backtrace)
|
|
160
|
+
}
|
|
161
|
+
end
|
|
171
162
|
end
|
|
172
163
|
|
|
173
164
|
def ordered_task_names(example_groups)
|
data/lib/hastci/api_client.rb
CHANGED
|
@@ -7,6 +7,8 @@ require "uri"
|
|
|
7
7
|
|
|
8
8
|
module HastCI
|
|
9
9
|
class ApiClient
|
|
10
|
+
OriginalNetHTTP = Net::HTTP
|
|
11
|
+
|
|
10
12
|
DEFAULT_MAX_RETRIES = 5
|
|
11
13
|
DEFAULT_INITIAL_BACKOFF = 0.5
|
|
12
14
|
DEFAULT_MAX_BACKOFF = 30
|
|
@@ -28,11 +30,13 @@ module HastCI
|
|
|
28
30
|
|
|
29
31
|
private_constant :API_PATH_PREFIX, :CONNECTION_DEFAULT, :CONNECTION_HEARTBEAT, :CONNECTION_ACK
|
|
30
32
|
|
|
31
|
-
def initialize(config:, sleeper: Kernel.method(:sleep), max_retries: nil, random: Random.new
|
|
33
|
+
def initialize(config:, sleeper: Kernel.method(:sleep), max_retries: nil, random: Random.new,
|
|
34
|
+
http_class: OriginalNetHTTP)
|
|
32
35
|
@config = config
|
|
33
36
|
@max_retries = max_retries || config.api_max_retries || DEFAULT_MAX_RETRIES
|
|
34
37
|
@sleeper = sleeper
|
|
35
38
|
@random = random
|
|
39
|
+
@http_class = http_class
|
|
36
40
|
|
|
37
41
|
@base_url = URI.parse(config.api_base_url)
|
|
38
42
|
@api_key = config.api_key
|
|
@@ -140,7 +144,7 @@ module HastCI
|
|
|
140
144
|
|
|
141
145
|
def get_json(path, pool: CONNECTION_DEFAULT)
|
|
142
146
|
uri = build_uri(path)
|
|
143
|
-
request =
|
|
147
|
+
request = @http_class::Get.new(uri)
|
|
144
148
|
request["Authorization"] = "Bearer #{@api_key}"
|
|
145
149
|
|
|
146
150
|
execute_request(request, pool: pool)
|
|
@@ -148,7 +152,7 @@ module HastCI
|
|
|
148
152
|
|
|
149
153
|
def post_json(path, body, pool: CONNECTION_DEFAULT)
|
|
150
154
|
uri = build_uri(path)
|
|
151
|
-
request =
|
|
155
|
+
request = @http_class::Post.new(uri)
|
|
152
156
|
request["Content-Type"] = "application/json"
|
|
153
157
|
request["Authorization"] = "Bearer #{@api_key}"
|
|
154
158
|
request.body = JSON.generate(body)
|
|
@@ -226,7 +230,7 @@ module HastCI
|
|
|
226
230
|
end
|
|
227
231
|
|
|
228
232
|
def create_connection
|
|
229
|
-
http =
|
|
233
|
+
http = @http_class.new(@base_url.host, @base_url.port)
|
|
230
234
|
http.use_ssl = @base_url.scheme == "https"
|
|
231
235
|
http.open_timeout = DEFAULT_OPEN_TIMEOUT
|
|
232
236
|
http.read_timeout = DEFAULT_READ_TIMEOUT
|
data/lib/hastci/cli.rb
CHANGED
|
@@ -9,16 +9,22 @@ module HastCI
|
|
|
9
9
|
runner_exit_code = ExitCodes::SUCCESS
|
|
10
10
|
interrupted = false
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
setup_interrupt_handler(session, err) { interrupted = true }
|
|
12
|
+
interrupt_cleanup = nil
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
begin
|
|
15
|
+
cleanup_result = HastCI::Session.run(config: config) do |session|
|
|
16
|
+
interrupt_cleanup = setup_interrupt_handler(session, err) { interrupted = true }
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
session.start!
|
|
19
|
+
|
|
20
|
+
runner_exit_code = if session.stopping?
|
|
21
|
+
ExitCodes::SUCCESS
|
|
22
|
+
else
|
|
23
|
+
runner_block.call(session, argv, err, out)
|
|
24
|
+
end
|
|
21
25
|
end
|
|
26
|
+
ensure
|
|
27
|
+
interrupt_cleanup&.call
|
|
22
28
|
end
|
|
23
29
|
|
|
24
30
|
print_errors(cleanup_result, err: err)
|
|
@@ -80,21 +86,41 @@ module HastCI
|
|
|
80
86
|
private_class_method :configure_logging
|
|
81
87
|
|
|
82
88
|
# :nocov:
|
|
83
|
-
def self.setup_interrupt_handler(session, err, &on_interrupt)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
def self.setup_interrupt_handler(session, err, signal_enqueuer: nil, &on_interrupt)
|
|
90
|
+
signals = Queue.new
|
|
91
|
+
signal_count = 0
|
|
92
|
+
enqueue_signal = signal_enqueuer || lambda do |queue, signal|
|
|
93
|
+
Thread.new { queue << signal }
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
trap("INT") { enqueue_signal.call(signals, "SIGINT") }
|
|
97
|
+
trap("TERM") { enqueue_signal.call(signals, "SIGTERM") }
|
|
98
|
+
|
|
99
|
+
watcher = Thread.new do
|
|
100
|
+
loop do
|
|
101
|
+
signal = signals.pop
|
|
102
|
+
break if signal == :shutdown
|
|
103
|
+
|
|
104
|
+
already_stopping = session.stopping?
|
|
105
|
+
signal_count += 1
|
|
106
|
+
|
|
107
|
+
if already_stopping || signal_count > 1
|
|
108
|
+
err.puts("\nForce quit!")
|
|
109
|
+
exit!(1)
|
|
110
|
+
else
|
|
111
|
+
on_interrupt&.call
|
|
112
|
+
session.request_stop!(:user_interrupt)
|
|
113
|
+
err.puts("\nReceived #{signal} - shutting down after current task...")
|
|
114
|
+
end
|
|
92
115
|
end
|
|
93
116
|
end
|
|
94
117
|
|
|
95
|
-
|
|
96
|
-
|
|
118
|
+
lambda do
|
|
119
|
+
signals << :shutdown
|
|
120
|
+
watcher.join
|
|
121
|
+
end
|
|
97
122
|
end
|
|
123
|
+
|
|
98
124
|
private_class_method :setup_interrupt_handler
|
|
99
125
|
# :nocov:
|
|
100
126
|
end
|
data/lib/hastci/config.rb
CHANGED
data/lib/hastci/session.rb
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module HastCI
|
|
4
4
|
class Session
|
|
5
5
|
DEFAULT_POLL_INTERVAL = 0.5
|
|
6
|
-
DEFAULT_BUFFER_MIN_SIZE =
|
|
7
|
-
DEFAULT_BUFFER_MAX_SIZE =
|
|
6
|
+
DEFAULT_BUFFER_MIN_SIZE = 1
|
|
7
|
+
DEFAULT_BUFFER_MAX_SIZE = 3
|
|
8
8
|
DEFAULT_SEEDING_POLL_INTERVAL = 1.0
|
|
9
9
|
|
|
10
10
|
STOP_REASONS = %i[user_interrupt server_cancelled].freeze
|
data/lib/hastci/task_buffer.rb
CHANGED
|
@@ -54,20 +54,24 @@ module HastCI
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def next_task
|
|
57
|
-
|
|
58
|
-
raise error if error
|
|
59
|
-
|
|
60
|
-
task = @queue.pop
|
|
61
|
-
|
|
62
|
-
if task.nil?
|
|
57
|
+
loop do
|
|
63
58
|
error = @error_collector.first_error
|
|
64
59
|
raise error if error
|
|
65
60
|
|
|
66
|
-
return nil
|
|
67
|
-
|
|
61
|
+
return nil if queue_closed_and_empty?
|
|
62
|
+
|
|
63
|
+
begin
|
|
64
|
+
task = @queue.pop(true)
|
|
65
|
+
rescue ThreadError
|
|
66
|
+
@sleeper.call(@poll_interval)
|
|
67
|
+
next
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return nil if task.nil?
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
signal_prefetch_if_needed
|
|
73
|
+
return task
|
|
74
|
+
end
|
|
71
75
|
end
|
|
72
76
|
|
|
73
77
|
def size
|
|
@@ -84,6 +88,10 @@ module HastCI
|
|
|
84
88
|
|
|
85
89
|
private
|
|
86
90
|
|
|
91
|
+
def queue_closed_and_empty?
|
|
92
|
+
@queue.respond_to?(:closed?) && @queue.closed? && @queue.empty?
|
|
93
|
+
end
|
|
94
|
+
|
|
87
95
|
def signal_prefetch_if_needed
|
|
88
96
|
@mutex.synchronize do
|
|
89
97
|
@prefetch_condition.signal if @queue.size < @min_size
|
|
@@ -117,9 +125,7 @@ module HastCI
|
|
|
117
125
|
|
|
118
126
|
def wait_for_prefetch_signal
|
|
119
127
|
@mutex.synchronize do
|
|
120
|
-
while @running && !@drained && @queue.size >= @min_size
|
|
121
|
-
@prefetch_condition.wait(@mutex, @poll_interval)
|
|
122
|
-
end
|
|
128
|
+
@prefetch_condition.wait(@mutex, @poll_interval) while @running && !@drained && @queue.size >= @min_size
|
|
123
129
|
end
|
|
124
130
|
end
|
|
125
131
|
|
data/lib/hastci/version.rb
CHANGED
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"Content-Type": "application/json"
|
|
40
40
|
},
|
|
41
41
|
"body": {
|
|
42
|
-
"run_id": "
|
|
42
|
+
"run_id": "abc123def456",
|
|
43
43
|
"status": "seeding",
|
|
44
44
|
"role": "seeder"
|
|
45
45
|
},
|
|
46
46
|
"matchingRules": {
|
|
47
47
|
"$.body.run_id": {
|
|
48
48
|
"match": "regex",
|
|
49
|
-
"regex": "^[0-
|
|
49
|
+
"regex": "^[0-9A-Za-z_-]{12}$"
|
|
50
50
|
},
|
|
51
51
|
"$.body.status": {
|
|
52
52
|
"match": "regex",
|
|
@@ -109,14 +109,14 @@
|
|
|
109
109
|
"providerState": "a run exists",
|
|
110
110
|
"request": {
|
|
111
111
|
"method": "get",
|
|
112
|
-
"path": "/api/v1/runs/
|
|
112
|
+
"path": "/api/v1/runs/abc123def456",
|
|
113
113
|
"headers": {
|
|
114
114
|
"Authorization": "Bearer test-api-key"
|
|
115
115
|
},
|
|
116
116
|
"matchingRules": {
|
|
117
117
|
"$.path": {
|
|
118
118
|
"match": "regex",
|
|
119
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
119
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}$"
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
},
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"providerState": "a run exists",
|
|
142
142
|
"request": {
|
|
143
143
|
"method": "post",
|
|
144
|
-
"path": "/api/v1/runs/
|
|
144
|
+
"path": "/api/v1/runs/abc123def456/seed",
|
|
145
145
|
"headers": {
|
|
146
146
|
"Authorization": "Bearer test-api-key",
|
|
147
147
|
"Content-Type": "application/json"
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"matchingRules": {
|
|
160
160
|
"$.path": {
|
|
161
161
|
"match": "regex",
|
|
162
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
162
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}\\/seed$"
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
},
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"providerState": "tasks are available",
|
|
180
180
|
"request": {
|
|
181
181
|
"method": "post",
|
|
182
|
-
"path": "/api/v1/runs/
|
|
182
|
+
"path": "/api/v1/runs/abc123def456/claims",
|
|
183
183
|
"query": "batch=10",
|
|
184
184
|
"headers": {
|
|
185
185
|
"Authorization": "Bearer test-api-key",
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"matchingRules": {
|
|
192
192
|
"$.path": {
|
|
193
193
|
"match": "regex",
|
|
194
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
194
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}\\/claims$"
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
},
|
|
@@ -203,19 +203,19 @@
|
|
|
203
203
|
"body": {
|
|
204
204
|
"tasks": [
|
|
205
205
|
{
|
|
206
|
-
"id":
|
|
206
|
+
"id": 101,
|
|
207
207
|
"name": "spec/models/user_spec.rb"
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
|
-
"id":
|
|
210
|
+
"id": 102,
|
|
211
211
|
"name": "spec/models/post_spec.rb"
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
|
-
"id":
|
|
214
|
+
"id": 103,
|
|
215
215
|
"name": "spec/models/comment_spec.rb"
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
|
-
"id":
|
|
218
|
+
"id": 104,
|
|
219
219
|
"name": "spec/models/profile_spec.rb"
|
|
220
220
|
}
|
|
221
221
|
],
|
|
@@ -228,20 +228,16 @@
|
|
|
228
228
|
},
|
|
229
229
|
"matchingRules": {
|
|
230
230
|
"$.body.tasks[0].id": {
|
|
231
|
-
"match": "
|
|
232
|
-
"regex": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
231
|
+
"match": "type"
|
|
233
232
|
},
|
|
234
233
|
"$.body.tasks[1].id": {
|
|
235
|
-
"match": "
|
|
236
|
-
"regex": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
234
|
+
"match": "type"
|
|
237
235
|
},
|
|
238
236
|
"$.body.tasks[2].id": {
|
|
239
|
-
"match": "
|
|
240
|
-
"regex": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
237
|
+
"match": "type"
|
|
241
238
|
},
|
|
242
239
|
"$.body.tasks[3].id": {
|
|
243
|
-
"match": "
|
|
244
|
-
"regex": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
240
|
+
"match": "type"
|
|
245
241
|
},
|
|
246
242
|
"$.body.remaining.queued": {
|
|
247
243
|
"match": "type"
|
|
@@ -260,7 +256,7 @@
|
|
|
260
256
|
"providerState": "queue is empty but not drained",
|
|
261
257
|
"request": {
|
|
262
258
|
"method": "post",
|
|
263
|
-
"path": "/api/v1/runs/
|
|
259
|
+
"path": "/api/v1/runs/abc123def456/claims",
|
|
264
260
|
"query": "batch=10",
|
|
265
261
|
"headers": {
|
|
266
262
|
"Authorization": "Bearer test-api-key",
|
|
@@ -272,7 +268,7 @@
|
|
|
272
268
|
"matchingRules": {
|
|
273
269
|
"$.path": {
|
|
274
270
|
"match": "regex",
|
|
275
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
271
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}\\/claims$"
|
|
276
272
|
}
|
|
277
273
|
}
|
|
278
274
|
},
|
|
@@ -288,7 +284,7 @@
|
|
|
288
284
|
"providerState": "queue is drained",
|
|
289
285
|
"request": {
|
|
290
286
|
"method": "post",
|
|
291
|
-
"path": "/api/v1/runs/
|
|
287
|
+
"path": "/api/v1/runs/abc123def456/claims",
|
|
292
288
|
"query": "batch=10",
|
|
293
289
|
"headers": {
|
|
294
290
|
"Authorization": "Bearer test-api-key",
|
|
@@ -300,7 +296,7 @@
|
|
|
300
296
|
"matchingRules": {
|
|
301
297
|
"$.path": {
|
|
302
298
|
"match": "regex",
|
|
303
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
299
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}\\/claims$"
|
|
304
300
|
}
|
|
305
301
|
}
|
|
306
302
|
},
|
|
@@ -319,7 +315,7 @@
|
|
|
319
315
|
"providerState": "run is cancelled",
|
|
320
316
|
"request": {
|
|
321
317
|
"method": "post",
|
|
322
|
-
"path": "/api/v1/runs/
|
|
318
|
+
"path": "/api/v1/runs/abc123def456/claims",
|
|
323
319
|
"query": "batch=10",
|
|
324
320
|
"headers": {
|
|
325
321
|
"Authorization": "Bearer test-api-key",
|
|
@@ -331,7 +327,7 @@
|
|
|
331
327
|
"matchingRules": {
|
|
332
328
|
"$.path": {
|
|
333
329
|
"match": "regex",
|
|
334
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
330
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}\\/claims$"
|
|
335
331
|
}
|
|
336
332
|
}
|
|
337
333
|
},
|
|
@@ -369,7 +365,7 @@
|
|
|
369
365
|
"providerState": "a task exists",
|
|
370
366
|
"request": {
|
|
371
367
|
"method": "post",
|
|
372
|
-
"path": "/api/v1/tasks/
|
|
368
|
+
"path": "/api/v1/tasks/101/acknowledgment",
|
|
373
369
|
"headers": {
|
|
374
370
|
"Authorization": "Bearer test-api-key",
|
|
375
371
|
"Content-Type": "application/json"
|
|
@@ -377,16 +373,69 @@
|
|
|
377
373
|
"body": {
|
|
378
374
|
"status": "passed",
|
|
379
375
|
"duration_s": 1.5,
|
|
380
|
-
"logs":
|
|
381
|
-
"summary": "1 example, 0 failures",
|
|
382
|
-
"failures": [
|
|
376
|
+
"logs": [
|
|
383
377
|
]
|
|
378
|
+
},
|
|
379
|
+
"matchingRules": {
|
|
380
|
+
"$.path": {
|
|
381
|
+
"match": "regex",
|
|
382
|
+
"regex": "^\\/api\\/v1\\/tasks\\/\\d+\\/acknowledgment$"
|
|
384
383
|
}
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"response": {
|
|
387
|
+
"status": 200,
|
|
388
|
+
"headers": {
|
|
389
|
+
"Content-Type": "application/json"
|
|
390
|
+
},
|
|
391
|
+
"body": {
|
|
392
|
+
"ok": true
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"description": "a request to ack a task with failures",
|
|
398
|
+
"providerState": "a task exists",
|
|
399
|
+
"request": {
|
|
400
|
+
"method": "post",
|
|
401
|
+
"path": "/api/v1/tasks/101/acknowledgment",
|
|
402
|
+
"headers": {
|
|
403
|
+
"Authorization": "Bearer test-api-key",
|
|
404
|
+
"Content-Type": "application/json"
|
|
405
|
+
},
|
|
406
|
+
"body": {
|
|
407
|
+
"status": "failed",
|
|
408
|
+
"duration_s": 2.0,
|
|
409
|
+
"logs": [
|
|
410
|
+
{
|
|
411
|
+
"file": "spec/models/user_spec.rb",
|
|
412
|
+
"line": 123,
|
|
413
|
+
"message": "Expected 1, got 2",
|
|
414
|
+
"backtrace": [
|
|
415
|
+
"spec/models/user_spec.rb:123:in `block'"
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
]
|
|
385
419
|
},
|
|
386
420
|
"matchingRules": {
|
|
387
421
|
"$.path": {
|
|
388
422
|
"match": "regex",
|
|
389
|
-
"regex": "^\\/api\\/v1\\/tasks
|
|
423
|
+
"regex": "^\\/api\\/v1\\/tasks\\/\\d+\\/acknowledgment$"
|
|
424
|
+
},
|
|
425
|
+
"$.body.logs[0].file": {
|
|
426
|
+
"match": "type"
|
|
427
|
+
},
|
|
428
|
+
"$.body.logs[0].line": {
|
|
429
|
+
"match": "type"
|
|
430
|
+
},
|
|
431
|
+
"$.body.logs[0].message": {
|
|
432
|
+
"match": "type"
|
|
433
|
+
},
|
|
434
|
+
"$.body.logs[0].backtrace": {
|
|
435
|
+
"min": 1
|
|
436
|
+
},
|
|
437
|
+
"$.body.logs[0].backtrace[*].*": {
|
|
438
|
+
"match": "type"
|
|
390
439
|
}
|
|
391
440
|
}
|
|
392
441
|
},
|
|
@@ -405,7 +454,7 @@
|
|
|
405
454
|
"providerState": "a worker exists",
|
|
406
455
|
"request": {
|
|
407
456
|
"method": "post",
|
|
408
|
-
"path": "/api/v1/runs/
|
|
457
|
+
"path": "/api/v1/runs/abc123def456/heartbeats",
|
|
409
458
|
"headers": {
|
|
410
459
|
"Authorization": "Bearer test-api-key",
|
|
411
460
|
"Content-Type": "application/json"
|
|
@@ -416,7 +465,7 @@
|
|
|
416
465
|
"matchingRules": {
|
|
417
466
|
"$.path": {
|
|
418
467
|
"match": "regex",
|
|
419
|
-
"regex": "^\\/api\\/v1\\/runs\\/[0-
|
|
468
|
+
"regex": "^\\/api\\/v1\\/runs\\/[0-9A-Za-z_-]{12}\\/heartbeats$"
|
|
420
469
|
}
|
|
421
470
|
}
|
|
422
471
|
},
|