Greetings:
I am using Sqlite3 database with my Rails app. When I try and run “rake
tests” for the app it always fails with the error:
** Invoke default (first_time)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:test:prepare
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Execute db:test:clone
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Invoke test:functionals (first_time)
** Invoke db:test:prepare
** Execute test:functionals
/usr/bin/ruby18 -Ilib:test
“/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb”
“test/functional/dispatcher_controller_test.rb”
Loaded suite
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader Started
E/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/errors.rb:94:in
check': SQL logic error or missing database (SQLite3::SQLException) from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/resultset.rb:76:in
check’
from
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/resultset.rb:68:in
commence' from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/resultset.rb:61:in
initialize’
from
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/statement.rb:158:in
execute' from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:211:in
execute’
from
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:186:in
prepare' from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:210:in
execute’
from
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:620:in
rollback' ... 13 levels... from /usr/lib/ruby/1.8/test/unit/autorunner.rb:200:in
run’
from
/usr/lib/ruby/1.8/test/unit/autorunner.rb:13:in
run' from /usr/lib/ruby/1.8/test/unit.rb:285 from /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5 ** Invoke test:integration (first_time) ** Invoke db:test:prepare ** Execute test:integration /usr/bin/ruby18 -Ilib:test "/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb" rake aborted! Test failures /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/tasks/testing.rake:35 /usr/lib/ruby/site_ruby/1.8/rake.rb:387:in
execute’
/usr/lib/ruby/site_ruby/1.8/rake.rb:387:in
execute' /usr/lib/ruby/site_ruby/1.8/rake.rb:357:in
invoke’
/usr/lib/ruby/1.8/thread.rb:135:in
synchronize' /usr/lib/ruby/site_ruby/1.8/rake.rb:350:in
invoke’
/usr/lib/ruby/site_ruby/1.8/rake.rb:364:in
invoke_prerequisites' /usr/lib/ruby/site_ruby/1.8/rake.rb:999:in
each’
/usr/lib/ruby/site_ruby/1.8/rake.rb:363:in
invoke_prerequisites' /usr/lib/ruby/site_ruby/1.8/rake.rb:356:in
invoke’
/usr/lib/ruby/1.8/thread.rb:135:in
synchronize' /usr/lib/ruby/site_ruby/1.8/rake.rb:350:in
invoke’
/usr/lib/ruby/site_ruby/1.8/rake.rb:1906:in
run' /usr/lib/ruby/site_ruby/1.8/rake.rb:1906:in
run’
/usr/bin/rake:8
I am at a loss on this one. Is anyone else experiencing the same result
using Sqlite3? I am using sqlite3-ruby version 1.1.0 and Sqlite3
version
3.3.5-r1 on a Gentoo linux system. All of the CRUD actions in my
application work just fine, so I don’t know why the tests are bombing
out
with this error. I am using the correct adapter and dbfile in the
database.yml file, so the “missing database” error should not be the
case.
Thanks for your help!
Tyler Morten
I am using Sqlite3 database with my Rails app. When I try and run “rake
tests” for the app it always fails with the error:
First, make sure you have this angle covered. It burned me when I
first starting using sqlite.
http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3
-TJ
First, make sure you have this angle covered. It burned me when I
first starting using sqlite.
http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3
Thanks for the response, TJ. I am using swig from portage on my Gentoo
box, and when I do: $gem install sqlite3-ruby it appears to run make
and
everything builds fine. However, I am still getting the error only when
I test. The rest of the app works fine.
I also tried running all tests from memory by setting the dbfile
“:memory:”, but it still fails. I am wondering if I need to upgrade
from
sqlite3 3.3.5 to 3.3.6. Thoughts?
Tyler
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am using Sqlite3 database with my Rails app. When I try and run
“rake
tests” for the app it always fails with the error:
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader
Started
E/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/
errors.rb:94:in
`check’: SQL logic error or missing database (SQLite3::SQLException)
from
I had a similar problem Tyler, hopefully this will help you…
Go into your `tests/test_helper.rb’ and disable transactional fixtures.
self.use_transactional_fixtures = false
You should now see some errors that are less cyrptic then
‘SQLite3::SQLException’.
Use this information to try and solve your problem.
Myself, I had an error about the tables not existing! A quick hack to
the config/environment.rb
file fixed that…
if ENV[“RAILS_ENV”] == “test”
load “#{RAILS_ROOT}/db/schema.rb”
end
I’ll try and look into this a little deeper later on today.
Hope this helps!
Luke Antins
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEke2cf6ZEiY4w2wYRAsg1AJ9M8pqhvJds2jzzV53YAHKbyx5G9gCfZdU6
k17iTWVdG2PqC/kIeaiHHBo=
=s0li
-----END PGP SIGNATURE-----
if ENV[“RAILS_ENV”] == “test”
load “#{RAILS_ROOT}/db/schema.rb”
end
I’ll try and look into this a little deeper later on today.
Hope this helps!
Luke Antins
Hi Luke,
Thanks for the help. It definitely cleared up the cryptic errors I was
getting. Unfortunately, now it doesn’t like one of my association
tables
and is giving me an error when it tries to create an index about “object
name reserved for internal use”. Which I find hard to believe that one
of my “own” named indexes clashes with something in Sqlite…oh well.
It is strange to me, though, that I can test successfully on other
database platforms. I thought that maybe I was doing something wrong
and
have mis-matched versions of sqlite3 on my computer.
Again, thank you for your help. If you have any more tricks up your
sleeve, let me know. I will also be working on trying to resolve this
and
will let the list know if I come up with anything.
Thanks again,
Tyler Morten
Tyler Morten wrote:
Greetings:
I am using Sqlite3 database with my Rails app. When I try and run “rake
tests” for the app it always fails with the error:
SQL logic error or missing database (SQLite3::SQLException)
I am at a loss on this one.
I have seen the same when I tried to switch to SQLite for testing
(everything was working great on MySQL).
I have found out that the problem was caused by CSV fixtures. When I
changed fixture format for join model (the one I was using with has_many
:through) from CSV to YAML errors went away.
Funny thing is that only the join model fixture was causing troubles.
CSV fixtures for tables used by has_and_belongs_to_many were ok.
Hope this helps.
Regards,
Lukasz (Bragi)
Lukasz,
To my knowledge, I am not using CSV fixtures. It appears that I only
have yaml fixtures…however, I could be mistaken on this, as my
knowledge of Rails testing is fairly limited right now.
It seems I was able to reslove this issue by first disabling
transactional
fixtures in the test_helper.rb file per Luke’s suggestion. Also, I had
to
go into sqlite3 and re-create one of my many-to-many association tables.
I just dropped it and re-created it and then re-generated a few of the
model objects. Everything appears to be working now.
Thank you to everyone who helped on this. It is much appreciated.
Tyler Morten