sauron 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +71 -15
- data/VERSION +1 -1
- data/lib/sauron/sauron_template.rb +4 -2
- data/sauron.gemspec +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,22 +1,34 @@
|
|
1
1
|
= Sauron
|
2
2
|
|
3
|
-
The all-seeing testing toolkit with many workers. Think multi-threaded, multi-database autotest.
|
3
|
+
The all-seeing testing toolkit with many workers. Think multi-threaded, multi-database autotest.
|
4
|
+
It continually watches your application for code changes like autotest, then runs them
|
5
|
+
multi-threaded, each thread having its own database, to take maximum advantage of your computer's
|
6
|
+
multiple cores/processors. Fast!
|
4
7
|
|
5
8
|
== Why a new testing toolkit?
|
6
9
|
|
7
|
-
For a long time, my holy grail of testing has been multi-threaded autotest. Autotest is awesome,
|
10
|
+
For a long time, my holy grail of testing has been multi-threaded autotest. Autotest is awesome,
|
11
|
+
watching my application in real time and only running tests for code that has changed. But it
|
12
|
+
doesn't take advantage of the growing number of cores and processors that computers have today.
|
8
13
|
|
9
|
-
Parallel_specs solves the multi-threaded, multi-database problem, but it has to be run manually,
|
14
|
+
Parallel_specs solves the multi-threaded, multi-database problem, but it has to be run manually,
|
15
|
+
and runs all your tests at once. It also doesn't split up the test suite very efficiently,
|
16
|
+
resulting in one thread finishing significantly sooner than the other.
|
10
17
|
|
11
18
|
== How does it work?
|
12
19
|
|
13
|
-
Sauron uses the watchr gem to watch your rails files for changes, and runs only the tests related
|
20
|
+
Sauron uses the watchr gem to watch your rails files for changes, and runs only the tests related
|
21
|
+
to those changes. Sauron comes with a basic, but user-changeable, watchr script. This part is much
|
22
|
+
like autotest.
|
14
23
|
|
15
|
-
When Sauron detects that tests need to be run, it runs single tests with a direct ruby command. If
|
24
|
+
When Sauron detects that tests need to be run, it runs single tests with a direct ruby command. If
|
25
|
+
there are multiple files, however, it kicks off a customized version of the hydra gem, creating
|
26
|
+
multiple workers to run pieces of the test suite efficiently.
|
16
27
|
|
17
28
|
== How do I use it?
|
18
29
|
|
19
|
-
WARNING: This is still a *very* new gem (only in existence since July 17th, 2010). Use very
|
30
|
+
WARNING: This is still a *very* new gem (only in existence since July 17th, 2010). Use very
|
31
|
+
carefully.
|
20
32
|
|
21
33
|
=== Include the gems
|
22
34
|
|
@@ -24,13 +36,15 @@ The first step is to include the necessary gems in your config/environments/test
|
|
24
36
|
|
25
37
|
config.gem 'sauron'
|
26
38
|
|
27
|
-
The is the Sauron gem, which will also include the Watchr gem and a fork of the Hydra gem that I
|
39
|
+
The is the Sauron gem, which will also include the Watchr gem and a fork of the Hydra gem that I
|
40
|
+
modified to support multiple databases. To get them on your system, run:
|
28
41
|
|
29
42
|
rake gems:install RAILS_ENV=test
|
30
43
|
|
31
44
|
=== Edit your database configuration
|
32
45
|
|
33
|
-
Edit your config/database.yml so that your test database name includes the worker number
|
46
|
+
Edit your config/database.yml so that your test database name includes the worker number
|
47
|
+
environment variable. Here's an example:
|
34
48
|
|
35
49
|
test:
|
36
50
|
adapter: mysql
|
@@ -42,11 +56,15 @@ Or for sqlite3:
|
|
42
56
|
adapter: sqlite3
|
43
57
|
database: app_test<%= ENV['HYDRA_WORKER_ID'] %>.sqlite3
|
44
58
|
|
59
|
+
Aside from sqlite, you might have an extra step depending on your database permissions. See
|
60
|
+
"Caveats" below.
|
61
|
+
|
45
62
|
=== Run the Sauron generator
|
46
63
|
|
47
64
|
ruby script/generate sauron
|
48
65
|
|
49
|
-
By default, it will create a setup with 4 workers (threads/databases used during tests) and assume
|
66
|
+
By default, it will create a setup with 4 workers (threads/databases used during tests) and assume
|
67
|
+
you are using testunit. You can change both of these with commandline arguments:
|
50
68
|
|
51
69
|
ruby script/generate sauron --workers=10 --rspec
|
52
70
|
|
@@ -58,23 +76,61 @@ While developing your rails app, run:
|
|
58
76
|
|
59
77
|
ruby script/sauron
|
60
78
|
|
61
|
-
which will launch Sauron and watch your app. Use Ctrl-\ to refresh your testing suite after adding
|
79
|
+
which will launch Sauron and watch your app. Use Ctrl-\ to refresh your testing suite after adding
|
80
|
+
files. Ta-da! Multi-threaded, multi-database, automatic testing goodness!
|
62
81
|
|
63
82
|
== For advanced users
|
64
83
|
|
65
|
-
The generator creates a watchr script called sauron_watchr.rb in the root directory of your app. I
|
84
|
+
The generator creates a watchr script called sauron_watchr.rb in the root directory of your app. I
|
85
|
+
think it has a good basic setup, but customize it all you want.
|
66
86
|
|
67
87
|
== For really advanced users
|
68
88
|
|
69
|
-
Help me make this tool better. Fork it, fix it, send a pull request. My low public profile and
|
89
|
+
Help me make this tool better. Fork it, fix it, send a pull request. My low public profile and
|
90
|
+
crippling need for acceptance ensure you'll get a prompt, friendly response.
|
70
91
|
|
71
92
|
== Caveats
|
72
93
|
|
73
|
-
|
94
|
+
==== MySQL, PostgreSQL, and other big kids
|
95
|
+
|
96
|
+
Sqlite is fun, but with real databases come issues like permissions. If you have liberal local
|
97
|
+
permissions on your database, like root with no password from localhost, you shouldn't have to do
|
98
|
+
anything extra to prepare your db's.
|
99
|
+
|
100
|
+
If you're more paranoid like me, and assign a unique user/pass for each app on your local system,
|
101
|
+
you'll need to create the extra databases and grant privileges in advance. It's easy, just create
|
102
|
+
more test databases with numbers appended in this fashion:
|
103
|
+
|
104
|
+
* app_test
|
105
|
+
* app_test1
|
106
|
+
* app_test2
|
107
|
+
* app_test3
|
108
|
+
|
109
|
+
And so forth, as many databases as you'll have workers. These three lines work nicely in MySQL:
|
110
|
+
|
111
|
+
create database app_test1;
|
112
|
+
grant all on app_test1.* to turtle@localhost identified by 'secretpassword';
|
113
|
+
flush privileges;
|
114
|
+
|
115
|
+
Substitute your chosen username and password above, instead of 'turtle' and 'secretpassword',
|
116
|
+
respectively. Do this to create each new database.
|
117
|
+
|
118
|
+
==== Full Hydra support? No!
|
119
|
+
|
120
|
+
While the Hydra gem supports multiple computers over a network, Sauron doesn't at this time. That
|
121
|
+
might become a priority if people ask. It will definitely become a priority if somebody buys me a
|
122
|
+
multi-core system I can add to my testing arsenal :)
|
123
|
+
|
124
|
+
==== Newness/shoddiness
|
74
125
|
|
75
|
-
|
126
|
+
This is very new. I can't see how it would damage anything, but I guess that's what everyone says
|
127
|
+
before they damage something. Also, I've traditionally used shoulda over rspec, so there may be
|
128
|
+
glitches in what files Sauron watches/runs in rspec mode. If you see something wrong, let me know.
|
76
129
|
|
77
|
-
|
130
|
+
Also, this was put together quickly. If you don't feel like the underlying code is beautiful, this
|
131
|
+
was largely hacked together during Ruby Midwest weekend, during hours that should have been used
|
132
|
+
for sleeping. If you *still* feel slighted, I will offer you a full refund of what you paid for
|
133
|
+
this gem. No questions asked!
|
78
134
|
|
79
135
|
|
80
136
|
Copyright (c) 2010 Jaime Bellmyer, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.23
|
@@ -135,8 +135,10 @@ class SauronTemplate
|
|
135
135
|
print '.'
|
136
136
|
STDOUT.flush
|
137
137
|
|
138
|
-
|
139
|
-
|
138
|
+
hydra_worker_id = (i == 0 ? '' : i)
|
139
|
+
test_env_number = (i == 0 ? '' : i + 1)
|
140
|
+
|
141
|
+
`rake db:reset RAILS_ENV=test HYDRA_WORKER_ID=#{hydra_worker_id} TEST_ENV_NUMBER=#{test_env_number}`
|
140
142
|
end
|
141
143
|
end
|
142
144
|
|
data/sauron.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sauron}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.23"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jaime Bellmyer"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-20}
|
13
13
|
s.description = %q{Speed up your automated tests with multiple databases and workers.}
|
14
14
|
s.email = %q{jaime@kconrails.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 23
|
10
|
+
version: 0.1.23
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jaime Bellmyer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-20 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|