Class: Roby::App::TestServer
- Includes:
- Hooks, Hooks::InstanceHooks
- 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.
125 126 127 128 |
# File 'lib/roby/app/test_server.rb', line 125 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
113 114 115 |
# File 'lib/roby/app/test_server.rb', line 113 def manager @manager end |
#server_id ⇒ Object (readonly)
A value that allows to identify this server uniquely
Usually the server PID
108 109 110 |
# File 'lib/roby/app/test_server.rb', line 108 def server_id @server_id end |
Class Method Details
.path(pid = Process.pid) ⇒ Object
38 39 40 |
# File 'lib/roby/app/test_server.rb', line 38 def self.path(pid = Process.pid) "drbunix:#{Dir.tmpdir}/minitest.#{pid}" end |
.start(id) ⇒ Object
115 116 117 118 119 |
# File 'lib/roby/app/test_server.rb', line 115 def self.start(id) server = new(id) DRb.start_service path, server server end |
.stop ⇒ Object
121 122 123 |
# File 'lib/roby/app/test_server.rb', line 121 def self.stop DRb.stop_service end |
Instance Method Details
#discovery_finished(pid) ⇒ Object
134 135 136 |
# File 'lib/roby/app/test_server.rb', line 134 def discovery_finished(pid) run_hook :on_discovery_finished, pid end |
#discovery_start(pid) ⇒ Object
130 131 132 |
# File 'lib/roby/app/test_server.rb', line 130 def discovery_start(pid) run_hook :on_discovery_start, pid end |
#exception(pid, e) ⇒ Object
138 139 140 |
# File 'lib/roby/app/test_server.rb', line 138 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
66 |
# File 'lib/roby/app/test_server.rb', line 66 define_hooks :on_discovery_finished |
#on_discovery_start {|pid| ... } ⇒ Object
Hook called when a discovery process starts
58 |
# File 'lib/roby/app/test_server.rb', line 58 define_hooks :on_discovery_start |
#on_exception {|pid, exception| ... } ⇒ Object
Hook called when an exception has been caught by Autorespawn
51 |
# File 'lib/roby/app/test_server.rb', line 51 define_hooks :on_exception |
#on_test_finished {|pid| ... } ⇒ Object
Hook called when a test finished
103 |
# File 'lib/roby/app/test_server.rb', line 103 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
83 |
# File 'lib/roby/app/test_server.rb', line 83 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
96 |
# File 'lib/roby/app/test_server.rb', line 96 define_hooks :on_test_result |
#on_test_start {|pid| ... } ⇒ Object
Hook called when a test starts
73 |
# File 'lib/roby/app/test_server.rb', line 73 define_hooks :on_test_start |
#test_finished(pid) ⇒ Object
155 156 157 |
# File 'lib/roby/app/test_server.rb', line 155 def test_finished(pid) run_hook :on_test_finished, pid end |
#test_method(pid, file, klass, method) ⇒ Object
146 147 148 |
# File 'lib/roby/app/test_server.rb', line 146 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
150 151 152 153 |
# File 'lib/roby/app/test_server.rb', line 150 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
142 143 144 |
# File 'lib/roby/app/test_server.rb', line 142 def test_start(pid) run_hook :on_test_start, pid end |