Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

rename worker to agent

  • Loading branch information...
commit 578b22033d417548d752f91696695156f1162804 1 parent 892999f
David Vollbracht authored June 27, 2009

Showing 37 changed files with 208 additions and 210 deletions. Show diff stats Hide diff stats

  1. 42  README.rdoc
  2. 2  TODO
  3. 2  lib/deep_test.rb
  4. 4  lib/deep_test/{worker.rb → agent.rb}
  5. 20  lib/deep_test/database/mysql_setup_listener.rb
  6. 44  lib/deep_test/database/setup_listener.rb
  7. 2  lib/deep_test/distributed/null_work_unit.rb
  8. 4  lib/deep_test/distributed/test_server_workers.rb
  9. 26  lib/deep_test/local_deployment.rb
  10. 6  lib/deep_test/main.rb
  11. 26  lib/deep_test/null_listener.rb
  12. 8  lib/deep_test/options.rb
  13. 2  lib/deep_test/rake_tasks.rb
  14. 2  lib/deep_test/result_reader.rb
  15. 8  lib/deep_test/ui/console.rb
  16. 8  ...s_project/lib/{foreign_host_worker_simulation_listener.rb → foreign_host_agent_simulation_listener.rb}
  17. 12  sample_rails_project/lib/tasks/deep_test.rake
  18. 20  spec/deep_test/options_spec.rb
  19. 4  spec/deep_test/spec/extensions/spec_task_spec.rb
  20. 22  spec/deep_test/spec/runner_spec.rb
  21. 2  spec/spec_helper.rb
  22. 2  spec/{thread_worker.rb → thread_agent.rb}
  23. 36  test/deep_test/{worker_test.rb → agent_test.rb}
  24. 8  test/deep_test/distributed/beachhead_test.rb
  25. 2  test/deep_test/distributed/landing_fleet_test.rb
  26. 2  test/deep_test/distributed/multi_test_server_proxy_test.rb
  27. 6  test/deep_test/distributed/remote_deployment_test.rb
  28. 14  test/deep_test/distributed/test_server_workers_test.rb
  29. 12  test/deep_test/distributed/throughput_runner_test.rb
  30. 4  test/deep_test/distributed/throughput_worker_client_test.rb
  31. 12  test/deep_test/listener_list_test.rb
  32. 18  test/deep_test/local_deployment_test.rb
  33. 10  test/deep_test/result_reader_test.rb
  34. 12  test/deep_test/test/supervised_test_suite_test.rb
  35. 2  test/failing.rake
  36. 2  test/test_helper.rb
  37. 10  test/test_task_test.rb
42  README.rdoc
Source Rendered
@@ -15,7 +15,7 @@ In your Rakefile:
15 15
   # sample DeepTest task
16 16
 
17 17
   DeepTest::TestTask.new "task_name" do |t|
18  
-    t.number_of_workers = 2   # optional, defaults to 2
  18
+    t.number_of_agents = 2   # optional, defaults to 2
19 19
     t.timeout_in_seconds = 30 # optional, defaults to 30
20 20
     t.server_port = 6969      # optional, defaults to 6969
21 21
     t.pattern = "test/**/*_test.rb"
@@ -26,7 +26,7 @@ In your Rakefile:
26 26
 
27 27
   Spec::Rake::SpecTask.new(:deep_spec) do |t|
28 28
     t.spec_files = FileList['spec/**/*_spec.rb']
29  
-    t.deep_test :number_of_workers => 2,   # optional, defaults to 2
  29
+    t.deep_test :number_of_agents => 2,   # optional, defaults to 2
30 30
                 :timeout_in_seconds => 30, # optional, defaults to 30
31 31
                 :server_port => 6969       # optional, defaults to 6969
32 32
   end
@@ -39,16 +39,16 @@ In my_listener.rb
39 39
     def before_sync
40 40
     end
41 41
 
42  
-    def before_starting_workers
  42
+    def before_starting_agents
43 43
     end
44 44
 
45  
-    def starting(worker)
  45
+    def starting(agent)
46 46
     end
47 47
 
48  
-    def starting_work(worker, work_unit)
  48
+    def starting_work(agent, work_unit)
49 49
     end
50 50
 
51  
-    def finished_work(worker, work_unit, result)
  51
+    def finished_work(agent, work_unit, result)
52 52
     end
53 53
   end
54 54
 
@@ -59,8 +59,8 @@ In your Rakefile
59 59
     t.listener = "MyListener"
60 60
   end
61 61
 
62  
-An instance of MyListener will be created for each worker that is
63  
-started, and will receive events from that worker.  However, you must ensure
  62
+An instance of MyListener will be created for each agent that is
  63
+started, and will receive events from that agent.  However, you must ensure
64 64
 that the MyListener class is loaded at the time that the test files are
65 65
 loaded, so it is available to be instantiated.  You can specify multiple
66 66
 listener classes by separating them with a comma.  For more information about
@@ -68,12 +68,12 @@ when events are triggered, see the documentation at
68 68
 DeepTest::NullListener.
69 69
 
70 70
 
71  
-=== Setting Up A New Database For Each Worker
  71
+=== Setting Up A New Database For Each Agent
72 72
 
73 73
 By default, DeepTest will reinitialize ActiveRecord connections if ActiveRecord
74  
-is loaded when the workers are started.  This means all workers are running
75  
-against the same database.  You may want each worker to use a database
76  
-decidicated to it.  To facilitate this, DeepTest provides a worker listener to
  74
+is loaded when the agents are started.  This means all agents are running
  75
+against the same database.  You may want each agent to use a database
  76
+decidicated to it.  To facilitate this, DeepTest provides a agent listener to
77 77
 help you.  If you're using Rails with Mysql, simply configure DeepTest as 
78 78
 follows in your Rakefile:
79 79
 
@@ -83,10 +83,10 @@ follows in your Rakefile:
83 83
   end
84 84
 
85 85
 
86  
-Before spawning workers, DeepTest will dump the schema of the database for the
87  
-current Rails environment (usually test).  As each worker starts up, the
88  
-listener will create a database dedicated to that worker and load the schema
89  
-into it.  The database will be dropped when the worker process exits.  
  86
+Before spawning agents, DeepTest will dump the schema of the database for the
  87
+current Rails environment (usually test).  As each agent starts up, the
  88
+listener will create a database dedicated to that agent and load the schema
  89
+into it.  The database will be dropped when the agent process exits.  
90 90
 
91 91
 If you're using Mysql but not using Rails, you'll have to create a subclass of
92 92
 MysqlSetupListener and override +master_database_config+ and +dump_file_name+,
@@ -103,7 +103,7 @@ project so that it can be included in later releases of DeepTest.
103 103
 In addition to running your tests in parallel, DeepTest can also distribute
104 104
 them across multiple machines.  It does this by first mirroring the local
105 105
 working copy that launched the tests on each machine that will be running tests.
106  
-Then workers are launched on each of the machines and consume tests in the same
  106
+Then agents are launched on each of the machines and consume tests in the same
107 107
 fashion as when DeepTest is running locally.
108 108
 
109 109
 ==== Requirements
@@ -125,9 +125,9 @@ machine.
125 125
 On each test machine, execute the following:
126 126
   > deep_test test_server
127 127
 
128  
-This will launch a server providing mirroring and worker services.  By default,
129  
-2 workers will be launched for each set of tests run.  If you wish to change
130  
-the number of workers, simply specify the --number_of_workers option.  For
  128
+This will launch a server providing mirroring and agent services.  By default,
  129
+2 agents will be launched for each set of tests run.  If you wish to change
  130
+the number of agents, simply specify the --number_of_agents option.  For
131 131
 information about what options are available, use -h.  The test_server will
132 132
 print out the uri it is bound to, druby://<hostname>:4022 by default.
133 133
 
@@ -210,7 +210,7 @@ least have something like this:
210 210
 That way you can avoid spending any time mirroring tmp and log files that don't
211 211
 have any effect on the tests.  If you are running distributed tests against a
212 212
 database, consult the section above about creating a new database for each
213  
-worker to see how to configure DeepTest for your project.  
  213
+agent to see how to configure DeepTest for your project.  
214 214
 
215 215
 Any number of projects can be run using the same test servers, as long as
216 216
 they're all using the same version of Ruby and DeepTest.  
2  TODO
... ...
@@ -1,4 +1,4 @@
1  
-* Graceful handling if workers fail to start.
  1
+* Graceful handling if agents fail to start.
2 2
 * test loader
3 3
 * Log central_command write error
4 4
 * Handle not getting all results make more gracefully
2  lib/deep_test.rb
@@ -74,7 +74,7 @@ def backtrace
74 74
 require File.dirname(__FILE__) + "/deep_test/rspec_detector"
75 75
 require File.dirname(__FILE__) + "/deep_test/central_command"
76 76
 require File.dirname(__FILE__) + "/deep_test/test_task"
77  
-require File.dirname(__FILE__) + "/deep_test/worker"
  77
+require File.dirname(__FILE__) + "/deep_test/agent"
78 78
 require File.dirname(__FILE__) + "/deep_test/warlock"
79 79
 
80 80
 require File.dirname(__FILE__) + "/deep_test/database/setup_listener"
4  lib/deep_test/worker.rb → lib/deep_test/agent.rb
... ...
@@ -1,5 +1,5 @@
1 1
 module DeepTest
2  
-  class Worker
  2
+  class Agent
3 3
     attr_reader :number
4 4
 
5 5
     def initialize(number, central_command, listener)
@@ -27,7 +27,7 @@ def run
27 27
         end
28 28
       end
29 29
     rescue CentralCommand::NoWorkUnitsRemainingError
30  
-      DeepTest.logger.debug { "Worker #{number}: no more work to do" }
  30
+      DeepTest.logger.debug { "Agent #{number}: no more work to do" }
31 31
     end
32 32
 
33 33
     def next_work_unit
20  lib/deep_test/database/mysql_setup_listener.rb
@@ -26,25 +26,25 @@ class <<self
26 26
       #
27 27
       def create_database
28 28
         admin_connection do |connection|
29  
-          connection.create_database worker_database
  29
+          connection.create_database agent_database
30 30
           grant_privileges connection
31 31
         end
32 32
       end
33 33
 
34 34
       #
35  
-      # Grants 'all' privilege on worker database to username and password
36  
-      # specified by worker database config.  If your application has
  35
+      # Grants 'all' privilege on agent database to username and password
  36
+      # specified by agent database config.  If your application has
37 37
       # special database privilege needs beyond 'all', you should override
38 38
       # this method and grant them.
39 39
       #
40 40
       def grant_privileges(connection)
41  
-        identified_by = if worker_database_config[:password]
42  
-                          %{identified by %s} % connection.quote(worker_database_config[:password])
  41
+        identified_by = if agent_database_config[:password]
  42
+                          %{identified by %s} % connection.quote(agent_database_config[:password])
43 43
                         else
44 44
                           ""
45 45
                         end
46  
-        sql = %{grant all on #{worker_database}.* to %s@'localhost' #{identified_by} ; } % 
47  
-          connection.quote(worker_database_config[:username])
  46
+        sql = %{grant all on #{agent_database}.* to %s@'localhost' #{identified_by} ; } % 
  47
+          connection.quote(agent_database_config[:username])
48 48
 
49 49
         connection.execute sql
50 50
       end
@@ -54,7 +54,7 @@ def grant_privileges(connection)
54 54
       #
55 55
       def drop_database
56 56
         admin_connection do |connection|
57  
-          connection.drop_database worker_database
  57
+          connection.drop_database agent_database
58 58
         end
59 59
       end
60 60
 
@@ -68,10 +68,10 @@ def dump_schema
68 68
       end
69 69
 
70 70
       #
71  
-      # Loads dumpfile into worker database using mysql command
  71
+      # Loads dumpfile into agent database using mysql command
72 72
       #
73 73
       def load_schema
74  
-        config = command_line_config(worker_database_config)
  74
+        config = command_line_config(agent_database_config)
75 75
         system "mysql #{config} < #{dump_file_name}"
76 76
         raise "Error Loading schema" unless $?.success?
77 77
       end
44  lib/deep_test/database/setup_listener.rb
@@ -2,7 +2,7 @@ module DeepTest
2 2
   module Database
3 3
     #
4 4
     # Skeleton Listener to help with setting up a separate database
5  
-    # for each worker.  Calls +dump_schema+, +load_schema+, +create_database+,
  5
+    # for each agent.  Calls +dump_schema+, +load_schema+, +create_database+,
6 6
     # and +drop_database+ hooks provided by subclasses that implement database
7 7
     # setup strategies for particular database flavors.
8 8
     #
@@ -13,7 +13,7 @@ def before_sync # :nodoc:
13 13
         dump_schema_once
14 14
       end
15 15
 
16  
-      def before_starting_workers # :nodoc:
  16
+      def before_starting_agents # :nodoc:
17 17
         dump_schema_once
18 18
       end
19 19
 
@@ -23,11 +23,11 @@ def dump_schema_once # :nodoc:
23 23
         DUMPED_SCHEMAS << schema_name
24 24
       end
25 25
 
26  
-      def starting(worker) # :nodoc:
27  
-        @worker = worker
  26
+      def starting(agent) # :nodoc:
  27
+        @agent = agent
28 28
 
29 29
         at_exit do
30  
-          DeepTest.logger.debug { "dropping database #{worker_database}" }
  30
+          DeepTest.logger.debug { "dropping database #{agent_database}" }
31 31
           drop_database
32 32
         end
33 33
 
@@ -38,26 +38,26 @@ def starting(worker) # :nodoc:
38 38
       end
39 39
 
40 40
       #
41  
-      # Called on each worker after creating database and before loading
  41
+      # Called on each agent after creating database and before loading
42 42
       # schema to initialize connections
43 43
       # 
44 44
       def connect_to_database
45  
-        ActiveRecord::Base.establish_connection(worker_database_config)
  45
+        ActiveRecord::Base.establish_connection(agent_database_config)
46 46
       end
47 47
 
48 48
       #
49  
-      # Called in each worker to create the database named by 
50  
-      # +worker_database+.
  49
+      # Called in each agent to create the database named by 
  50
+      # +agent_database+.
51 51
       #
52 52
       def create_database
53 53
         raise "Subclass must implement"
54 54
       end
55 55
 
56 56
       #
57  
-      # Called in each worker to drop the database created by
  57
+      # Called in each agent to drop the database created by
58 58
       # +create_database+.  This method is called twice, once before
59 59
       # +create_database+ to ensure that no database exists and once
60  
-      # at exit to clean as the worker process exits.  This method
  60
+      # at exit to clean as the agent process exits.  This method
61 61
       # must not fail if the database does not exist when it is called.
62 62
       #
63 63
       def drop_database
@@ -65,12 +65,12 @@ def drop_database
65 65
       end
66 66
 
67 67
       #
68  
-      # Called before any workers are spawned to dump the schema that
  68
+      # Called before any agents are spawned to dump the schema that
69 69
       # will be used for testing.  When running distributed, this method
70 70
       # is called on the local machine providing the tests to run.
71 71
       #
72 72
       # For distributed testing to work, the schema must be dumped in
73  
-      # location accessible by all worker machines.  The easiest way to
  73
+      # location accessible by all agent machines.  The easiest way to
74 74
       # accomplish this is to dump it to a location within the working copy.
75 75
       #
76 76
       def dump_schema
@@ -79,21 +79,21 @@ def dump_schema
79 79
 
80 80
 
81 81
       #
82  
-      # Called once in each worker as it is starting to load the schema
  82
+      # Called once in each agent as it is starting to load the schema
83 83
       # dumped from dump_schema.  Subclasses should load the schema definition
84  
-      # into the +worker_database+
  84
+      # into the +agent_database+
85 85
       #
86 86
       def load_schema
87 87
         raise "Subclass must implement"
88 88
       end
89 89
 
90 90
       #
91  
-      # ActiveRecord configuration for the worker database.  By default,
  91
+      # ActiveRecord configuration for the agent database.  By default,
92 92
       # the same as +master_database_config+, except that points to
93  
-      # +worker_database+ instead of the database named in the master config.
  93
+      # +agent_database+ instead of the database named in the master config.
94 94
       # 
95  
-      def worker_database_config
96  
-        master_database_config.merge(:database => worker_database)
  95
+      def agent_database_config
  96
+        master_database_config.merge(:database => agent_database)
97 97
       end
98 98
 
99 99
       #
@@ -106,10 +106,10 @@ def master_database_config
106 106
       end
107 107
 
108 108
       #
109  
-      # Unique name for database on machine that worker is running on.
  109
+      # Unique name for database on machine that agent is running on.
110 110
       #
111  
-      def worker_database
112  
-        "deep_test_worker_#{@worker.number}_pid_#{Process.pid}" 
  111
+      def agent_database
  112
+        "deep_test_agent_#{@agent.number}_pid_#{Process.pid}" 
113 113
       end
114 114
     end
115 115
   end
2  lib/deep_test/distributed/null_work_unit.rb
... ...
@@ -1,7 +1,7 @@
1 1
 module DeepTest
2 2
   module Distributed
3 3
     #
4  
-    # Work Unit used to measure throughput of workers.
  4
+    # Work Unit used to measure throughput of agents.
5 5
     #
6 6
     class NullWorkUnit
7 7
       def run
4  lib/deep_test/distributed/test_server_workers.rb
@@ -7,8 +7,8 @@ def initialize(options, test_server_config, connection_info)
7 7
         @connection_info = connection_info
8 8
       end
9 9
       
10  
-      def number_of_workers
11  
-        @test_server_config[:number_of_workers]
  10
+      def number_of_agents
  11
+        @test_server_config[:number_of_agents]
12 12
       end
13 13
 
14 14
       def central_command
26  lib/deep_test/local_deployment.rb
... ...
@@ -1,9 +1,9 @@
1 1
 module DeepTest
2 2
   class LocalDeployment
3  
-    def initialize(options, worker_class = DeepTest::Worker)
  3
+    def initialize(options, agent_class = DeepTest::Agent)
4 4
       @options = options
5 5
       @warlock = Warlock.new
6  
-      @worker_class = worker_class
  6
+      @agent_class = agent_class
7 7
     end
8 8
 
9 9
     def load_files(files)
@@ -15,15 +15,13 @@ def central_command
15 15
     end
16 16
 
17 17
     def start_all
18  
-      each_worker do |worker_num|
19  
-        start_worker(worker_num) do
  18
+      each_agent do |agent_num|
  19
+        start_agent(agent_num) do
20 20
           ProxyIO.replace_stdout_stderr!(central_command.stdout, central_command.stderr) do
21 21
             reseed_random_numbers
22 22
             reconnect_to_database
23  
-            worker = @worker_class.new(worker_num,
24  
-                                      central_command, 
25  
-                                      @options.new_listener_list)
26  
-            worker.run
  23
+            agent = @agent_class.new(agent_num, central_command, @options.new_listener_list)
  24
+            agent.run
27 25
           end
28 26
         end
29 27
       end        
@@ -37,8 +35,8 @@ def wait_for_completion
37 35
       @warlock.wait_for_all_to_finish
38 36
     end
39 37
 
40  
-    def number_of_workers
41  
-      @options.number_of_workers
  38
+    def number_of_agents
  39
+      @options.number_of_agents
42 40
     end
43 41
 
44 42
     private
@@ -47,16 +45,16 @@ def reconnect_to_database
47 45
       ActiveRecord::Base.connection.reconnect! if defined?(ActiveRecord::Base)
48 46
     end
49 47
 
50  
-    def start_worker(worker_num, &blk)
51  
-      @warlock.start("worker #{worker_num}", &blk)
  48
+    def start_agent(agent_num, &blk)
  49
+      @warlock.start("agent #{agent_num}", &blk)
52 50
     end
53 51
 
54 52
     def reseed_random_numbers
55 53
       srand
56 54
     end
57 55
 
58  
-    def each_worker
59  
-      number_of_workers.to_i.times { |worker_num| yield worker_num }
  56
+    def each_agent
  57
+      number_of_agents.to_i.times { |agent_num| yield agent_num }
60 58
     end
61 59
   end
62 60
 end
6  lib/deep_test/main.rb
@@ -15,7 +15,7 @@ def run(exit_when_done = true)
15 15
 
16 16
       begin
17 17
         central_command = CentralCommand.start(@options)
18  
-        @options.new_listener_list.before_starting_workers
  18
+        @options.new_listener_list.before_starting_agents
19 19
         @deployment.start_all
20 20
         begin
21 21
           DeepTest.logger.debug { "Loader Starting (#{$$})" }
@@ -37,10 +37,10 @@ def shutdown(central_command)
37 37
 
38 38
       first_exception = $!
39 39
       begin
40  
-        DeepTest.logger.debug { "Main: Stopping Workers" }
  40
+        DeepTest.logger.debug { "Main: Stopping Agents" }
41 41
         @deployment.stop_all
42 42
       rescue DRb::DRbConnError
43  
-        # Workers must have already stopped
  43
+        # Agents must have already stopped
44 44
       rescue Exception => e
45 45
         raise first_exception || e
46 46
       end
26  lib/deep_test/null_listener.rb
@@ -12,51 +12,51 @@ def before_sync
12 12
     end
13 13
 
14 14
     #
15  
-    # Before DeepTest starts any workers, it instantiates a listener and
  15
+    # Before DeepTest starts any agents, it instantiates a listener and
16 16
     # invokes this method.  No other callbacks are made to the listener
17 17
     # instance receiving this message. 
18 18
     #
19  
-    def before_starting_workers
  19
+    def before_starting_agents
20 20
     end
21 21
 
22 22
     #
23  
-    # A separate listener instance is created in each worker process and
24  
-    # notified that the worker is starting.  The worker for the process is
25  
-    # provided for the listener to use.  If you are using 3 workers, this
  23
+    # A separate listener instance is created in each agent process and
  24
+    # notified that the agent is starting.  The agent for the process is
  25
+    # provided for the listener to use.  If you are using 3 agents, this
26 26
     # method is invoked 3 times on 3 distinct instances.  These instances
27 27
     # will also receive the starting_work and finished_work callbacks for
28  
-    # the worker provided.
  28
+    # the agent provided.
29 29
     #
30  
-    def starting(worker)
  30
+    def starting(agent)
31 31
     end
32 32
 
33 33
     #
34  
-    # Each time a worker takes a work unit, it calls this method before
  34
+    # Each time a agent takes a work unit, it calls this method before
35 35
     # doing the work.  In total, this method will be called as many times
36 36
     # as there are work units.  The listener instance that received the
37  
-    # starting callback with the worker provided here is the same instance
  37
+    # starting callback with the agent provided here is the same instance
38 38
     # that receives this message.
39 39
     #
40 40
     # Because each work processes work units in a serial fashion, the
41 41
     # listener will receive a finished_work message before another
42 42
     # starting_work message.
43 43
     #
44  
-    def starting_work(worker, work_unit)
  44
+    def starting_work(agent, work_unit)
45 45
     end
46 46
 
47 47
     #
48  
-    # Each time a worker finishes computing a result for a work unit, 
  48
+    # Each time a agent finishes computing a result for a work unit, 
49 49
     # it calls this method before sending that result back to the server.
50 50
     # In total, this method will be called as many times
51 51
     # as there are work units.  The listener instance that received the
52  
-    # starting callback with the worker provided here is the same instance
  52
+    # starting callback with the agent provided here is the same instance
53 53
     # that receives this message.
54 54
     #
55 55
     # Because each work processes work units in a serial fashion, the
56 56
     # listener will receive a starting_work message before another
57 57
     # finished_work message.
58 58
     #
59  
-    def finished_work(worker, work_unit, result)
  59
+    def finished_work(agent, work_unit, result)
60 60
     end
61 61
   end
62 62
 end
8  lib/deep_test/options.rb
@@ -5,7 +5,7 @@ class Options
5 5
     unless defined?(VALID_OPTIONS)
6 6
       VALID_OPTIONS = [
7 7
         Option.new(:distributed_hosts, nil),
8  
-        Option.new(:number_of_workers, nil),
  8
+        Option.new(:number_of_agents,   nil),
9 9
         Option.new(:metrics_file,      nil),
10 10
         Option.new(:pattern,           nil),
11 11
         Option.new(:server_port,       6969),
@@ -18,9 +18,9 @@ class Options
18 18
 
19 19
     attr_accessor *VALID_OPTIONS.map {|o| o.name}
20 20
 
21  
-    def number_of_workers
22  
-      return CpuInfo.new.count unless @number_of_workers
23  
-      @number_of_workers
  21
+    def number_of_agents
  22
+      return CpuInfo.new.count unless @number_of_agents
  23
+      @number_of_agents
24 24
     end
25 25
 
26 26
     def ui=(value)
2  lib/deep_test/rake_tasks.rb
@@ -23,7 +23,7 @@
23 23
     options.mirror_path('/tmp'),
24 24
     DeepTest::Distributed::TestServerWorkers.new(
25 25
       options, 
26  
-      {:number_of_workers => options.number_of_workers}, 
  26
+      {:number_of_agents => options.number_of_agents}, 
27 27
       DeepTest::Distributed::SshClientConnectionInfo.new
28 28
     )
29 29
   ) do
2  lib/deep_test/result_reader.rb
@@ -14,7 +14,7 @@ def read(original_work_units_by_id)
14 14
           result = @central_command.take_result
15 15
           next if result.nil?
16 16
 
17  
-          if Worker::Error === result
  17
+          if Agent::Error === result
18 18
             puts result
19 19
             errors += 1
20 20
           else
8  lib/deep_test/ui/console.rb
@@ -5,11 +5,11 @@ def initialize(options)
5 5
       end
6 6
 
7 7
       METHOD_DESCRIPTIONS = {
8  
-        :push_code => "Synchronizing working copies on worker machines",
  8
+        :push_code => "Synchronizing working copies on distributed machines",
9 9
         :establish_beachhead => "Spawning test environment processes",
10  
-        :load_files => "Loading test files for workers",
11  
-        :start_all => "Starting workers",
12  
-        :stop_all => "Stopping workers"
  10
+        :load_files => "Loading test files for agents",
  11
+        :start_all => "Starting agents",
  12
+        :stop_all => "Stopping agents"
13 13
       } unless defined?(METHOD_DESCRIPTIONS)
14 14
 
15 15
       def distributed_failover_to_local(method, exception)
8  ...ct/lib/foreign_host_worker_simulation_listener.rb → ...ect/lib/foreign_host_agent_simulation_listener.rb
... ...
@@ -1,13 +1,13 @@
1 1
 require File.dirname(__FILE__) + '/../vendor/gems/deep_test/lib/deep_test'
2 2
 
3  
-class ForeignHostWorkerSimulationListener < DeepTest::NullListener
4  
-  def starting(worker)
  3
+class ForeignHostAgentSimulationListener < DeepTest::NullListener
  4
+  def starting(agent)
5 5
     # On a foreign host, there won't necessarily be a database for tests
6 6
     # to run against.  We simulate that by dropping them here.
7 7
     #
8  
-    # It's important that this happens as the first thing when the workers
  8
+    # It's important that this happens as the first thing when the agents
9 9
     # are started, since this is the first listener event that would be
10  
-    # invoked on a foreign host.  before_starting_workers would be invoked
  10
+    # invoked on a foreign host.  before_starting_agents would be invoked
11 11
     # on the local host, which should have databases available as usual.
12 12
     #
13 13
     system "mysqladmin -u root -f drop sample_rails_project_development > /dev/null"
12  sample_rails_project/lib/tasks/deep_test.rake
@@ -3,23 +3,23 @@ gem 'rspec', '1.1.8'
3 3
 require 'deep_test/rake_tasks'
4 4
 
5 5
 DeepTest::TestTask.new(:deep_test) do |t|
6  
-  t.number_of_workers = 1
  6
+  t.number_of_agents = 1
7 7
   t.pattern = "test/unit/**/*_test.rb"
8  
-  t.listener = "ForeignHostWorkerSimulationListener,DeepTest::Database::MysqlSetupListener"
  8
+  t.listener = "ForeignHostAgentSimulationListener,DeepTest::Database::MysqlSetupListener"
9 9
 end
10 10
 Rake::Task[:deep_test].enhance ["db:test:prepare"]
11 11
 
12 12
 Spec::Rake::SpecTask.new(:deep_spec) do |t|
13 13
   t.spec_files = FileList['spec/**/*_spec.rb']
14  
-  t.deep_test :number_of_workers => 2
  14
+  t.deep_test :number_of_agents => 2
15 15
 end
16 16
 Rake::Task[:deep_spec].enhance ["db:test:prepare"]
17 17
 
18 18
 DeepTest::TestTask.new(:distributed_test => %w[db:test:prepare]) do |t|
19  
-  t.number_of_workers = 1
  19
+  t.number_of_agents = 1
20 20
   t.distributed_hosts = %w[localhost]
21  
-  t.requires = File.dirname(__FILE__) + "/../foreign_host_worker_simulation_listener"
22  
-  t.listener = "ForeignHostWorkerSimulationListener,DeepTest::Database::MysqlSetupListener"
  21
+  t.requires = File.dirname(__FILE__) + "/../foreign_host_agent_simulation_listener"
  22
+  t.listener = "ForeignHostAgentSimulationListener,DeepTest::Database::MysqlSetupListener"
23 23
   t.sync_options = {:source => File.expand_path(File.dirname(__FILE__) + "/../.."), 
24 24
                     :rsync_options => "--exclude=.svn --copy-dirlinks"}
25 25
 end
20  spec/deep_test/options_spec.rb
@@ -2,19 +2,19 @@
2 2
 
3 3
 module DeepTest
4 4
   describe Options do
5  
-    it "should support number_of_workers" do
6  
-      Options.new(:number_of_workers => 3).number_of_workers.should == 3
  5
+    it "should support number_of_agents" do
  6
+      Options.new(:number_of_agents => 3).number_of_agents.should == 3
7 7
     end
8 8
 
9  
-    it "should default to number_of_workers based on cpu info at time of call" do
  9
+    it "should default to number_of_agents based on cpu info at time of call" do
10 10
       options = Options.new({})
11 11
       CpuInfo.should_receive(:new).and_return stub("cpu_info", :count => 4)
12  
-      options.number_of_workers.should == 4
  12
+      options.number_of_agents.should == 4
13 13
     end
14 14
 
15 15
     it "should have reasonable defaults" do
16 16
       options = Options.new({})
17  
-      options.number_of_workers.should == 2
  17
+      options.number_of_agents.should == 2
18 18
       options.timeout_in_seconds.should == 30
19 19
       options.server_port.should == 6969
20 20
       options.pattern.should == nil
@@ -70,7 +70,7 @@ class FakeListener2; end
70 70
       listener.listeners.last.should be_instance_of(FakeListener2)
71 71
     end
72 72
 
73  
-    it "should create a list of worker listeners upon request" do
  73
+    it "should create a list of agent listeners upon request" do
74 74
       Options.new({}).new_listener_list.should be_instance_of(DeepTest::ListenerList)
75 75
     end
76 76
 
@@ -99,7 +99,7 @@ class FakeUI; end
99 99
     end
100 100
 
101 101
     it "should support strings as well as symbols" do
102  
-      Options.new("number_of_workers" => 2).number_of_workers.should == 2
  102
+      Options.new("number_of_agents" => 2).number_of_agents.should == 2
103 103
     end
104 104
 
105 105
     it "should raise error when invalid option is specifed" do
@@ -109,17 +109,17 @@ class FakeUI; end
109 109
     end
110 110
 
111 111
     it "should convert to command line option string" do
112  
-      options = Options.new(:number_of_workers => 1, :timeout_in_seconds => 3)
  112
+      options = Options.new(:number_of_agents => 1, :timeout_in_seconds => 3)
113 113
       options.to_command_line.should == 
114 114
         Base64.encode64(Marshal.dump(options)).gsub("\n","")
115 115
     end
116 116
 
117 117
     it "should parse from command line option string" do
118  
-      options = Options.new(:number_of_workers => 2, 
  118
+      options = Options.new(:number_of_agents => 2, 
119 119
                             :timeout_in_seconds => 3,
120 120
                             :pattern => '*')
121 121
       parsed_options = Options.from_command_line(options.to_command_line)
122  
-      parsed_options.number_of_workers.should == 2
  122
+      parsed_options.number_of_agents.should == 2
123 123
       parsed_options.timeout_in_seconds.should == 3
124 124
       parsed_options.pattern.should == '*'
125 125
     end
4  spec/deep_test/spec/extensions/spec_task_spec.rb
@@ -3,12 +3,12 @@
3 3
 describe Spec::Rake::SpecTask do
4 4
   it "should allow deep_test configuration" do
5 5
     t = Spec::Rake::SpecTask.new do |t|
6  
-      t.deep_test :number_of_workers => 2
  6
+      t.deep_test :number_of_agents => 2
7 7
     end
8 8
 
9 9
     deep_test_path = File.expand_path(File.dirname(__FILE__) + 
10 10
                                       '/../../../../lib/deep_test')
11  
-    options = DeepTest::Options.new(:number_of_workers => 2)
  11
+    options = DeepTest::Options.new(:number_of_agents => 2)
12 12
     t.spec_opts.should == ["--require #{deep_test_path}",
13 13
                            "--runner 'DeepTest::Spec::Runner:#{options.to_command_line}'"]
14 14
   end
22  spec/deep_test/spec/runner_spec.rb
@@ -14,13 +14,13 @@ module Spec
14 14
           it("passes2") {}
15 15
         end
16 16
 
17  
-        worker = ThreadWorker.new(central_command, 2)
  17
+        agent = ThreadAgent.new(central_command, 2)
18 18
         Timeout.timeout(5) do
19 19
           runner.process_work_units.should == true
20 20
         end
21  
-        worker.wait_until_done
  21
+        agent.wait_until_done
22 22
 
23  
-        worker.work_done.should == 2
  23
+        agent.work_done.should == 2
24 24
         options.reporter.number_of_examples.should == 2
25 25
         central_command.take_result.should be_nil
26 26
         options.reporter.examples_finished.should == ['passes1','passes2']
@@ -36,11 +36,11 @@ module Spec
36 36
           it("fails") {1.should == 2}; 
37 37
         end
38 38
 
39  
-        worker = ThreadWorker.new(central_command, 2)
  39
+        agent = ThreadAgent.new(central_command, 2)
40 40
         Timeout.timeout(5) do
41 41
           runner.process_work_units.should == false
42 42
         end
43  
-        worker.wait_until_done
  43
+        agent.wait_until_done
44 44
       end
45 45
 
46 46
       it "should return success when there are pending examples" do
@@ -51,11 +51,11 @@ module Spec
51 51
           it("pending") {pending {1.should == 2}}; 
52 52
         end
53 53
 
54  
-        worker = ThreadWorker.new(central_command, 1)
  54
+        agent = ThreadAgent.new(central_command, 1)
55 55
         Timeout.timeout(5) do
56 56
           runner.process_work_units.should == true
57 57
         end
58  
-        worker.wait_until_done
  58
+        agent.wait_until_done
59 59
       end
60 60
 
61 61
       it "should return failure when a pending example passes" do
@@ -66,14 +66,14 @@ module Spec
66 66
           it("pending") {pending {1.should == 1}}; 
67 67
         end
68 68
 
69  
-        worker = ThreadWorker.new(central_command, 1)
  69
+        agent = ThreadAgent.new(central_command, 1)
70 70
         Timeout.timeout(5) do
71 71
           runner.process_work_units.should == false
72 72
         end
73  
-        worker.wait_until_done
  73
+        agent.wait_until_done
74 74
       end
75 75
 
76  
-      it "should return failure when a worker error occurs" do
  76
+      it "should return failure when a agent error occurs" do
77 77
         central_command = SimpleTestCentralCommand.new
78 78
         runner = Runner.new(options, Options.new({}).to_command_line, central_command)
79 79
 
@@ -81,7 +81,7 @@ module Spec
81 81
           it("pending") {pending {1.should == 1}}; 
82 82
         end
83 83
 
84  
-        central_command.write_result Worker::Error.new("example", RuntimeError.new)
  84
+        central_command.write_result Agent::Error.new("example", RuntimeError.new)
85 85
         capture_stdout do
86 86
           runner.process_work_units.should == false
87 87
         end
2  spec/spec_helper.rb
... ...
@@ -1,7 +1,7 @@
1 1
 require File.dirname(__FILE__) + "/../lib/deep_test"
2 2
 require File.dirname(__FILE__) + "/../test/fake_deadlock_error"
3 3
 require File.dirname(__FILE__) + "/../test/simple_test_central_command"
4  
-require File.dirname(__FILE__) + "/thread_worker"
  4
+require File.dirname(__FILE__) + "/thread_agent"
5 5
 require 'spec'
6 6
 
7 7
 describe "sandboxed rspec_options", :shared => true do
2  spec/thread_worker.rb → spec/thread_agent.rb
... ...
@@ -1,4 +1,4 @@
1  
-class ThreadWorker
  1
+class ThreadAgent
2 2
   attr_reader :work_done
3 3
 
4 4
   def initialize(central_command, expected_work)
36  test/deep_test/worker_test.rb → test/deep_test/agent_test.rb
@@ -6,7 +6,7 @@ module DeepTest
6 6
       central_command = SimpleTestCentralCommand.new
7 7
       central_command.write_work Test::WorkUnit.new(TestFactory.passing_test)
8 8
 
9  
-      Worker.new(0, central_command,stub_everything).run
  9
+      Agent.new(0, central_command,stub_everything).run
10 10
 
11 11
       assert_kind_of ::Test::Unit::TestResult, central_command.take_result
12 12
     end
@@ -16,7 +16,7 @@ module DeepTest
16 16
       central_command.write_work Test::WorkUnit.new(TestFactory.passing_test)
17 17
       central_command.write_work Test::WorkUnit.new(TestFactory.failing_test)
18 18
 
19  
-      Worker.new(0, central_command, stub_everything).run
  19
+      Agent.new(0, central_command, stub_everything).run
20 20
 
21 21
       result_1 = central_command.take_result
22 22
       result_2 = central_command.take_result
@@ -28,9 +28,9 @@ module DeepTest
28 28
     test "notifies listener that it is starting" do
29 29
       central_command = SimpleTestCentralCommand.new
30 30
       listener = stub_everything
31  
-      worker = Worker.new(0, central_command, listener)
32  
-      listener.expects(:starting).with(worker)
33  
-      worker.run
  31
+      agent = Agent.new(0, central_command, listener)
  32
+      listener.expects(:starting).with(agent)
  33
+      agent.run
34 34
     end
35 35
 
36 36
     test "notifies listener that it is about to do work" do
@@ -38,9 +38,9 @@ module DeepTest
38 38
       work_unit = Test::WorkUnit.new(TestFactory.passing_test)
39 39
       central_command.write_work work_unit
40 40
       listener = stub_everything
41  
-      worker = Worker.new(0, central_command, listener)
42  
-      listener.expects(:starting_work).with(worker, work_unit)
43  
-      worker.run
  41
+      agent = Agent.new(0, central_command, listener)
  42
+      listener.expects(:starting_work).with(agent, work_unit)
  43
+      agent.run
44 44
     end
45 45
 
46 46
     test "notifies listener that it has done work" do
@@ -48,20 +48,20 @@ module DeepTest
48 48
       work_unit = mock(:run => :result)
49 49
       central_command.write_work work_unit
50 50
       listener = stub_everything
51  
-      worker = Worker.new(0, central_command, listener)
52  
-      listener.expects(:finished_work).with(worker, work_unit, :result)
53  
-      worker.run
  51
+      agent = Agent.new(0, central_command, listener)
  52
+      listener.expects(:finished_work).with(agent, work_unit, :result)
  53
+      agent.run
54 54
     end
55 55
 
56  
-    test "exception raised by work unit gives in Worker::Error" do
  56
+    test "exception raised by work unit gives in Agent::Error" do
57 57
       central_command = SimpleTestCentralCommand.new
58 58
       work_unit = mock
59 59
       work_unit.expects(:run).raises(exception = RuntimeError.new)
60 60
       central_command.write_work work_unit
61 61
 
62  
-      Worker.new(0, central_command, stub_everything).run
  62
+      Agent.new(0, central_command, stub_everything).run
63 63
       
64  
-      assert_equal Worker::Error.new(work_unit, exception),
  64
+      assert_equal Agent::Error.new(work_unit, exception),
65 65
                    central_command.take_result
66 66
     end
67 67
 
@@ -74,7 +74,7 @@ module DeepTest
74 74
 
75 75
       central_command.expects(:write_result)
76 76
 
77  
-      Worker.new(0, central_command, stub_everything).run
  77
+      Agent.new(0, central_command, stub_everything).run
78 78
     end
79 79
 
80 80
     test "finishes running when no more work units are remaining" do
@@ -82,11 +82,11 @@ module DeepTest
82 82
       central_command.expects(:take_work).
83 83
         raises(CentralCommand::NoWorkUnitsRemainingError)
84 84
 
85  
-      Worker.new(0, central_command, stub_everything).run
  85
+      Agent.new(0, central_command, stub_everything).run
86 86
     end
87 87
 
88  
-    test "number is available to indentify worker" do
89  
-      assert_equal 1, Worker.new(1, nil, nil).number
  88
+    test "number is available to indentify agent" do
  89
+      assert_equal 1, Agent.new(1, nil, nil).number
90 90
     end
91 91
     
92 92
     test "does not fork from rake" do
8  test/deep_test/distributed/beachhead_test.rb
@@ -3,13 +3,13 @@
3 3
 module DeepTest
4 4
   module Distributed
5 5
     unit_tests do
6  
-      test "start_all delegates to worker implementation" do
  6
+      test "start_all delegates to agent implementation" do
7 7
         beachhead = Beachhead.new("", implementation = mock)
8 8
         implementation.expects(:start_all)
9 9
         beachhead.start_all
10 10
       end
11 11
 
12  
-      test "stop_all delegates to worker implementation" do
  12
+      test "stop_all delegates to agent implementation" do
13 13
         beachhead = Beachhead.new("", implementation = mock)
14 14
         implementation.expects(:stop_all)
15 15
         beachhead.stop_all.join
@@ -51,7 +51,7 @@ def stop_all
51 51
         beachhead.load_files(["/source/path/my/file.rb"])
52 52
       end
53 53
 
54  
-      test "service is removed after grace period if workers haven't been started" do
  54
+      test "service is removed after grace period if agents haven't been started" do
55 55
         log_level = DeepTest.logger.level
56 56
         begin
57 57
           DeepTest.logger.level = Logger::ERROR
@@ -73,7 +73,7 @@ def stop_all
73 73
         end
74 74
       end
75 75
 
76  
-      test "service is not removed after grace period if workers have been started" do
  76
+      test "service is not removed after grace period if agents have been started" do
77 77
         log_level = DeepTest.logger.level
78 78
         begin
79 79
           DeepTest.logger.level = Logger::ERROR
2  test/deep_test/distributed/landing_fleet_test.rb
@@ -27,7 +27,7 @@ module Distributed
27 27
         fleet.establish_beachhead(options)
28 28
       end
29 29
 
30  
-      test "establish_beachhead returns Beachheads with each worker" do
  30
+      test "establish_beachhead returns Beachheads with each agent" do
31 31
         server_1 = mock(:establish_beachhead => :beachhead_1)
32 32
         server_2 = mock(:establish_beachhead => :beachhead_2)
33 33
         options = Options.new({:ui => "UI::Null"})
2  test/deep_test/distributed/multi_test_server_proxy_test.rb
@@ -27,7 +27,7 @@ module Distributed
27 27
         fleet.establish_beachhead(options)
28 28
       end
29 29
 
30  
-      test "establish_beachhead returns Beachheads with each worker" do
  30
+      test "establish_beachhead returns Beachheads with each agent" do
31 31
         ship_1 = mock(:establish_beachhead => :beachhead_1)
32 32
         ship_2 = mock(:establish_beachhead => :beachhead_2)
33 33
         options = Options.new({:ui => "UI::Null"})
6  test/deep_test/distributed/remote_deployment_test.rb
@@ -29,7 +29,7 @@ class FakeListener; end
29 29
         deployment.load_files ["filelist"]
30 30
       end
31 31
 
32  
-      test "load_files loads files on worker server" do
  32
+      test "load_files loads files on agent server" do
33 33
         beachhead = stub_everything
34 34
         deployment = RemoteDeployment.new(
35 35
           Options.new(:sync_options => {:source => "/tmp"}),
@@ -54,7 +54,7 @@ class FakeListener; end
54 54
         deployment.load_files ["filelist"]
55 55
       end
56 56
 
57  
-      test "start_all starts workers on worker server" do
  57
+      test "start_all starts agents on agent server" do
58 58
         deployment = RemoteDeployment.new(
59 59
           options = Options.new(:sync_options => {:source => "/tmp"}),
60 60
           landing_ship = stub_everything,
@@ -71,7 +71,7 @@ class FakeListener; end
71 71
         deployment.start_all
72 72
       end
73 73
 
74  
-      test "stop_all stops workers on worker server that was spawned in load_files" do
  74
+      test "stop_all stops agents on agent server that was spawned in load_files" do
75 75
         beachhead = stub_everything
76 76
         deployment = RemoteDeployment.new(
77 77
           Options.new(:sync_options => {:source => "/tmp"}),
14  test/deep_test/distributed/test_server_workers_test.rb
@@ -3,24 +3,24 @@
3 3
 module DeepTest
4 4
   module Distributed
5 5
     unit_tests do
6  
-      test "number_of_workers is determined by mirror server options" do
7  
-        workers = TestServerWorkers.new(
8  
-          Options.new({}), {:number_of_workers => 4}, mock
  6
+      test "number_of_agents is determined by mirror server options" do
  7
+        agents = TestServerWorkers.new(
  8
+          Options.new({}), {:number_of_agents => 4}, mock
9 9
         )
10 10
 
11  
-        assert_equal 4, workers.number_of_workers
  11
+        assert_equal 4, agents.number_of_agents
12 12
       end
13 13
 
14 14
       test "central_command is retrieved using client connection information" do
15  
-        workers = TestServerWorkers.new(
  15
+        agents = TestServerWorkers.new(
16 16
           options = Options.new({}),
17  
-          {:number_of_workers => 4},
  17
+          {:number_of_agents => 4},
18 18
           mock(:address => "address")
19 19
         )
20 20
         DeepTest::CentralCommand.expects(:remote_reference).
21 21
           with("address", options.server_port).returns(:central_command_reference)
22 22
 
23  
-        assert_equal :central_command_reference, workers.central_command
  23
+        assert_equal :central_command_reference, agents.central_command
24 24
       end
25 25
     end
26 26
   end
12  test/deep_test/distributed/throughput_runner_test.rb
@@ -7,11 +7,11 @@ module Distributed
7 7
         central_command = SimpleTestCentralCommand.new
8 8
         runner = ThroughputRunner.new(Options.new({}), 5, central_command)
9 9
 
10  
-        worker = ThreadWorker.new(central_command, 5)
  10
+        agent = ThreadAgent.new(central_command, 5)
11 11
         Timeout.timeout(5) do
12 12
           runner.process_work_units
13 13
         end
14  
-        worker.wait_until_done
  14
+        agent.wait_until_done
15 15
       end
16 16
 
17 17
       test "runner yields all results from central_command" do
@@ -22,11 +22,11 @@ module Distributed
22 22
           count += 1
23 23
         end
24 24
 
25  
-        worker = ThreadWorker.new(central_command, 2)
  25
+        agent = ThreadAgent.new(central_command, 2)
26 26
         Timeout.timeout(5) do
27 27
           runner.process_work_units
28 28
         end
29  
-        worker.wait_until_done
  29
+        agent.wait_until_done
30 30
 
31 31
         assert_equal 2, count
32 32
       end
@@ -35,12 +35,12 @@ module Distributed
35 35
         central_command = SimpleTestCentralCommand.new
36 36
         runner = ThroughputRunner.new(Options.new({}), 2, central_command)
37 37
 
38  
-        worker = ThreadWorker.new(central_command, 2)
  38
+        agent = ThreadAgent.new(central_command, 2)
39 39
         count = 0
40 40
         Timeout.timeout(5) do
41 41
           runner.process_work_units
42 42
         end
43  
-        worker.wait_until_done
  43
+        agent.wait_until_done
44 44
 
45 45
         assert_kind_of ThroughputStatistics, runner.statistics
46 46
       end
4  test/deep_test/distributed/throughput_worker_client_test.rb
@@ -3,7 +3,7 @@
3 3
 module DeepTest
4 4
   module Distributed
5 5
     unit_tests do
6  
-      test "start_all starts workers on a new worker server" do
  6
+      test "start_all starts agents on a new agent server" do
7 7
         client = ThroughputWorkerClient.new(
8 8
           options = Options.new({}),
9 9
           landing_ship = stub_everything
@@ -16,7 +16,7 @@ module Distributed
16 16
         client.start_all
17 17
       end
18 18
 
19  
-      test "stop_all stops workers on worker server that was spawned in start_all" do
  19
+      test "stop_all stops agents on agent server that was spawned in start_all" do
20 20
         beachhead = stub_everything
21 21
         client = ThroughputWorkerClient.new(
22 22
           Options.new({}),
12  test/deep_test/listener_list_test.rb
@@ -5,12 +5,12 @@ module DeepTest
5 5
     test &q