Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
100 stars 28 forks source link

Tests running twice... #1020

Closed luigi7up closed 9 years ago

luigi7up commented 9 years ago

Hi guys,

I've just noticed that all my tests are running 2 times e.g. https://app.shippable.com/builds/54ce0db29c08c40d00304c31

output in console ->script -> rake says:

rm -rf shippable/testresults
/home/shippable/.rvm/rubies/ruby-2.1.3/bin/ruby -I/home/shippable/.rvm/gems/ruby-2.1.3@[my-gemset]/gems/rspec-core-3.1.2/lib:/home/shippable/.rvm/gems/ruby-2.1.3@[my-gemset]/gems/rspec-support-3.1.0/lib /home/shippable/.rvm/gems/ruby-2.1.3@[my-gemset]/gems/rspec-core-3.1.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Run options:
  include {:focus=>true}
  exclude {:broken=>true}
....
Finished in 10 minutes 11 seconds (files took 22.23 seconds to load)
178 examples, 0 failures, 22 pending

/home/shippable/.rvm/rubies/ruby-2.1.3/bin/ruby -I/home/shippable/.rvm/gems/ruby-2.1.3@[my-gemset]/gems/rspec-core-3.1.2/lib:/home/shippable/.rvm/gems/ruby-2.1.3@[my-gemset]/gems/rspec-support-3.1.0/lib /home/shippable/.rvm/gems/ruby-2.1.3@[my-gemset]/gems/rspec-core-3.1.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Run options:
  include {:focus=>true}
  exclude {:broken=>true}
....
Finished in 7 minutes 5 seconds (files took 28.34 seconds to load)
178 examples, 0 failures, 22 pending

shippable.yml

language: ruby
rvm:
  - 2.1.3
env:
  - CI_REPORTS=shippable/testresults COVERAGE_REPORTS=shippable/codecoverage CAPYBARA_PAGE_PATH=shippable/capybara
archive: true

# if a commit has this: [reset_minion] - will reset the cached container and start over for that build  on a pristine environment
# http://blog.shippable.com/faster-builds-with-cached-containers
cache: true

services:
  - selenium
  # - memcached
  # - redis

addons:
  postgresql: '9.3'
  firefox: "31.0"
  selenium: "2.43"
before_install:
   - rvm rvmrc trust .
before_script:
   # ensure the test output and coverage dirs are created
   - "export DISPLAY=:99.0"
   - "/etc/init.d/xvfb start"
   - mkdir -p shippable/testresults
   - cp config/database.yml.shippable config/database.yml
   # - psql -c 'create database "ria_test";' -U postgres
   - rake db:create RAILS_ENV=test
   - rake db:schema:load RAILS_ENV=test
after_script:
  - "/etc/init.d/xvfb stop"

I have something setup wrong, but I have no clue what might be causing this.

Thank you

rageshkrishna commented 9 years ago

Hi @luigi7up. Does this happen only on Shippable? When you run the tests locally do they just run once?

I found a couple of things that might be helpful in debugging this:

  1. http://stackoverflow.com/questions/15252889/why-is-my-minitest-rake-running-twice-when-i-enter-rake-into-terminal
  2. https://github.com/rspec/rspec-rails/issues/904
luigi7up commented 9 years ago

@rageshkrishna the culprit might be the Rakefile content:

require File.expand_path('../config/application', __FILE__)
MyApp::Application.load_tasks

if Rails.env.test?
  # shippable tests and coverages tabs setup
  require 'ci/reporter/rake/rspec'
  require 'rspec/core/rake_task'
  RSpec::Core::RakeTask.new(:spec => ["ci:setup:rspec"])
  task :default => [:spec]
end

once you suggested to place this into our Rakefile to have the TEST and COVERAGE tabs. Could this be it? I'm pushing as we speak... Might lose the tabs content, though

luigi7up commented 9 years ago

Removing this block it runs once, but we lost TEST tab content, but we don't really need that tab so you can close this issue. thanks

manishas commented 9 years ago

Thanks!