[katello-devel] Speeding up tests

Petr Chalupa pchalupa at redhat.com
Thu May 2 07:12:07 UTC 2013



On 30.04.13 21:20, David Davis wrote:
> I wanted to let everyone know about some changes that have been made to our tests to speed them up, mostly since parallel_tests hasn't been working in Travis since bundler 1.3 came out. The first change was breaking up our build in Travis from one job to three. Now when you look at a build in Travis, you should see three separate jobs (rspec, minitest, headpin_rspec). This change allows Travis to run the jobs concurrently and it has reduced the total time from about 25-35 minutes to 14-18 minutes.
>
> The second thing I did was I changed how often garbage collection is happening rspec. Currently rspec is the bottleneck in our build as it takes 15+ minutes to run in Travis. The rspec tests now with deferred garbage collection take about 8-9 minutes to run in Travis. The tradeoff with running garbage collection is that it consumes more memory. Luckily you can easily customize this or turn it off completely based on your own setup.
>
> The first method to change how often garbage collection is being run in rspec is to edit rspec_gc_defer_time and set it to the number of seconds between garbage collections. The second option is to set DEFER_GC on the command line when running rspec:
>
> DEFER_GC=0 rspec spec/controllers/users_controller_spec.rb # disabled, ruby handles garbage collection
> DEFER_GC=10 rspec spec/controllers/users_controller_spec.rb # at least 10 seconds between garbage collections

It can be also set permanently to a value in katello.yml 
`test.rspec_gc_defer_time`. The env variable do not have to be used.

>
> If your computer has more than 4GB of RAM, you should be fine with the default which is 10 (and you should see speeds that are up to 45% faster). Hopefully though, you are not running your entire rspec test suite very often so even if you have less than 4GB, you should be ok (consider letting Travis run your entire test suite though and just run a few files that may be affected by your changes). If you do need to run the entire rspec test suite, consider killing optional processes like your rails server.
>
> If you're like me and you have 16GB of RAM, an 8-core processor, and an SSD in your home computer, you can now run all the rspec tests in under 1 minute with:
>
> DEFER_GC=20 rake parallel:spec
>
> Please give me feedback on this as I think we'll probably need to tweak the defaults over time.
>
> Thanks!
>
> David
>
> _______________________________________________
> katello-devel mailing list
> katello-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/katello-devel
>




More information about the katello-devel mailing list