Why are my tests failing?


(Jaanus Kase) #1

I am running the standard OS X Vagrant setup as described in Discourse as your first Rails app. The forum is running fine in my machine, I can access it in my browser etc.

When I try to run tests, I seem to get a lot of failures. (I say “seem” because this really is my first Rails app, don’t have much RoR experience.) I do what it tells me in VAGRANT.md:

RAILS_ENV=test bundle exec rake db:drop db:create db:migrate
bundle exec rake autospec p l=5

Here’s the picture that I see:

What gives? I’m expecting it all to be green, I haven’t touched the code or customized the setup.


(Sam Saffron) #2

Ruby 2.0 p0 is hella buggy, why is that being used, honestly if nobody is taking ownership of the vagrant stuff we should nuke it from our source tree.


(Edgibbs) #3

I ran into this same issue tonight, with tons of test failures. I have some free time tomorrow, so I’ll give a shot at getting it working.


(Edgibbs) #4

OK, I used chef solo and updated the discourse recipe for Vagrant to install and use Ruby 2.1. The tests all passed after that. The pull request is:

https://github.com/discourse/discourse/pull/3081

The better fix is probably to update the Vagrant base box, but this should at least get the tests passing.


(Jaanus Kase) #5

It’s not clear how do I get this change to work? When I pulled from discourse master and re-ran the tests, it was still using ruby-2.0.0-p0 and tests were failing. If I removed the vagrant VM and re-installed the VM from scratch, same thing.


(Ronak Jain) #6

Hi,

I have pulled the latest version from Repo, after installing all the dependencies, my rake task db:migrations are failing.

Results:

== 20130801155107 RenameStaffActionPk: migrating ==============================
-- execute("ALTER INDEX admin_logs_pkey RENAME TO staff_action_logs_pkey")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedTable: ERROR:  relation "admin_logs_pkey" does not exist
: ALTER INDEX admin_logs_pkey RENAME TO staff_action_logs_pkey/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `block in log'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:460:in `log'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/Users/ronak/discourse/discourse/db/migrate/20130801155107_rename_staff_action_pk.rb:3:in `up'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:609:in `exec_migration'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/bin/ruby_executable_hooks:15:in `eval'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "admin_logs_pkey" does not exist
: ALTER INDEX admin_logs_pkey RENAME TO staff_action_logs_pkey
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `block in log'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:460:in `log'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/Users/ronak/discourse/discourse/db/migrate/20130801155107_rename_staff_action_pk.rb:3:in `up'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:609:in `exec_migration'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/bin/ruby_executable_hooks:15:in `eval'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/bin/ruby_executable_hooks:15:in `<main>'
PG::UndefinedTable: ERROR:  relation "admin_logs_pkey" does not exist
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `block in log'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:460:in `log'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/Users/ronak/discourse/discourse/db/migrate/20130801155107_rename_staff_action_pk.rb:3:in `up'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:609:in `exec_migration'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/bin/ruby_executable_hooks:15:in `eval'
/Users/ronak/.rvm/gems/ruby-2.1.5@discourse/bin/ruby_executable_hooks:15:in `<main>'

(Edgibbs) #7

Just pulled down current master to a new directory and confirmed that it isn’t switching to the ruby 2.1 rvm ruby. I’m guessing that’s because in my working directory I have a .ruby-version file with that specified in it. Anyway a quick workaround for now is to just issue this command after logging in:

rvm use ruby-2.1.5

When I get home from work tonight I’ll dig in a bit more. I’m also planning on trying to update the actual Vagrant box image so ruby-2.0.0 isn’t even available.


(Jaanus Kase) #8

Thanks, manually running this rvm command makes all the tests pass indeed.

Well, not entirely. Initially there is a lot of green and no failures, differently from what I saw before, so that’s good. But later, I see this. Not sure what it means and if it needs to be addressed, posting just in case.


(Edgibbs) #9

Alright I have a spike working with an updated image hosting the vagrant box from a dropbox url. Currently the image is hosted at:

config.vm.box_url = "https://d3fvb7b7auiut8.cloudfront.net/discourse-0.9.9.13.box"

Is there a place I can push my box when I get done testing it out?


(Edgibbs) #10

I just added a pull request to update the vagrant box (#3093). I used Atlas for now since I don’t have a better place to host the file. This pull request also updates PhantomJS which is the reason the QUnit tests were throw errors.

https://github.com/discourse/discourse/pull/3093