summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-11-14 10:48:54 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-11-14 10:48:54 -0800
commit70e7e2a56d8b6db36de331df53e9be46252b9fc3 (patch)
treea1a21e3b42b93e5cf397061f707a61de26371bb4
parent4be0cce9900dbfb37487b05171b7137331664e1b (diff)
downloadchef-70e7e2a56d8b6db36de331df53e9be46252b9fc3.tar.gz
skip expensive spec tests by default
- `rake spec` skips knife integration tests - `rake spec:all` includes them - PRs only get `rake spec` - master (and 10/11/12-stable) get `rake spec:all` - rspec and rspec spec are still essentially rake spec:all (so omnibus-chef still tests every spec) - also some cleanup of the rspec jobs
-rw-r--r--.travis.yml10
-rw-r--r--tasks/rspec.rb34
2 files changed, 25 insertions, 19 deletions
diff --git a/.travis.yml b/.travis.yml
index 7e539fd70f..b2b002d8b7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,7 +18,15 @@ branches:
- 11-stable
- 12-stable
-script: bundle exec rspec --color --format progress
+# do not run expensive spec tests on PRs, only on branches
+script: "
+echo '--color\n-fp' > .rspec;
+if [ ${TRAVIS_PULL_REQUEST} = 'false' ];
+then
+ bundle exec rake spec:all;
+else
+ bundle exec rake spec;
+fi"
env:
global:
diff --git a/tasks/rspec.rb b/tasks/rspec.rb
index 95ae274955..a6fc5a9180 100644
--- a/tasks/rspec.rb
+++ b/tasks/rspec.rb
@@ -27,28 +27,16 @@ begin
task :default => :spec
- desc "Run all specs in spec directory"
+ desc "Run standard specs (minus long running specs)"
RSpec::Core::RakeTask.new(:spec) do |t|
- t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/.rspec\""]
- t.pattern = FileList['spec/**/*_spec.rb']
- end
-
- desc "Run all functional specs (in functional/ directory)"
- RSpec::Core::RakeTask.new(:functional) do |t|
- t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""]
- t.pattern = FileList['spec/functional/**/*_spec.rb']
- end
-
- desc "Run the rspec tests with activesupport loaded"
- RSpec::Core::RakeTask.new(:spec_activesupport) do |t|
- t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/.rspec\"", "--require active_support/core_ext"]
- t.pattern = FileList['spec/unit/**/*_spec.rb']
+ # right now this just limits to functional + unit, but could also remove
+ # individual tests marked long-running
+ t.pattern = FileList['spec/{functional,unit}/**/*_spec.rb']
end
namespace :spec do
desc "Run all specs in spec directory with RCov"
RSpec::Core::RakeTask.new(:rcov) do |t|
- t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""]
t.pattern = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = lambda do
@@ -56,16 +44,26 @@ begin
end
end
+ desc "Run all specs in spec directory"
+ RSpec::Core::RakeTask.new(:all) do |t|
+ t.pattern = FileList['spec/**/*_spec.rb']
+ end
+
desc "Print Specdoc for all specs"
RSpec::Core::RakeTask.new(:doc) do |t|
t.rspec_opts = ["--format", "specdoc", "--dry-run"]
t.pattern = FileList['spec/**/*_spec.rb']
end
- [:unit].each do |sub|
+ desc "Run the specs under spec/unit with activesupport loaded"
+ RSpec::Core::RakeTask.new(:activesupport) do |t|
+ t.rspec_opts = ["--require active_support/core_ext"]
+ t.pattern = FileList['spec/unit/**/*_spec.rb']
+ end
+
+ [:unit, :functional, :integration, :stress].each do |sub|
desc "Run the specs under spec/#{sub}"
RSpec::Core::RakeTask.new(sub) do |t|
- t.rspec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""]
t.pattern = FileList["spec/#{sub}/**/*_spec.rb"]
end
end