From 4b73d41be6436e3eb92d86340aed08dbce1f63cf Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Fri, 8 Apr 2011 16:06:31 -0700 Subject: maint: Fix sporadic sqlite error ActiveRecord::StatementInvalid: SQLite3::IOException: disk I/O error This happened if you ran these tests in the following order since Rails wasn't disconnecting between tests. rspec spec/unit/indirector/facts/inventory_active_record_spec.rb spec/unit/indirector/node/active_record_spec.rb Paired-with: Nick Lewis --- spec/unit/indirector/facts/inventory_active_record_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 9558abde2..538aa5f47 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -29,6 +29,7 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r after :each do Puppet::Rails.teardown + ActiveRecord::Base.remove_connection end describe "#save" do -- cgit From 23c9663d2142b9c674257fd47952d5e58c8ca7a7 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Fri, 8 Apr 2011 16:05:41 -0700 Subject: maint: Fix sqlite3 require to really be optional You need to specifically rescue LoadError if you want requires to be optional. Paired-with: Nick Lewis --- spec/unit/indirector/facts/inventory_active_record_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 538aa5f47..022150c76 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -1,7 +1,10 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../../spec_helper' -require 'sqlite3' rescue nil +begin + require 'sqlite3' +rescue LoadError +end require 'tempfile' require 'puppet/rails' -- cgit