Rake test tasks only work with --trace

So this has left me completely confused. I’m trying to get the test
suite going on an existing app, but things going a little crazy.

In the application directory if I do ‘rake’ or ‘rake test’ I get:

rake aborted!
Lost connection to MySQL server during query

However if I do ‘rake test:units’ or ‘rake test:functionals’ the tests
run as expected.

Here’s where it gets screwy. In an attempt to figure out what’s going
on, I did ‘rake --trace’ and it ran all the tests fine. However, ‘rake
test --trace’ fails with an error I’ll post below.

It looks to me like the schema dump is running into problems. I just
can’t figure out why it works for some tasks and not other. They all
seem to go through the same db building process.

The app is running with Rails 1.2.2 frozen into vendor/rails.

Jordan
http://jordan.mckible.com

/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:1127:in
write' /dev/myapp/config/../vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:1177:in finalizer’
/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb:324:in
call' /dev/myapp/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb:324:in column’
./db/schema.rb:96
/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:94:in
create_table' /dev/myapp/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:353:in create_table’
/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/migration.rb:275:in
send' /dev/myapp/config/../vendor/rails/activerecord/lib/active_record/migration.rb:275:in method_missing’
/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/migration.rb:259:in
say_with_time' /usr/local/lib/ruby/1.8/benchmark.rb:293:in measure’
/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/migration.rb:259:in
say_with_time' /dev/myapp/config/../vendor/rails/activerecord/lib/active_record/migration.rb:273:in method_missing’
./db/schema.rb:92
/dev/myapp/config/…/vendor/rails/activerecord/lib/active_record/schema.rb:43:in
instance_eval' /dev/myapp/config/../vendor/rails/activerecord/lib/active_record/schema.rb:43:in define’
./db/schema.rb:5
/dev/myapp/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:488:in
load' /dev/myapp/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:488:in load’
/dev/myapp/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:342:in
new_constants_in' /dev/myapp/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:488:in load’
/dev/myapp/config/…/vendor/rails/railties/lib/tasks/databases.rake:31

I’ve run into the same problem a few times before and it always seems
to have something to do with the mysql gem. If you have the mysql gem
installed, try uninstalling it. If you don’t have it installed, try
installing it but watch for errors during the install. I think the
problem occurs when you attempt to install the mysql gem and the build
fails.

Aaron