Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Report files are removed between test suites during "rake test" #2

Closed
kigster opened this Issue · 7 comments

2 participants

Konstantin Gredeskoul Brian Henderson
Konstantin Gredeskoul

Not sure if there is a better way to discuss this, but I am trying to use minitest-ci to generate XML files for Jenkins to consume.

We have a brand new Rails 3.2.3 application and Ruby 1.9.3 and minitest.

When I run "rake test", it actually runs 3 types of tests in our application: models, controllers and integration. It looks like minitest-ci is generating report files, but cleaning them right before moving on to the next set of tests. I was able to get around this by manually adding a cleanup hook to the "test" task, and adding the following to my minitest_helper.rb:

if ENV['CI']
  require 'minitest/ci'
  # stop CI reporter from cleaning generated files for each suite
  module MiniTest
    module Ci
      private
      def clean; end
    end
  end
end

I wonder if there is a better way?

Brian Henderson
Owner

Thanks for reporting this. Github is perfect for issues. I'll take a look as soon as I can and get back to you. Patches are always welcome :)

Brian Henderson bhenderson was assigned
Brian Henderson
Owner

ok, I can't decide. Usually I recommend running all tests together under one ruby process (then clean is only called once). However, I'm starting to wonder if it should never clean and just let everyone implement their own rake task or something. What do you think?

by the way, you did help me catch another bug thanks!

Konstantin Gredeskoul

Thanks for looking into this!

Here is what I propose:

  • keep the default behavior as it currently is for backward compatibility
  • add a global configuration flag that can be set (eg in minitest_helper.rb) to turn off automatic cleanup (eg, MiniTest::Ci.auto_clean = false)
  • expose cleanup functionality via a public rake task and/or public method, so those who want to customize cleanup timing can just call it whenever it's convenient for them.

Thanks!

Brian Henderson bhenderson referenced this issue from a commit
bhenderson Adds ability to disable cleaning report dir. #2 0353fe5
Brian Henderson
Owner

how's that?

Konstantin Gredeskoul

Looks great! Thanks so much for that.

If I was neatpicky I would still prefer to call "disable_clean" variable "auto_clean", because in the current setup even if I set "disable_clean = true", I can still clean manually (in fact I am expected to). So it's not really disabling cleaning, just not automatically cleaning after each run. But like I said, that's just being neat picky :D

Brian Henderson bhenderson referenced this issue from a commit
bhenderson Changes clean switch to positive accessor. #2 cccef9a
Brian Henderson
Owner

whew, finally got around to pushing this. thanks again!

Konstantin Gredeskoul

Awesome thanks! Reviewed :D

Brian Henderson bhenderson closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.