Class: Roby::App::TestServer
- Includes:
- Hooks::InstanceHooks, Hooks
- Defined in:
- lib/roby/app/test_server.rb
Overview
DRuby server for a client/server scheme in autotest
The client side is implemented in TestReporter
Note that the idea and a big chunk of the implementation has been taken from the minitest-server plugin. The main differences is that it accounts for load errors (exceptions that happen outside of minitest itself) and is using DRoby’s marshalling for exceptions
Instance Attribute Summary collapse
-
#manager ⇒ Autorespawn::Manager
readonly
The autorespawn manager.
-
#server_id ⇒ Object
readonly
A value that allows to identify this server uniquely.
Class Method Summary collapse
Instance Method Summary collapse
- #discovery_finished(pid) ⇒ Object
- #discovery_start(pid) ⇒ Object
- #exception(pid, e) ⇒ Object
-
#initialize(server_id, manager = DRoby::Marshal.new(auto_create_plans: true)) ⇒ TestServer
constructor
A new instance of TestServer.
-
#on_discovery_finished {|pid, id| ... } ⇒ Object
Hook called when a discovery process finishes.
-
#on_discovery_start {|pid| ... } ⇒ Object
Hook called when a discovery process starts.
-
#on_exception {|pid, exception| ... } ⇒ Object
Hook called when an exception has been caught by Autorespawn.
-
#on_test_finished {|pid| ... } ⇒ Object
Hook called when a test finished.
-
#on_test_method {|pid, file, test_case_name, test_name| ... } ⇒ Object
Hook called when a test method starts its execution.
-
#on_test_result {|pid, file, test_case_name, test_name, failures, assertions, time| ... } ⇒ Object
Hook called when a test has been executed.
-
#on_test_start {|pid| ... } ⇒ Object
Hook called when a test starts.
- #test_finished(pid) ⇒ Object
- #test_method(pid, file, klass, method) ⇒ Object
- #test_result(pid, file, klass, method, fails, assertions, time) ⇒ Object
- #test_start(pid) ⇒ Object
Methods included from Hooks
Constructor Details
#initialize(server_id, manager = DRoby::Marshal.new(auto_create_plans: true)) ⇒ TestServer
Returns a new instance of TestServer.
123 124 125 126 |
# File 'lib/roby/app/test_server.rb', line 123 def initialize(server_id, manager = DRoby::Marshal.new(auto_create_plans: true)) @server_id = server_id @manager = manager end |
Instance Attribute Details
#manager ⇒ Autorespawn::Manager (readonly)
The autorespawn manager
111 112 113 |
# File 'lib/roby/app/test_server.rb', line 111 def manager @manager end |
#server_id ⇒ Object (readonly)
A value that allows to identify this server uniquely
Usually the server PID
106 107 108 |
# File 'lib/roby/app/test_server.rb', line 106 def server_id @server_id end |
Class Method Details
.path(pid = Process.pid) ⇒ Object
36 37 38 |
# File 'lib/roby/app/test_server.rb', line 36 def self.path(pid = Process.pid) "drbunix:#{Dir.tmpdir}/minitest.#{pid}" end |
.start(id) ⇒ Object
113 114 115 116 117 |
# File 'lib/roby/app/test_server.rb', line 113 def self.start(id) server = new(id) DRb.start_service path, server server end |
.stop ⇒ Object
119 120 121 |
# File 'lib/roby/app/test_server.rb', line 119 def self.stop DRb.stop_service end |
Instance Method Details
#discovery_finished(pid) ⇒ Object
132 133 134 |
# File 'lib/roby/app/test_server.rb', line 132 def discovery_finished(pid) run_hook :on_discovery_finished, pid end |
#discovery_start(pid) ⇒ Object
128 129 130 |
# File 'lib/roby/app/test_server.rb', line 128 def discovery_start(pid) run_hook :on_discovery_start, pid end |
#exception(pid, e) ⇒ Object
136 137 138 |
# File 'lib/roby/app/test_server.rb', line 136 def exception(pid, e) run_hook :on_exception, pid, manager.local_object(e) end |
#on_discovery_finished {|pid, id| ... } ⇒ Object
Hook called when a discovery process finishes
64 |
# File 'lib/roby/app/test_server.rb', line 64 define_hooks :on_discovery_finished |
#on_discovery_start {|pid| ... } ⇒ Object
Hook called when a discovery process starts
56 |
# File 'lib/roby/app/test_server.rb', line 56 define_hooks :on_discovery_start |
#on_exception {|pid, exception| ... } ⇒ Object
Hook called when an exception has been caught by Autorespawn
49 |
# File 'lib/roby/app/test_server.rb', line 49 define_hooks :on_exception |
#on_test_finished {|pid| ... } ⇒ Object
Hook called when a test finished
101 |
# File 'lib/roby/app/test_server.rb', line 101 define_hooks :on_test_finished |
#on_test_method {|pid, file, test_case_name, test_name| ... } ⇒ Object
Hook called when a test method starts its execution
81 |
# File 'lib/roby/app/test_server.rb', line 81 define_hooks :on_test_method |
#on_test_result {|pid, file, test_case_name, test_name, failures, assertions, time| ... } ⇒ Object
Hook called when a test has been executed
94 |
# File 'lib/roby/app/test_server.rb', line 94 define_hooks :on_test_result |
#on_test_start {|pid| ... } ⇒ Object
Hook called when a test starts
71 |
# File 'lib/roby/app/test_server.rb', line 71 define_hooks :on_test_start |
#test_finished(pid) ⇒ Object
153 154 155 |
# File 'lib/roby/app/test_server.rb', line 153 def test_finished(pid) run_hook :on_test_finished, pid end |
#test_method(pid, file, klass, method) ⇒ Object
144 145 146 |
# File 'lib/roby/app/test_server.rb', line 144 def test_method(pid, file, klass, method) run_hook :on_test_method, pid, file, klass, method end |
#test_result(pid, file, klass, method, fails, assertions, time) ⇒ Object
148 149 150 151 |
# File 'lib/roby/app/test_server.rb', line 148 def test_result(pid, file, klass, method, fails, assertions, time) run_hook :on_test_result, pid, file, klass, method, manager.local_object(fails), assertions, time end |
#test_start(pid) ⇒ Object
140 141 142 |
# File 'lib/roby/app/test_server.rb', line 140 def test_start(pid) run_hook :on_test_start, pid end |