Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testsuite with sqlite3 #1081

Merged
merged 10 commits into from
Feb 12, 2024
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please view our [guide](docs/installation.md) to assist you in the RMT installat

1. Install the system dependencies:
```
sudo zypper in libxml2-devel libxslt-devel libmariadb-devel gcc
sudo zypper in libxml2-devel libxslt-devel libmariadb-devel sqlite3-devel gcc
```
2. Install the ruby version specified in the `.ruby-version` [file](.ruby-version).
3. Install and setup the database:
Expand Down
5 changes: 4 additions & 1 deletion lib/rmt/lockfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ class RMT::Lockfile

class << self
def lock(lock_name = nil)
yield and return if ActiveRecord::Base.connection.adapter_name != 'Mysql2'
if ActiveRecord::Base.connection.adapter_name != 'Mysql2'
yield
return
end

lock_name = ['rmt-cli', lock_name].compact.join('-')

Expand Down
4 changes: 4 additions & 0 deletions spec/support/cli_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ def silence_stdout
def file_human_size(size_in_bytes)
ActiveSupport::NumberHelper.number_to_human_size(size_in_bytes)
end

def running_mysql
ActiveRecord::Base.connection.adapter_name == 'Mysql2'
end
2 changes: 1 addition & 1 deletion spec/support/shared_examples/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

shared_examples 'handles lockfile exception' do
context 'with existing lockfile' do
context 'with existing lockfile', if: running_mysql do
before do
allow(RMT::Lockfile).to receive(:obtain_lock).and_return(false)
end
Expand Down
Loading