Skip to content

Commit

Permalink
Skip READ COMMITTED isolation test
Browse files Browse the repository at this point in the history
This test sometimes causes the following tests to fail with "TinyTds::Error: DBPROCESS is dead or not enabled" error. Skipping the test
  • Loading branch information
aidanharan committed Nov 7, 2023
1 parent f163e44 commit 877e17b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/cases/transaction_test_sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,12 @@ class TransactionTestSQLServer < ActiveRecord::TestCase
end

describe "when READ_COMMITTED_SNAPSHOT is set" do
before do
it "should use READ COMMITTED as an isolation level" do
skip "This test sometimes causes subsequent tests to fail with error 'DBPROCESS is dead or not enabled'. The test passes if run alone."

connection.execute "ALTER DATABASE [#{connection.current_database}] SET ALLOW_SNAPSHOT_ISOLATION ON"
connection.execute "ALTER DATABASE [#{connection.current_database}] SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK IMMEDIATE"
end

after do
connection.execute "ALTER DATABASE [#{connection.current_database}] SET ALLOW_SNAPSHOT_ISOLATION OFF"
connection.execute "ALTER DATABASE [#{connection.current_database}] SET READ_COMMITTED_SNAPSHOT OFF WITH ROLLBACK IMMEDIATE"
end

it "should use READ COMMITTED as an isolation level" do
_(connection.user_options_isolation_level).must_match "read committed snapshot"

Ship.transaction(isolation: :serializable) do
Expand All @@ -74,6 +69,10 @@ class TransactionTestSQLServer < ActiveRecord::TestCase
# "READ COMMITTED", and that no exception was raised (it's reported back
# by SQL Server as "read committed snapshot").
_(connection.user_options_isolation_level).must_match "read committed snapshot"

ensure
connection.execute "ALTER DATABASE [#{connection.current_database}] SET ALLOW_SNAPSHOT_ISOLATION OFF"
connection.execute "ALTER DATABASE [#{connection.current_database}] SET READ_COMMITTED_SNAPSHOT OFF WITH ROLLBACK IMMEDIATE"
end
end

Expand Down

0 comments on commit 877e17b

Please sign in to comment.