Class: Evilution::Runner::Canary Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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