tlb-testunit 0.1.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.emacs_project +7 -1
- data/.gitignore +3 -1
- data/README.markdown +50 -17
- data/Rakefile +4 -3
- data/gem_common.rb +17 -9
- data/lib/tlb.rb +2 -2
- data/lib/tlb/run_data.rb +2 -0
- data/lib/tlb/test_unit/mediator_inflection.rb +1 -0
- data/lib/tlb/test_unit/test_observer.rb +3 -2
- data/lib/tlb/test_unit/test_splitter.rb +2 -0
- data/lib/tlb/test_unit/test_task.rb +3 -2
- data/lib/tlb/util.rb +11 -0
- data/tlb-alien-g0.3.0.jar +0 -0
- metadata +27 -18
- data/tlb-all-gv0.2-9-g1f1a4aa.jar +0 -0
data/.emacs_project
CHANGED
@@ -1 +1,7 @@
|
|
1
|
-
(setq rspec-executable "rspec")
|
1
|
+
(setq rspec-executable "rspec")
|
2
|
+
(setenv "GEM_HOME" "/home/janmejay/.rvm/gems/ruby-1.8.7-head@vanilla")
|
3
|
+
(setenv "GEM_PATH" "/home/janmejay/.rvm/gems/ruby-1.8.7-head@vanilla:/home/janmejay/.rvm/gems/ruby-1.8.7-head@global")
|
4
|
+
(let ((gem-bin "/home/janmejay/.rvm/gems/ruby-1.8.7-head@vanilla/bin")
|
5
|
+
(path (getenv "PATH")))
|
6
|
+
(unless (string-match-p gem-bin path)
|
7
|
+
(setenv "PATH" (concat gem-bin ":" path))))
|
data/.gitignore
CHANGED
data/README.markdown
CHANGED
@@ -1,33 +1,66 @@
|
|
1
1
|
## Using tlb_rb:
|
2
2
|
|
3
|
-
|
4
|
-
Balancer process is actually an HTTP server which
|
3
|
+
tlb.rb uses [tlb](https://github.com/test-load-balancer/tlb "TLB") under the hood. It runs a sub-process which talks to the actual tlb-server(or equivallent) to balance and post run-feedback.
|
4
|
+
Balancer process is actually an HTTP server which listen to a certain TCP port so tlb-ruby library can talk to it.
|
5
5
|
This is controlled by an environment variable named *'TLB_BALANCER_PORT'*, which can be set to any port number(integer between 1024 to 65535) that is guaranteed to remain un-bound while the build runs.
|
6
6
|
|
7
7
|
In addition to this extra environment variable, the usual TLB environment variable setup is required(so the balancer knows things like what partitioning algorithm to use or what server to talk to).
|
8
|
-
Detailed documentation of TLB environment variable configuration is available at [
|
8
|
+
Detailed documentation of TLB environment variable configuration is available at [http://test-load-balancer.github.com](http://test-load-balancer.github.com "Tlb Documentation")
|
9
9
|
|
10
|
-
As of now,
|
10
|
+
As of now, tlb.rb supports RSpec(1.x and 2.x) and Test::Unit, which are the two most widely used testing frameworks in Ruby. We plan to add support for other ruby-testing-frameworks soon.
|
11
11
|
|
12
12
|
## Setting it up for your project
|
13
13
|
|
14
14
|
Please refer the [sample_projects](http://github.com/test-load-balancer/sample_projects "Tlb setup examples") to see the details of how to set it up.
|
15
15
|
|
16
16
|
Usually, something equivallent of this in one of your Rake files should suffice:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require
|
21
|
-
|
17
|
+
__RSpec-1.x__:
|
18
|
+
require 'rubygems'
|
19
|
+
gem 'tlb-rspec1'
|
20
|
+
require 'tlb/spec_task'
|
21
|
+
|
22
22
|
Tlb::SpecTask.new(:balanced_specs) do |t|
|
23
23
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
-
t.spec_opts << "--
|
24
|
+
t.spec_opts << "--format progress"
|
25
25
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Where run_balanced is the task you invoke at the top-level(invoked externally).
|
26
|
+
|
27
|
+
load 'tasks/tlb.rake'
|
28
|
+
desc "run specs load-balanced(based on environment variables)"
|
29
|
+
task :bal => ['tlb:start', :balanced_specs]
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
__RSpec-2.x__:
|
32
|
+
require 'rubygems'
|
33
|
+
gem 'tlb-rspec2'
|
34
|
+
require 'tlb/rspec/spec_task'
|
35
|
+
|
36
|
+
Tlb::RSpec::SpecTask.new(:run_balanced) do |t|
|
37
|
+
t.pattern = 'spec/**/*_spec.rb'
|
38
|
+
end
|
39
|
+
|
40
|
+
load 'tasks/tlb.rake'
|
41
|
+
desc "run specs load-balanced(based on environment variables)"
|
42
|
+
task :bal => ['tlb:start', :run_balanced]
|
43
|
+
|
44
|
+
__Test::Unit__:
|
45
|
+
require 'rake'
|
46
|
+
require 'rubygems'
|
47
|
+
gem 'tlb-testunit'
|
48
|
+
require 'tlb/test_unit/test_task'
|
49
|
+
|
50
|
+
Tlb::TestUnit::TestTask.new(:test_balanced) do |t|
|
51
|
+
t.libs << "test"
|
52
|
+
t.test_files = FileList['test/**/*_test.rb']
|
53
|
+
t.verbose = true
|
54
|
+
end
|
55
|
+
|
56
|
+
load 'tasks/tlb.rake'
|
57
|
+
|
58
|
+
task :bal => ['tlb:start', :test_balanced]
|
59
|
+
|
60
|
+
Where __bal__ is the task you invoke at the top-level(invoked externally).
|
61
|
+
|
62
|
+
## RSpec source-control and release-version/environment compatibility
|
63
|
+
The branch '__master__' supports __Test::Unit__ and __RSpec-2.x__. If you use __RSpec-1__(i.e. __1.3.x__ etc), please use the branch named '__rspec-1__'.
|
64
|
+
Having said that, we encourage end-users to use the released gem versions insteed of using upstream snapshot. Detailed documentation for every released version is available at http://test-load-balancer.github.com.
|
65
|
+
Please post any issues on our [Issue Tracker](http://code.google.com/p/tlb/issues/list "Issue Tracker").
|
66
|
+
|
data/Rakefile
CHANGED
@@ -14,9 +14,10 @@ namespace :test do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
task :build_tlb do
|
17
|
-
Dir.glob("tlb-
|
18
|
-
sh 'ant
|
19
|
-
Dir.glob('tlb/target/tlb-
|
17
|
+
[Dir.glob("tlb-alien*.jar"), Dir.glob("tlb-server*.jar")].flatten.each { |jar| FileUtils.rm(jar) }
|
18
|
+
sh '(cd tlb && ant clean package -Doffline=t)'
|
19
|
+
Dir.glob('tlb/target/tlb-alien*').each { |file| FileUtils.copy(file, ".") }
|
20
|
+
Dir.glob('tlb/target/tlb-server*').each { |file| FileUtils.copy(file, "tests/") }
|
20
21
|
end
|
21
22
|
|
22
23
|
task :package do
|
data/gem_common.rb
CHANGED
@@ -5,21 +5,29 @@ TAG_VERSION = `git describe --abbrev=0`.gsub(/^v/, '')
|
|
5
5
|
CODE_VERSION = `git describe --always`
|
6
6
|
AUTHORS = ["Janmejay Singh", "Pavan KS"]
|
7
7
|
EMAIL = "singh.janmejay@gmail.com;itspanzi@gmail.com"
|
8
|
-
HOME_PAGE = "http://github.com/test-load-balancer/
|
8
|
+
HOME_PAGE = "http://github.com/test-load-balancer/tlb.rb"
|
9
9
|
SUMMARY = "#{$name}-#{CODE_VERSION}"
|
10
10
|
DESC = <<END
|
11
11
|
TLB ruby implementation base, which provides support for load balancing tests written in #{$framework}.
|
12
|
-
|
13
|
-
Detailed
|
12
|
+
TLB.rb test suite is not bundled, please check http://github.com/test-load-balancer/tlb.rb for tests.
|
13
|
+
Detailed documentation is available at http://test-load-balancer.github.com.
|
14
14
|
END
|
15
15
|
POST_INSTALL_MESSAGE = <<END
|
16
16
|
-------------------------------------------------------------------------
|
17
|
-
Documentation: Detailed configuration documentation can be found at
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
TLB Documentation: Detailed configuration documentation can be found at http://test-load-balancer.github.com. Documentation section in this website hosts documentation for every public release.
|
18
|
+
|
19
|
+
-------------------------------------------------------------------------
|
20
|
+
TLB Example(s): We maintain a directory of tlb-enabled dummy projects written in different languages using different testing and build frameworks to help new TLB users get started and provide people a working project to refer to while hooking up TLB on their project(s). Each of these projects have a shell script(named run_balanced.sh) that is meant to demonstrate a typical tlb-enabled build(by starting a local tlb server, and executing two partitions that run dummy tests locally).
|
21
|
+
For demonstration purpose, aforementioned shell script executes partitions in the example-project one after another(serially). However, partitions will be executed parallely on different machines in a real-world setup(hence cutting the build time).
|
22
|
+
We recommend playing with the configuration-variable values being set in the shell-script(s) to understand the effect different values have on load-balancing/reordering behavior. You may want to check http://test-load-balancer.github.com, which links to 'detailed documentation' that covers each configuration variable and explains its purpose, effect and implication.
|
23
|
+
|
24
|
+
Examples archive is released along-with TLB, and is available for download at http://code.google.com/p/tlb/downloads/list.
|
25
|
+
|
26
|
+
To execute the example project, drop into the example project directory(examples/rspec2_example for instance) and invoke the './run_balanced.sh'.
|
27
|
+
|
28
|
+
-------------------------------------------------------------------------
|
29
|
+
TLB Issue Tracker: Please report/port bugs/enhancements/feature-requests on http://code.google.com/p/tlb/issues/list. Github, Rubyforge or any other issue trackers are not monitored or updated.
|
30
|
+
|
23
31
|
-------------------------------------------------------------------------
|
24
32
|
END
|
25
33
|
RUBYFORGE_PROJECT = "tlb-rb"
|
data/lib/tlb.rb
CHANGED
@@ -99,7 +99,7 @@ module Tlb
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def self.tlb_jar
|
102
|
-
File.expand_path(Dir.glob(File.join(root_dir, "tlb-
|
102
|
+
File.expand_path(Dir.glob(File.join(root_dir, "tlb-alien*")).first)
|
103
103
|
end
|
104
104
|
|
105
105
|
def self.server_command
|
@@ -113,7 +113,7 @@ module Tlb
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def self.start_server
|
116
|
-
ENV[TLB_APP] = '
|
116
|
+
ENV[TLB_APP] = 'tlb.balancer.BalancerInitializer'
|
117
117
|
@pid, input, out, err = Open4.popen4(server_command)
|
118
118
|
@out_pumper = stream_pumper_for(out, TLB_OUT_FILE)
|
119
119
|
@err_pumper = stream_pumper_for(err, TLB_ERR_FILE)
|
data/lib/tlb/run_data.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
|
1
2
|
require 'tlb/run_data'
|
2
3
|
|
3
4
|
module Tlb::TestUnit::TestObserver
|
@@ -12,10 +13,10 @@ module Tlb::TestUnit::TestObserver
|
|
12
13
|
test_name.scan(/\((.+)\)$/).flatten.first
|
13
14
|
end
|
14
15
|
end
|
15
|
-
|
16
|
+
|
16
17
|
def register_observers
|
17
18
|
run_data = TestUnitRunData.new
|
18
|
-
|
19
|
+
|
19
20
|
add_listener(Test::Unit::TestResult::FAULT) do |fault|
|
20
21
|
run_data.suite_failed(fault)
|
21
22
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
|
4
|
+
require 'tlb/util'
|
3
5
|
|
4
6
|
class Tlb::TestUnit::TestTask < Rake::TestTask
|
5
7
|
def initialize *args
|
6
8
|
super do |this|
|
7
|
-
this.ruby_opts.unshift " -r#{File.
|
8
|
-
this.ruby_opts.unshift " -r#{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))} "
|
9
|
+
this.ruby_opts.unshift " -r#{Tlb::Util.quote_path(File.dirname(__FILE__), 'mediator_inflection')} "
|
9
10
|
yield this if block_given?
|
10
11
|
end
|
11
12
|
end
|
data/lib/tlb/util.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'tlb'))
|
2
|
+
|
3
|
+
module Tlb::Util
|
4
|
+
def self.quote_path *fragments
|
5
|
+
single_quote(File.expand_path(File.join(*fragments)))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.single_quote arg
|
9
|
+
"'#{arg.gsub(/'/, "\\'")}'"
|
10
|
+
end
|
11
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tlb-testunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Janmejay Singh
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2011-03-05 00:00:00 +05:30
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -51,8 +51,8 @@ dependencies:
|
|
51
51
|
version_requirements: *id002
|
52
52
|
description: |
|
53
53
|
TLB ruby implementation base, which provides support for load balancing tests written in test::unit.
|
54
|
-
|
55
|
-
Detailed
|
54
|
+
TLB.rb test suite is not bundled, please check http://github.com/test-load-balancer/tlb.rb for tests.
|
55
|
+
Detailed documentation is available at http://test-load-balancer.github.com.
|
56
56
|
|
57
57
|
email: singh.janmejay@gmail.com;itspanzi@gmail.com
|
58
58
|
executables: []
|
@@ -75,21 +75,30 @@ files:
|
|
75
75
|
- lib/tlb/test_unit/test_observer.rb
|
76
76
|
- lib/tlb/test_unit/test_splitter.rb
|
77
77
|
- lib/tlb/test_unit/test_task.rb
|
78
|
+
- lib/tlb/util.rb
|
78
79
|
- tlb-rspec2.gemspec
|
79
80
|
- tlb-testunit.gemspec
|
80
|
-
- tlb-
|
81
|
+
- tlb-alien-g0.3.0.jar
|
81
82
|
has_rdoc: true
|
82
|
-
homepage: http://github.com/test-load-balancer/
|
83
|
+
homepage: http://github.com/test-load-balancer/tlb.rb
|
83
84
|
licenses: []
|
84
85
|
|
85
86
|
post_install_message: |
|
86
87
|
-------------------------------------------------------------------------
|
87
|
-
Documentation: Detailed configuration documentation can be found at
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
TLB Documentation: Detailed configuration documentation can be found at http://test-load-balancer.github.com. Documentation section in this website hosts documentation for every public release.
|
89
|
+
|
90
|
+
-------------------------------------------------------------------------
|
91
|
+
TLB Example(s): We maintain a directory of tlb-enabled dummy projects written in different languages using different testing and build frameworks to help new TLB users get started and provide people a working project to refer to while hooking up TLB on their project(s). Each of these projects have a shell script(named run_balanced.sh) that is meant to demonstrate a typical tlb-enabled build(by starting a local tlb server, and executing two partitions that run dummy tests locally).
|
92
|
+
For demonstration purpose, aforementioned shell script executes partitions in the example-project one after another(serially). However, partitions will be executed parallely on different machines in a real-world setup(hence cutting the build time).
|
93
|
+
We recommend playing with the configuration-variable values being set in the shell-script(s) to understand the effect different values have on load-balancing/reordering behavior. You may want to check http://test-load-balancer.github.com, which links to 'detailed documentation' that covers each configuration variable and explains its purpose, effect and implication.
|
94
|
+
|
95
|
+
Examples archive is released along-with TLB, and is available for download at http://code.google.com/p/tlb/downloads/list.
|
96
|
+
|
97
|
+
To execute the example project, drop into the example project directory(examples/rspec2_example for instance) and invoke the './run_balanced.sh'.
|
98
|
+
|
99
|
+
-------------------------------------------------------------------------
|
100
|
+
TLB Issue Tracker: Please report/port bugs/enhancements/feature-requests on http://code.google.com/p/tlb/issues/list. Github, Rubyforge or any other issue trackers are not monitored or updated.
|
101
|
+
|
93
102
|
-------------------------------------------------------------------------
|
94
103
|
|
95
104
|
rdoc_options:
|
@@ -117,9 +126,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
126
|
requirements: []
|
118
127
|
|
119
128
|
rubyforge_project: tlb-rb
|
120
|
-
rubygems_version: 1.
|
129
|
+
rubygems_version: 1.5.2
|
121
130
|
signing_key:
|
122
131
|
specification_version: 3
|
123
|
-
summary: tlb-testunit-0.
|
132
|
+
summary: tlb-testunit-0.3.0
|
124
133
|
test_files: []
|
125
134
|
|
Binary file
|