Class: Selective::Ruby::Core::Controller
- Inherits:
-
Object
- Object
- Selective::Ruby::Core::Controller
show all
- Includes:
- Helper
- Defined in:
- lib/selective/ruby/core/controller.rb
Constant Summary
collapse
- REQUIRED_CONFIGURATION =
{
"host" => "SELECTIVE_HOST",
"api_key" => "SELECTIVE_API_KEY",
"platform" => "SELECTIVE_PLATFORM",
"run_id" => "SELECTIVE_RUN_ID",
"run_attempt" => "SELECTIVE_RUN_ATTEMPT",
"branch" => "SELECTIVE_BRANCH",
"sha" => "SELECTIVE_SHA",
"git_repo_full_name" => "SELECTIVE_GIT_REPO",
"git_provider" => "SELECTIVE_GIT_PROVIDER"
}.freeze
- @@selective_suppress_reporting =
false
- @@report_at_finish =
{}
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helper
#banner, banner, #print_notice, #print_warning, #puts_indented, #safe_filename, #with_error_handling
Constructor Details
#initialize(runner_class, runner_args, debug: false, log: false) ⇒ Controller
Returns a new instance of Controller.
25
26
27
28
29
30
31
|
# File 'lib/selective/ruby/core/controller.rb', line 25
def initialize(runner_class, runner_args, debug: false, log: false)
@debug = debug
@runner = runner_class.new(runner_args, method(:test_case_callback))
@retries = 0
@runner_id = safe_filename(get_runner_id)
@logger = init_logger(log)
end
|
Class Method Details
.report_at_finish ⇒ Object
64
65
66
|
# File 'lib/selective/ruby/core/controller.rb', line 64
def self.report_at_finish
@@report_at_finish
end
|
.restore_reporting! ⇒ Object
56
57
58
|
# File 'lib/selective/ruby/core/controller.rb', line 56
def self.restore_reporting!
@@selective_suppress_reporting = false
end
|
.suppress_reporting! ⇒ Object
52
53
54
|
# File 'lib/selective/ruby/core/controller.rb', line 52
def self.suppress_reporting!
@@selective_suppress_reporting = true
end
|
.suppress_reporting? ⇒ Boolean
60
61
62
|
# File 'lib/selective/ruby/core/controller.rb', line 60
def self.suppress_reporting?
@@selective_suppress_reporting
end
|
Instance Method Details
#exec ⇒ Object
46
47
48
49
50
|
# File 'lib/selective/ruby/core/controller.rb', line 46
def exec
runner.exec
rescue => e
with_error_handling(include_header: false) { raise e }
end
|
#start(reconnect: false) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/selective/ruby/core/controller.rb', line 33
def start(reconnect: false)
@pipe = NamedPipe.new("/tmp/#{runner_id}_2", "/tmp/#{runner_id}_1")
@transport_pid = spawn_transport_process(reconnect: reconnect)
handle_termination_signals(transport_pid)
wait_for_connectivity
run_main_loop
rescue ConnectionLostError
retry!
rescue => e
with_error_handling { raise e }
end
|