XPlayer

A blog on my daily efforts to be a better developer, and keep improving every day.

One (and a Half) Useful Thing to Know When Using DeepTest Gem With MySQL

| Comments

DeepTest currently won’t work if you’ve configured MySQL with no password (in other words, if you are able to connect to mysql with a simple “mysql -u root”). To fix this, you have to patch DeepTest (I know, asap I’ll go through the whole process to propose the patch to the original project leader). Actually, you have to comment out a line, in the DeepTest:Database:MysqlSetupListener#grant_privileges method:
...
def grant_privileges(connection)
sql = %{grant all on #{worker_database}.*
to %s@'localhost';} % [
connection.quote(worker_database_config[:username])# ,
# connection.quote(worker_database_config[:password])  <-- mysql with no password won't work
]
connection.execute sql
end
...
Another tip (the “half” in the blog post title): Don’t forget to edit the “pattern” option in your DeepTest rake task, to be able to grab all the testcases you want. In my case, I want to skip a whole folder containing selenium tests, so I have to write my Deep Test rake file this way: (in /lib/tasks/test.rake)
require "deep_test/rake_tasks"
...

DeepTest::TestTask.new "deep" do |t|
t.number_of_workers = 2
t.pattern = "test/{unit,functional,integration}/**/*_test.rb"
t.libs << "test"
t.worker_listener = "DeepTest::Database::MysqlSetupListener"
end