chaotic_job 0.9.1 → 0.9.2
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/CHANGELOG.md +5 -0
- data/lib/chaotic_job/simulation.rb +8 -2
- data/lib/chaotic_job/version.rb +1 -1
- data/lib/chaotic_job.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 875792232bd76377692ababa2471734fb8ca6770dc86cecbc5dd22ea94d4b570
|
4
|
+
data.tar.gz: df305d86ce6dcb95ccf6960d193dc7cca203b669663ac1e594b463f784d46335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3fcbcab0ed164c21ddf065d6ba14105eeaf8bf2ab6ebeb1c3181e1dec226c19c3c150c8d140b2e78b1dedf8a4f5dbd5b9802a31f390bb7280af902f783e1ef7
|
7
|
+
data.tar.gz: 22874eb33f98fa1329e1bb9eef276c1b1056b9e98636b3ac63b3e9f482e4fae31e68361fd5310d9648bf3977269d9fed1fb212c002e070f253cd69d8472f4d8f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.9.2] - 2025-06-17
|
4
|
+
|
5
|
+
- Allow option to constrain which jobs are performed for a `Simulation` [#16](https://github.com/fractaledmind/chaotic_job/pull/16)
|
6
|
+
- Make the jobs run for a `Simulation` have a distinct `job_id` with glitch details [#15](https://github.com/fractaledmind/chaotic_job/pull/15)
|
7
|
+
|
3
8
|
## [0.9.1] - 2025-06-12
|
4
9
|
|
5
10
|
- The simulation tracer should only capture events on the template job [#14](https://github.com/fractaledmind/chaotic_job/pull/14)
|
@@ -5,13 +5,14 @@
|
|
5
5
|
# Simulation.new(job).scenarios
|
6
6
|
module ChaoticJob
|
7
7
|
class Simulation
|
8
|
-
def initialize(job, callstack: nil, variations: nil, test: nil, seed: nil)
|
8
|
+
def initialize(job, callstack: nil, variations: nil, test: nil, seed: nil, perform_only_jobs_within: nil)
|
9
9
|
@template = job
|
10
10
|
@callstack = callstack || capture_callstack
|
11
11
|
@variations = variations
|
12
12
|
@test = test
|
13
13
|
@seed = seed || Random.new_seed
|
14
14
|
@random = Random.new(@seed)
|
15
|
+
@perform_only_jobs_within = perform_only_jobs_within
|
15
16
|
|
16
17
|
raise Error.new("callstack must be a generated via ChaoticJob::Tracer") unless @callstack.is_a?(Stack)
|
17
18
|
end
|
@@ -41,6 +42,7 @@ module ChaoticJob
|
|
41
42
|
variants.map do |(event, key)|
|
42
43
|
job = clone_job_template
|
43
44
|
glitch = Glitch.public_send(event, key)
|
45
|
+
job.job_id = [job.job_id.split("-").first, glitch.event, glitch.key].join("-")
|
44
46
|
Scenario.new(job, glitch: glitch)
|
45
47
|
end
|
46
48
|
end
|
@@ -63,7 +65,11 @@ module ChaoticJob
|
|
63
65
|
debug "👾 Running simulation with scenario: #{scenario}"
|
64
66
|
@test.before_setup
|
65
67
|
@test.simulation_scenario = scenario
|
66
|
-
|
68
|
+
if @perform_only_jobs_within
|
69
|
+
scenario.run { Performer.perform_all_before(@perform_only_jobs_within) }
|
70
|
+
else
|
71
|
+
scenario.run
|
72
|
+
end
|
67
73
|
@test.after_teardown
|
68
74
|
@test.assert scenario.glitched?, "Scenario did not execute glitch: #{scenario.glitch}"
|
69
75
|
assertions.call(scenario)
|
data/lib/chaotic_job/version.rb
CHANGED
data/lib/chaotic_job.rb
CHANGED
@@ -78,11 +78,12 @@ module ChaoticJob
|
|
78
78
|
Performer.perform_all_after(time)
|
79
79
|
end
|
80
80
|
|
81
|
-
def run_simulation(job, variations: nil, callstack: nil, &block)
|
81
|
+
def run_simulation(job, variations: nil, callstack: nil, perform_only_jobs_within: nil, &block)
|
82
82
|
seed = defined?(RSpec) ? RSpec.configuration.seed : Minitest.seed
|
83
83
|
kwargs = {test: self, seed: seed}
|
84
84
|
kwargs[:variations] = variations if variations
|
85
85
|
kwargs[:callstack] = callstack if callstack
|
86
|
+
kwargs[:perform_only_jobs_within] = perform_only_jobs_within if perform_only_jobs_within
|
86
87
|
self.simulation_scenario = nil
|
87
88
|
Simulation.new(job, **kwargs).run(&block)
|
88
89
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chaotic_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Margheim
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-06-
|
10
|
+
date: 2025-06-17 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activejob
|