Skip to content

Commit

Permalink
Merge branch 'master' into run_testsuite_with_sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaltom authored Jul 2, 2024
2 parents b772add + d72e38d commit 3c4e67b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
11 changes: 0 additions & 11 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

config.cache_config_file = '/var/lib/rmt/rmt-cache-trim.sh'
config.repo_cache_dir = Rails.root.join('tmp/cache/repository')
config.registry_cache_dir = Rails.root.join('tmp/cache/registry')
cache_config_content = [
"REPOSITORY_CLIENT_CACHE_DIRECTORY=#{config.repo_cache_dir}",
'REPOSITORY_CACHE_EXPIRY_MINUTES=20',
"REGISTRY_CLIENT_CACHE_DIRECTORY=#{config.registry_cache_dir}",
"REGISTRY_CACHE_EXPIRY_MINUTES=#{Settings[:registry].try(:token_expiration) || 480}" # 480: 8 hours in minutes
].join("\n")
File.write(config.cache_config_file, cache_config_content)

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'

Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20240620111456_remove_ltss_7_from_products.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class RemoveLtss7FromProducts < ActiveRecord::Migration[6.1]
def change
products = Product.where(cpe: 'cpe:/o:suse:res-ha-ltss:7')

products.each(&:destroy)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
module InstanceVerification
class Application < Rails::Application
config.cache_config_file = '/var/lib/rmt/rmt-cache-trim.sh'
config.repo_cache_dir = '/run/rmt/cache/repository'
config.repo_cache_dir = Rails.root.join('tmp/cache/repository')
config.registry_cache_dir = Rails.root.join('tmp/cache/registry')
cache_config_content = [
"REPOSITORY_CLIENT_CACHE_DIRECTORY=#{config.repo_cache_dir}",
'REPOSITORY_CACHE_EXPIRY_MINUTES=20'
'REPOSITORY_CACHE_EXPIRY_MINUTES=20',
"REGISTRY_CLIENT_CACHE_DIRECTORY=#{config.registry_cache_dir}",
"REGISTRY_CACHE_EXPIRY_MINUTES=#{Settings[:registry].try(:token_expiration) || 480}" # 480: 8 hours in minutes
].join("\n")
File.write(config.cache_config_file, cache_config_content)
end
Expand Down
2 changes: 1 addition & 1 deletion engines/registry/lib/registry/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Registry
class << self
def remove_auth_cache(registry_cache_key)
cache_path = File.join(Rails.application.config.registry_cache_dir, registry_cache_key)
File.unlink(registry_cache_path) if File.exist?(cache_path)
File.unlink(cache_path) if File.exist?(cache_path)
end
end

Expand Down
4 changes: 2 additions & 2 deletions engines/registry/spec/data/rmt-cache-trim.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REPOSITORY_CLIENT_CACHE_DIRECTORY="/run/rmt/cache/repository"
REPOSITORY_CLIENT_CACHE_DIRECTORY="/usr/share/rmt/tmp/cache/repository"
REPOSITORY_CACHE_EXPIRY_MINUTES=20
REGISTRY_CLIENT_CACHE_DIRECTORY="/run/rmt/cache/registry"
REGISTRY_CLIENT_CACHE_DIRECTORY="/usr/share/rmt/tmp/cache/registry"
REGISTRY_CACHE_EXPIRY_MINUTES=480
18 changes: 10 additions & 8 deletions features/lockfile_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
require File.expand_path('../support/command_rspec_helper', __FILE__)

describe 'rmt-cli' do
before do
`echo long_text_but_not_the_process_id > /tmp/rmt.lock`
`chown _rmt /tmp/rmt.lock`
`/usr/bin/rmt-cli sync > /dev/null &`
end
# kill running process to let further specs pass
after { `pkill -9 -f rmt-cli` }

describe 'lockfile' do

around do |example|
parent_pid = fork do
exec "/usr/bin/rmt-cli sync > /dev/null"
end
example.run
# wait for the parent process to finish, so the lock is released
Process.waitpid(parent_pid)
end

command '/usr/bin/rmt-cli sync', allow_error: true
its(:stderr) do
is_expected.to eq(
Expand Down

0 comments on commit 3c4e67b

Please sign in to comment.