Error when running my unit test...

Hi Rails team

Learning ROR, and is doing the chapter with test..... feel like skipping this, but....

(using NetBeans IDE 6.1)

I have created this story_test.rb, and when I run the 'rake test:units (selected from the GUI), I get this error:

(in /data/NewOrder/Projects/ROR/shovell) ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:clone (first_time) ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge rake aborted! EMULTIHOP (Reserved) /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/ mysql_adapter.rb:471:in `connect' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/ mysql_adapter.rb:165:in `initialize' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/ mysql_adapter.rb:88:in `new' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/ mysql_adapter.rb:88:in `mysql_connection' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ connection_specification.rb:291:in `connection=' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ connection_specification.rb:259:in `retrieve_connection' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ connection_specification.rb:78:in `connection' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rails-2.0.2/lib/tasks/databases.rake:285 /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:546:in `call' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:546:in `execute' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:541:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:541:in `execute' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `synchronize' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:518:in `invoke_prerequisites' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1183:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1183:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:515:in `invoke_prerequisites' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:507:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `synchronize' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:494:in `invoke' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rails-2.0.2/lib/tasks/databases.rake:318 /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:546:in `call' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:546:in `execute' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:541:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:541:in `execute' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `synchronize' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:518:in `invoke_prerequisites' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1183:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1183:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:515:in `invoke_prerequisites' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:507:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `synchronize' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:494:in `invoke' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1931:in `invoke_task' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1909:in `top_level' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1909:in `each' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1909:in `top_level' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1903:in `top_level' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1881:in `run' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/lib/rake.rb:1878:in `run' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rake-0.8.1/bin/rake:31 /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/bin/rake:19:in `load' /home/dk90394/netbeans-6.1/ruby2/jruby-1.1/bin/rake:19

doing the same from the shell gives me this error:

root@dk90394lud:/data/NewOrder/Projects/ROR/shovell# rake test:units -- trace (in /data/NewOrder/Projects/ROR/shovell) ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:clone (first_time) ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge rake aborted! Access denied for user 'root'@'localhost' (using password: NO) /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/mysql_adapter.rb:471:in `real_connect' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/mysql_adapter.rb:471:in `connect' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/mysql_adapter.rb:165:in `initialize' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/mysql_adapter.rb:88:in `new' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/mysql_adapter.rb:88:in `mysql_connection' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:291:in `send' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:291:in `connection=' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:259:in `retrieve_connection' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:78:in `connection' /var/lib/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:285 /usr/lib/ruby/1.8/rake.rb:387:in `call' /usr/lib/ruby/1.8/rake.rb:387:in `execute' /usr/lib/ruby/1.8/rake.rb:387:in `each' /usr/lib/ruby/1.8/rake.rb:387:in `execute' /usr/lib/ruby/1.8/rake.rb:357:in `invoke' /usr/lib/ruby/1.8/rake.rb:350:in `synchronize' /usr/lib/ruby/1.8/rake.rb:350:in `invoke' /usr/lib/ruby/1.8/rake.rb:364:in `invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:1017:in `each' /usr/lib/ruby/1.8/rake.rb:1017:in `send' /usr/lib/ruby/1.8/rake.rb:1017:in `each' /usr/lib/ruby/1.8/rake.rb:363:in `invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:356:in `invoke' /usr/lib/ruby/1.8/rake.rb:350:in `synchronize' /usr/lib/ruby/1.8/rake.rb:350:in `invoke' /var/lib/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:318 /usr/lib/ruby/1.8/rake.rb:387:in `call' /usr/lib/ruby/1.8/rake.rb:387:in `execute' /usr/lib/ruby/1.8/rake.rb:387:in `each' /usr/lib/ruby/1.8/rake.rb:387:in `execute' /usr/lib/ruby/1.8/rake.rb:357:in `invoke' /usr/lib/ruby/1.8/rake.rb:350:in `synchronize' /usr/lib/ruby/1.8/rake.rb:350:in `invoke' /usr/lib/ruby/1.8/rake.rb:364:in `invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:1017:in `each' /usr/lib/ruby/1.8/rake.rb:1017:in `send' /usr/lib/ruby/1.8/rake.rb:1017:in `each' /usr/lib/ruby/1.8/rake.rb:363:in `invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:356:in `invoke' /usr/lib/ruby/1.8/rake.rb:350:in `synchronize' /usr/lib/ruby/1.8/rake.rb:350:in `invoke' /usr/lib/ruby/1.8/rake.rb:1924:in `run' /usr/lib/ruby/1.8/rake.rb:1924:in `each' /usr/lib/ruby/1.8/rake.rb:1924:in `run' /usr/bin/rake:4

Done this as normal user, and as root. Same error.

I guess the problem is 'Access denied for user 'root'@'localhost' (using password: NO)' Now, this is my database.yml:

# And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development:   adapter: mysql   encoding: utf8   database: shovell_development   username: root   password: password   # JRuby doesn't support socket:   host: 127.0.0.1   #socket: /var/run/mysqld/mysqld.sock

I did have problems with creating stuff, in the base, until I gave the password. So this works fine. I can create rows in the table inside the 'shovell_development' db, using my rails app. But not run the rake test:units what is wrong ? Something with the 'db:test:purge' ?

Hope some can give me a clue ? (And yes, I can log in with u:root p:password, and browse the rows, and delete them).

Regards Jørn

Hi Rails team

Learning ROR, and is doing the chapter with test..... feel like skipping this, but....

Now, this is my database.yml:

# And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development:   adapter: mysql   encoding: utf8   database: shovell_development   username: root   password: password   # JRuby doesn't support socket:   host: 127.0.0.1   #socket: /var/run/mysqld/mysqld.sock

I did have problems with creating stuff, in the base, until I gave the password. So this works fine. I can create rows in the table inside the 'shovell_development' db, using my rails app. But not run the rake test:units what is wrong ? Something with the 'db:test:purge' ?

Hope some can give me a clue ? (And yes, I can log in with u:root p:password, and browse the rows, and delete them).

Guess, you are right. That solved the problem (adding the password in the test section, and the host....)

Thanks..

Jørn.