tlb-rspec2 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)
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/reporter'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
2
3
  require 'tlb/rspec/spec_formatter'
3
4
 
4
5
  module Tlb::RSpec::ReporterInflection
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_formatter'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
2
3
  require 'tlb/run_data'
3
4
  require 'stringio'
4
5
 
@@ -1,12 +1,13 @@
1
1
  require 'rspec/core/rake_task'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
3
+ require 'tlb/util'
2
4
 
3
5
  class Tlb::RSpec::SpecTask < RSpec::Core::RakeTask
4
6
  def initialize *args
5
- path_to_tlb = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tlb'))
6
7
  super do |this|
7
8
  yield this if block_given?
8
9
  this.rspec_opts ||= ''
9
- this.rspec_opts = " --require #{path_to_tlb} --require tlb/rspec/reporter_inflection " + this.rspec_opts
10
+ this.rspec_opts = " --require #{Tlb::Util.quote_path(File.dirname(__FILE__), 'reporter_inflection')} " + this.rspec_opts
10
11
  end
11
12
  end
12
13
 
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
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-rspec2
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
@@ -67,8 +67,8 @@ dependencies:
67
67
  version_requirements: *id003
68
68
  description: |
69
69
  TLB ruby implementation base, which provides support for load balancing tests written in rspec-2.x.
70
- TLB_rb test suite is not bundled, please check http://github.com/test-load-balancer/tlb_rb for tests.
71
- Detailed configuration documentation can be found at https://github.com/test-load-balancer/tlb/wiki.
70
+ TLB.rb test suite is not bundled, please check http://github.com/test-load-balancer/tlb.rb for tests.
71
+ Detailed documentation is available at http://test-load-balancer.github.com.
72
72
 
73
73
  email: singh.janmejay@gmail.com;itspanzi@gmail.com
74
74
  executables: []
@@ -90,21 +90,30 @@ files:
90
90
  - lib/tlb/rspec/spec_formatter.rb
91
91
  - lib/tlb/rspec/spec_task.rb
92
92
  - lib/tlb/run_data.rb
93
+ - lib/tlb/util.rb
93
94
  - tlb-rspec2.gemspec
94
95
  - tlb-testunit.gemspec
95
- - tlb-all-gv0.2-9-g1f1a4aa.jar
96
+ - tlb-alien-g0.3.0.jar
96
97
  has_rdoc: true
97
- homepage: http://github.com/test-load-balancer/tlb_rb
98
+ homepage: http://github.com/test-load-balancer/tlb.rb
98
99
  licenses: []
99
100
 
100
101
  post_install_message: |
101
102
  -------------------------------------------------------------------------
102
- Documentation: Detailed configuration documentation can be found at https://github.com/test-load-balancer/tlb/wiki.
103
- -----------------------------
104
- 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.
105
- 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.
106
- -----------------------------
107
- 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.
103
+ 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.
104
+
105
+ -------------------------------------------------------------------------
106
+ 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).
107
+ 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).
108
+ 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.
109
+
110
+ Examples archive is released along-with TLB, and is available for download at http://code.google.com/p/tlb/downloads/list.
111
+
112
+ To execute the example project, drop into the example project directory(examples/rspec2_example for instance) and invoke the './run_balanced.sh'.
113
+
114
+ -------------------------------------------------------------------------
115
+ 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.
116
+
108
117
  -------------------------------------------------------------------------
109
118
 
110
119
  rdoc_options:
@@ -132,9 +141,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
141
  requirements: []
133
142
 
134
143
  rubyforge_project: tlb-rb
135
- rubygems_version: 1.3.7
144
+ rubygems_version: 1.5.2
136
145
  signing_key:
137
146
  specification_version: 3
138
- summary: tlb-rspec2-0.1.1
147
+ summary: tlb-rspec2-0.3.0
139
148
  test_files: []
140
149
 
Binary file