Please review pull request #709: Add ability to log spec test order to a file opened by (cprice-puppet)

Description:

This commit tweaks the spec_helper to give it the
ability to log the spec test order to a file. It
will only log the order if you have set the
environment variable "LOG_SPEC_ORDER", e.g.:

LOG_SPEC_ORDER=true rspec spec

This will be useful when using Nick L.'s bisect
script to identify order-dependent spec failures.
It should probably be enabled on all of our
Jenkins jobs, and would potentially allow us to
start running them with the random order flag
enabled.

  • Opened: Wed Apr 25 01:14:55 UTC 2012
  • Based on: puppetlabs:master (91284f5b1ad83b6a1bf9d8ff58e5db359d04f375)
  • Requested merge: cprice-puppet:feature/master/log_spec_order (db0b27b52f60bf8cd2e7678009bbd00467b5f5ba)

Diff follows:

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 7eac863..18f9a936 100755
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -101,4 +101,15 @@ module PuppetSpec
     # just letting it run all the time.
     GC.enable
   end
+
+  config.after :suite do
+    # Log the spec order to a file, but only if the LOG_SPEC_ORDER environment variable is
+    #  set.  This should be enabled on Jenkins runs, as it can be used with Nick L.'s bisect
+    #  script to help identify and debug order-dependent spec failures.
+    if ENV['LOG_SPEC_ORDER']
+      File.open("./spec_order.txt", "w") do |logfile|
+        config.instance_variable_get(:@files_to_run).each { |f| logfile.puts f }
+      end
+    end
+  end
 end

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to