summaryrefslogtreecommitdiff
path: root/tasks/rspec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-04-27 11:30:24 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2020-04-27 11:30:24 -0700
commit75730dec1e797d23356c20c81a7566ac6e52c368 (patch)
treecc170265556f581118dc15ac651b794bb7091c6a /tasks/rspec.rb
parent7322308da2f96acb01a494152c2ccc6ced90715b (diff)
downloadchef-75730dec1e797d23356c20c81a7566ac6e52c368.tar.gz
Logging consistency fixes.lcg/chef-16-logging-fixed
- The doc formatter is now Chef::Config[:log_location]-aware and will log to files as well - There is now consistency where doc formatter output never surprisingly changes to log formatter based on destination - The "cli" log_location and the "config" log_location are now treated separately, so a log_location in the client.rb will always force output to a logfile, in addition to output to STDOUT if necessary - The logic around STDOUT is now simplified, if its open we log to it, if its closed we don't, if you're daemonized we assume you're capturing STDOUT via your process manager - The log_location variables are now Arrays Things not done: - The cli can't specify an array, it would be nice to support an accumulator pattern here. Would also need to support disabling STDOUT logging though. - Using the syslog or winevt logging devices requires the use of the logger, which precludes using the formatter. - Some people may want to have log-formatter style output to the log file and doc formatter style output to STDOUT which is not very possible right now. Right now we are consistent in that you get either the logger both places or the formatter both places. This use case is complicated by the fact that they will want :info level logging for the logger, but :warn level logging for the doc formatter and that is another global. - To do that latter thing right would probably require sending log messages to the formatter, and supporting a different log level in the formatter vs. the logger and then supporting the STDOUT/cli loggging being the formatter, while the log_location/config logging being the logger. Those were way out of scope for what I could get done for Chef-16. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'tasks/rspec.rb')
-rw-r--r--tasks/rspec.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/tasks/rspec.rb b/tasks/rspec.rb
index 03e0b1df05..99b3563788 100644
--- a/tasks/rspec.rb
+++ b/tasks/rspec.rb
@@ -41,39 +41,31 @@ begin
task spec: :component_specs
- desc "Run standard specs (minus long running specs)"
+ desc "Run all specs in spec directory"
RSpec::Core::RakeTask.new(:spec) do |t|
+ t.verbose = false
t.rspec_opts = %w{--profile}
- # right now this just limits to functional + unit, but could also remove
- # individual tests marked long-running
t.pattern = FileList["spec/**/*_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 = %w{--profile}
- t.pattern = FileList["spec/**/*_spec.rb"]
- t.rcov = true
- t.rcov_opts = lambda do
- IO.readlines("#{CHEF_ROOT}/spec/rcov.opts").map { |l| l.chomp.split " " }.flatten
- end
- end
-
desc "Run all specs in spec directory"
RSpec::Core::RakeTask.new(:all) do |t|
+ t.verbose = false
t.rspec_opts = %w{--profile}
t.pattern = FileList["spec/**/*_spec.rb"]
end
desc "Print Specdoc for all specs"
RSpec::Core::RakeTask.new(:doc) do |t|
+ t.verbose = false
t.rspec_opts = %w{--format specdoc --dry-run --profile}
t.pattern = FileList["spec/**/*_spec.rb"]
end
desc "Run the specs under spec/unit with activesupport loaded"
RSpec::Core::RakeTask.new(:activesupport) do |t|
+ t.verbose = false
t.rspec_opts = %w{--require active_support/core_ext --profile}
# Only node_spec and role_spec specifically have issues, target those tests
t.pattern = FileList["spec/unit/node_spec.rb", "spec/unit/role_spec.rb"]