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 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
@@ -1,4 +1,6 @@
1
1
  TAGS
2
2
  tmp
3
3
  tlb_store
4
- tlb-all*.jar
4
+ tlb-*.jar
5
+ .yardoc
6
+ doc
data/README.markdown CHANGED
@@ -1,33 +1,66 @@
1
1
  ## Using tlb_rb:
2
2
 
3
- tlb_rb uses [tlb](https://github.com/test-load-balancer/tlb "TLB") under the hood. It runs a sub-process(java 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 needs to listen to a certain TCP port so that tlb-ruby implementation can talk to it.
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 [https://github.com/test-load-balancer/tlb/wiki/Configuration-Variables](https://github.com/test-load-balancer/tlb/wiki/Configuration-Variables "Tlb config reference")
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, rspec is the only test framework that tlb_rb supports. We plan to add support for other ruby-testing-frameworks soon.
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
- PATH_TO_TLB = File.join(RAILS_ROOT, 'vendor', 'plugins', 'tlb_rb', 'lib', 'tlb')
19
- require PATH_TO_TLB
20
- require File.join(PATH_TO_TLB, 'spec_task')
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 << "--require #{PATH_TO_TLB},#{File.join(PATH_TO_TLB, 'spec_formatter')} --format 'Tlb::SpecFormatter:/dev/null' --format nested"
24
+ t.spec_opts << "--format progress"
25
25
  end
26
-
27
- desc "load balanced spec"
28
- task :run_balanced => ['tlb:start', :balanced_specs]
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
- ## RSpec version compatibility
33
- The branch '__master__' is __RSpec-2.x__ compatible. If you use __RSpec-1__(i.e. __1.3.x__ etc, please use branch named '__rspec-1__'. If you come across any bugs with eiher RSpec-2 or 1 support, please post it as an bug on the issue tracker on github project page.
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-all*.jar").each { |jar| FileUtils.rm(jar) }
18
- sh 'ant -f tlb/build.xml package'
19
- Dir.glob('tlb/target/tlb-all*').each { |file| FileUtils.copy(file, ".") }
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/tlb_rb"
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
- TLB_rb test suite is not bundled, please check http://github.com/test-load-balancer/tlb_rb for tests.
13
- Detailed configuration documentation can be found at https://github.com/test-load-balancer/tlb/wiki.
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 https://github.com/test-load-balancer/tlb/wiki.
18
- -----------------------------
19
- Example: https://github.com/test-load-balancer/sample_projects has examples projects and shell script to demonstrate a typical build(by starting a local tlb server, and executing two partitions locally). While partitions in these examples execute one after another, in an actual CI/pre-checkin build, they will actually run parallely on different machines.
20
- Its a good idea to play with the environment variables values being used in these shell-scripts to understand how they affect TLB's behaviour. You may want to check https://github.com/test-load-balancer/tlb/wiki/Configuration-Variables, which documents each variable and its effect.
21
- -----------------------------
22
- Issue tracker: Please report bugs/enhancements/feature-requests at http://code.google.com/p/tlb/issues/list. Github, Rubyforge or any other issue trackers are not monitored or updated.
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-all*")).first)
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] = 'com.github.tlb.balancer.BalancerInitializer'
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,5 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'tlb'))
2
+
1
3
  module Tlb::RunData
2
4
  class Suite < Struct.new(:identity, :start_time, :end_time, :failed)
3
5
  MILLS_PER_SEC = 1000
@@ -1,3 +1,4 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
1
2
  require 'tlb/test_unit/test_splitter'
2
3
  require 'tlb/test_unit/test_observer'
3
4
  require 'test/unit/ui/testrunnermediator'
@@ -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,3 +1,5 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
2
+
1
3
  module Tlb::TestUnit::TestSplitter
2
4
  def prune_suite
3
5
  name_suite_map = @suite.tests.inject({}) { |map, test| map[test.name] = test; map }
@@ -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.join('tlb', 'test_unit', 'mediator_inflection')} "
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: 25
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
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: 2010-12-22 00:00:00 +05:30
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
- TLB_rb test suite is not bundled, please check http://github.com/test-load-balancer/tlb_rb for tests.
55
- Detailed configuration documentation can be found at https://github.com/test-load-balancer/tlb/wiki.
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-all-gv0.2-9-g1f1a4aa.jar
81
+ - tlb-alien-g0.3.0.jar
81
82
  has_rdoc: true
82
- homepage: http://github.com/test-load-balancer/tlb_rb
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 https://github.com/test-load-balancer/tlb/wiki.
88
- -----------------------------
89
- Example: https://github.com/test-load-balancer/sample_projects has examples projects and shell script to demonstrate a typical build(by starting a local tlb server, and executing two partitions locally). While partitions in these examples execute one after another, in an actual CI/pre-checkin build, they will actually run parallely on different machines.
90
- Its a good idea to play with the environment variables values being used in these shell-scripts to understand how they affect TLB's behaviour. You may want to check https://github.com/test-load-balancer/tlb/wiki/Configuration-Variables, which documents each variable and its effect.
91
- -----------------------------
92
- Issue tracker: Please report bugs/enhancements/feature-requests at http://code.google.com/p/tlb/issues/list. Github, Rubyforge or any other issue trackers are not monitored or updated.
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.3.7
129
+ rubygems_version: 1.5.2
121
130
  signing_key:
122
131
  specification_version: 3
123
- summary: tlb-testunit-0.1.1
132
+ summary: tlb-testunit-0.3.0
124
133
  test_files: []
125
134
 
Binary file