bitfab 0.64.19 → 0.64.20
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/bitfab/scenarios.rb +17 -2
- data/lib/bitfab/version.rb +1 -1
- 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: 74c6c0ac432a8fb315a5ee0fe520a115f0eb49a69a0dc2fdb3fcc26fa82fb163
|
|
4
|
+
data.tar.gz: 7b7e66e3be766f46b22699a03896d09e25a3201decefeea40010706fb4f66e13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 284fc64fd1f74394e6bbcdcd3403fa0936a2b24769eac35975c29bc1f46dade520a142d4b32ef6ec0a205c9f67b4984b7d17fd318dceeae9a7e0cf5ae14ddc37
|
|
7
|
+
data.tar.gz: 8f977a4b90730b6bdf376d287d057ba7b8624988d8763769db829fdd6b5b15cdd889a684241da842905fc2db855c8710939442bdcbfca4e28cbc1db8da073dd8
|
data/lib/bitfab/scenarios.rb
CHANGED
|
@@ -4,11 +4,25 @@ require "uri"
|
|
|
4
4
|
|
|
5
5
|
module Bitfab
|
|
6
6
|
class Traces
|
|
7
|
+
UNSET = Object.new.freeze
|
|
8
|
+
private_constant :UNSET
|
|
9
|
+
|
|
7
10
|
def get_scenario(trace_id)
|
|
8
11
|
@http_client.get(scenario_path(trace_id))["scenario"]
|
|
9
12
|
end
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
# Updates the scenario built from trace_id and returns the saved hash.
|
|
15
|
+
#
|
|
16
|
+
# name:, description:, trigger:, and data: each replace the saved value whole. Keywords left out are kept.
|
|
17
|
+
# append_data: adds history and missing entries after the saved ones. Pass data: or append_data:, not both.
|
|
18
|
+
#
|
|
19
|
+
# actual_outcome: is what the run actually did in this one example, never what it should have done.
|
|
20
|
+
# Bitfab never fills it in, so only the caller sets it. It takes
|
|
21
|
+
# {"summary" => String, "actions" => [{"name", "details", "result", "failed", "at"}], "source" => Hash or nil}
|
|
22
|
+
# and replaces the saved value whole. Passing nil clears it. Leaving it out keeps it.
|
|
23
|
+
#
|
|
24
|
+
# Raises ArgumentError before any request when nothing is passed, or when data: and append_data: are both passed.
|
|
25
|
+
def save_scenario(trace_id, name: nil, description: nil, trigger: nil, data: nil, append_data: nil, actual_outcome: UNSET)
|
|
12
26
|
if !data.nil? && !append_data.nil?
|
|
13
27
|
raise ArgumentError, "Pass data or append_data, not both: data replaces the saved data whole."
|
|
14
28
|
end
|
|
@@ -19,8 +33,9 @@ module Bitfab
|
|
|
19
33
|
payload["trigger"] = trigger unless trigger.nil?
|
|
20
34
|
payload["data"] = data unless data.nil?
|
|
21
35
|
payload["appendData"] = append_data unless append_data.nil?
|
|
36
|
+
payload["actualOutcome"] = actual_outcome unless actual_outcome.equal?(UNSET)
|
|
22
37
|
if payload.empty?
|
|
23
|
-
raise ArgumentError, "Pass at least one of name, description, trigger, data, or
|
|
38
|
+
raise ArgumentError, "Pass at least one of name, description, trigger, data, append_data, or actual_outcome: there is nothing to save otherwise."
|
|
24
39
|
end
|
|
25
40
|
|
|
26
41
|
@http_client.request(scenario_path(trace_id), payload)["scenario"]
|
data/lib/bitfab/version.rb
CHANGED