Class: Evilution::Runner::Canary

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/runner/canary.rb

Overview

Runs one guaranteed-unobservable synthetic mutation through the configured integration + isolation at session start. The synthetic spec never references the synthetic class, so mutating the class cannot change any test outcome — a healthy pipeline must score the mutation :survived. Any other status means the mutation infrastructure is misreporting, so the run aborts before producing numbers that would all be unreliable. Mirrors the configured –isolation so isolation-specific defects are caught too.

Defined Under Namespace

Classes: Failed

Instance Method Summary collapse

Constructor Details

#initialize(config:, isolator:, integration_class:, hooks: nil) ⇒ Canary

Returns a new instance of Canary.



20
21
22
23
24
25
# File 'lib/evilution/runner/canary.rb', line 20

def initialize(config:, isolator:, integration_class:, hooks: nil)
  @config = config
  @isolator = isolator
  @integration_class = integration_class
  @hooks = hooks
end

Instance Method Details

#callObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/evilution/runner/canary.rb', line 27

def call
  dir = Dir.mktmpdir("evilution-canary")
  class_path = write_target_class(dir)
  spec_path = write_spec(dir)

  result = @isolator.call(
    mutation: build_mutation(class_path),
    test_command: ->(mutation) { build_integration(spec_path).call(mutation) },
    timeout: @config.timeout
  )
  raise Failed, failure_message(result.status) unless result.status == :survived

  nil
ensure
  FileUtils.remove_entry(dir) if dir
end