testbot 0.4.2 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/README.markdown +1 -1
- data/lib/runner.rb +11 -4
- data/lib/shared/simple_daemonize.rb +15 -9
- data/lib/testbot.rb +7 -6
- data/testbot.gemspec +1 -0
- metadata +25 -9
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
@@ -68,7 +68,7 @@ Using testbot with Rails 3:
|
|
68
68
|
|
69
69
|
Using testbot with Rails 2:
|
70
70
|
|
71
|
-
ruby script/plugin install git://github.com/joakimk/testbot.git -r 'refs/tags/v0.4.
|
71
|
+
ruby script/plugin install git://github.com/joakimk/testbot.git -r 'refs/tags/v0.4.4'
|
72
72
|
script/generate testbot --connect 192.168.0.100
|
73
73
|
|
74
74
|
rake testbot:spec (or :test, :features)
|
data/lib/runner.rb
CHANGED
@@ -8,7 +8,7 @@ require File.dirname(__FILE__) + '/adapters/adapter'
|
|
8
8
|
TIME_BETWEEN_NORMAL_POLLS = 1
|
9
9
|
TIME_BETWEEN_QUICK_POLLS = 0.1
|
10
10
|
TIME_BETWEEN_PINGS = 5
|
11
|
-
TIME_BETWEEN_VERSION_CHECKS = 60
|
11
|
+
TIME_BETWEEN_VERSION_CHECKS = Testbot.version.include?('.DEV.') ? 5 : 60
|
12
12
|
MAX_CPU_USAGE_WHEN_IDLE = 50
|
13
13
|
|
14
14
|
class CPU
|
@@ -192,10 +192,17 @@ class Runner
|
|
192
192
|
version = Server.get('/version') rescue Testbot.version
|
193
193
|
return unless version != Testbot.version
|
194
194
|
|
195
|
-
|
196
|
-
|
195
|
+
# In a PXE cluster with a shared gem folder we only want one of them to do the update
|
196
|
+
if @config.wait_for_updated_gem
|
197
|
+
# Gem.available? is cached so it won't detect new gems.
|
198
|
+
gem = Gem::Dependency.new("testbot", version)
|
199
|
+
successful_install = !Gem::SourceIndex.from_installed_gems.search(gem).empty?
|
197
200
|
else
|
198
|
-
|
201
|
+
if version.include?(".DEV.")
|
202
|
+
successful_install = system("wget #{@config.dev_gem_root}/testbot-#{version}.gem && gem install testbot-#{version}.gem --no-ri --no-rdoc && rm testbot-#{version}.gem")
|
203
|
+
else
|
204
|
+
successful_install = system "gem install testbot -v #{version} --no-ri --no-rdoc"
|
205
|
+
end
|
199
206
|
end
|
200
207
|
|
201
208
|
if successful_install
|
@@ -1,18 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'daemons'
|
3
|
+
|
1
4
|
class SimpleDaemonize
|
2
5
|
|
3
|
-
def self.start(proc, pid_path)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
File.open(pid_path, 'w') { |file| file.write(pid) }
|
10
|
-
|
6
|
+
def self.start(proc, pid_path, app_name)
|
7
|
+
working_dir = Dir.pwd
|
8
|
+
|
9
|
+
group = Daemons::ApplicationGroup.new(app_name)
|
10
|
+
group.new_application(:mode => :none).start
|
11
|
+
|
12
|
+
File.open(pid_path, 'w') { |file| file.write(Process.pid) }
|
13
|
+
Dir.chdir(working_dir)
|
14
|
+
proc.call
|
11
15
|
end
|
12
16
|
|
13
17
|
def self.stop(pid_path)
|
14
18
|
return unless File.exists?(pid_path)
|
15
|
-
|
19
|
+
pid = File.read(pid_path)
|
20
|
+
|
21
|
+
system "kill -9 #{pid} &> /dev/null"
|
16
22
|
system "rm #{pid_path} &> /dev/null"
|
17
23
|
end
|
18
24
|
|
data/lib/testbot.rb
CHANGED
@@ -9,7 +9,7 @@ unless defined?(Testbot)
|
|
9
9
|
|
10
10
|
# Don't forget to update readme and changelog
|
11
11
|
def self.version
|
12
|
-
version = "0.4.
|
12
|
+
version = "0.4.4"
|
13
13
|
dev_version_file = File.join(File.dirname(__FILE__), '..', 'DEV_VERSION')
|
14
14
|
if File.exists?(dev_version_file)
|
15
15
|
version += File.read(dev_version_file)
|
@@ -89,6 +89,7 @@ unless defined?(Testbot)
|
|
89
89
|
:ssh_tunnel => opts[:ssh_tunnel], :server_user => opts[:user],
|
90
90
|
:max_jruby_instances => opts[:max_jruby_instances],
|
91
91
|
:dev_gem_root => opts[:dev_gem_root],
|
92
|
+
:wait_for_updated_gem => opts[:wait_for_updated_gem],
|
92
93
|
:jruby_opts => opts[:jruby_opts])
|
93
94
|
runner.run!
|
94
95
|
}
|
@@ -96,8 +97,8 @@ unless defined?(Testbot)
|
|
96
97
|
if opts[:runner] == 'run'
|
97
98
|
proc.call
|
98
99
|
else
|
99
|
-
|
100
|
-
|
100
|
+
puts "Testbot runner started (pid: #{Process.pid})"
|
101
|
+
SimpleDaemonize.start(proc, Testbot::RUNNER_PID, "testbot (runner)")
|
101
102
|
end
|
102
103
|
end
|
103
104
|
|
@@ -108,12 +109,12 @@ unless defined?(Testbot)
|
|
108
109
|
require File.join(File.dirname(__FILE__), '/server')
|
109
110
|
Sinatra::Application.run! :environment => "production"
|
110
111
|
else
|
111
|
-
|
112
|
+
puts "Testbot server started (pid: #{Process.pid})"
|
113
|
+
SimpleDaemonize.start(lambda {
|
112
114
|
ENV['DISABLE_LOGGING'] = "true"
|
113
115
|
require File.join(File.dirname(__FILE__), '/server')
|
114
116
|
Sinatra::Application.run! :environment => "production"
|
115
|
-
}, Testbot::SERVER_PID)
|
116
|
-
puts "Testbot server started (pid: #{pid})"
|
117
|
+
}, Testbot::SERVER_PID, "testbot (server)")
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
data/testbot.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency('net-ssh', '>= 2.0.23')
|
21
21
|
s.add_dependency('sequel', '>= 3.16.0')
|
22
22
|
s.add_dependency('json', '>= 1.4.6')
|
23
|
+
s.add_dependency('daemons', '=1.0.10') # Because mongrel uses this version
|
23
24
|
s.add_dependency('acts_as_rails3_generator')
|
24
25
|
|
25
26
|
# Could work with older versions, but not newer (when deploying on debian)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 4
|
10
|
+
version: 0.4.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Joakim Kolsj\xC3\xB6"
|
@@ -115,9 +115,25 @@ dependencies:
|
|
115
115
|
type: :runtime
|
116
116
|
version_requirements: *id006
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: daemons
|
119
119
|
prerelease: false
|
120
120
|
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - "="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
126
|
+
segments:
|
127
|
+
- 1
|
128
|
+
- 0
|
129
|
+
- 10
|
130
|
+
version: 1.0.10
|
131
|
+
type: :runtime
|
132
|
+
version_requirements: *id007
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: acts_as_rails3_generator
|
135
|
+
prerelease: false
|
136
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
121
137
|
none: false
|
122
138
|
requirements:
|
123
139
|
- - ">="
|
@@ -127,11 +143,11 @@ dependencies:
|
|
127
143
|
- 0
|
128
144
|
version: "0"
|
129
145
|
type: :runtime
|
130
|
-
version_requirements: *
|
146
|
+
version_requirements: *id008
|
131
147
|
- !ruby/object:Gem::Dependency
|
132
148
|
name: sqlite3-ruby
|
133
149
|
prerelease: false
|
134
|
-
requirement: &
|
150
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
135
151
|
none: false
|
136
152
|
requirements:
|
137
153
|
- - "="
|
@@ -143,11 +159,11 @@ dependencies:
|
|
143
159
|
- 5
|
144
160
|
version: 1.2.5
|
145
161
|
type: :runtime
|
146
|
-
version_requirements: *
|
162
|
+
version_requirements: *id009
|
147
163
|
- !ruby/object:Gem::Dependency
|
148
164
|
name: mongrel
|
149
165
|
prerelease: false
|
150
|
-
requirement: &
|
166
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
151
167
|
none: false
|
152
168
|
requirements:
|
153
169
|
- - "="
|
@@ -160,7 +176,7 @@ dependencies:
|
|
160
176
|
- pre2
|
161
177
|
version: 1.2.0.pre2
|
162
178
|
type: :runtime
|
163
|
-
version_requirements: *
|
179
|
+
version_requirements: *id010
|
164
180
|
description: Testbot is a test distribution tool that works with Rails, RSpec, Test::Unit and Cucumber.
|
165
181
|
email:
|
166
182
|
- joakim.kolsjo@gmail.com
|