Branch: refs/heads/fix_sqlite_test_failures Home: https://github.com/OpenGuides/OpenGuides Commit: 99a2139813bb529716474cc930bd17145f5fce0b https://github.com/OpenGuides/OpenGuides/commit/99a2139813bb529716474cc930bd... Author: Niko Tyni ntyni@debian.org Date: 2014-09-14 (Sun, 14 Sep 2014)
Changed paths: M t/109_autocreate.t M t/802_stylesheet.t M t/809_recent_changes_ip_addr.t M t/900_css_category_locale_classes.t M t/901_username_in_templates.t M t/902_node_name_from_cgi_obj.t M t/903_redirect_without_spaces.t M t/904_leaflet.t M t/905_multiple_index.t M t/907_auto_map_link.t M t/908_custom_node_location_search.t M t/909_external_class_metadata.t
Log Message: ----------- Refresh the database before caching a connection handle to it
OpenGuides->new() caches a connection to the SQLite database. When OpenGuides::Test::refresh_db() is called, it removes the database file and reconnects to it. If that happens after OpenGuides->new(), the cached handle becomes read-only as of SQLite 3.8.3. From its changelog:
Add SQLITE_READONLY_DBMOVED error code, returned at the beginning of a transaction, to indicate that the underlying database file has been renamed or moved out from under SQLite.
This causes test failures with error messages like
Unhandled error: [DBD::SQLite::st execute failed: attempt to write a readonly database at /usr/share/perl5/Wiki/Toolkit/Store/Database.pm line 567. ] at /usr/share/perl5/Wiki/Toolkit.pm line 849.
Moving the refresh_db() call earlier fixes these failures.