I was going to post this information here but I think it makes more sense as a discussion.
The idea is that we want a faster test suite and also get to newer rubies.
A concern I have is we have low hanging fruit that doesn’t decrease the readability and increase brittleness of our tests.
-
Find a “good enough” RUBY_GC_MALLOC_LIMIT value and use it on the cruisecontrols and on developers laptops if desired. We can measure how much cpu time we’re spending in GC and I’d imagine it’s in the neighborhood of 33% or more. Tweaking a single env variable might get us under 15% cpu time in GC at the expense of more memory. Pro: the existing tests can remain as is and we might have gain some knowledge we can share for tweaking production appliances at the same time.
-
Get our test suite testable on ruby 2.0/2.1 as they have much better object allocation probes/tracing and will just run faster. Using this information we can backport allocation fixes before we upgrade to those rubies. Pros: We can fix stuff now and also get ready to go to ruby 2.0/2.1. Cons: we don’t have to mock everything to get tests faster. Again, the work on discourse can help us.
-
Re-organize the spec directories, (spec/migrations) is not testable with the other specs as it leaves the DB in a inconsistent state and should be moved to avoid accidentally running it with other specs.
-
Use rspec tags to label slow or integration specs and only run the true unit tests tags locally and in a new project in cruisecontrol.
-
Lastly, try to cut down on database queries in tests by mocking/stubbing and using FactoryGirl.build and SomeModel.new instead of .create where appropriate.