Commit 98bd22a1 authored by David Fernandez's avatar David Fernandez

Merge branch 'debian_unused' into 'master'

Remove unused Debian distribution methods

See merge request gitlab-org/gitlab!71502
parents fe07d8c4 d29da52c
......@@ -96,18 +96,8 @@ module Packages
architectures.pluck(:name).sort
end
def needs_update?
!file.exists? || time_duration_expired?
end
private
def time_duration_expired?
return false unless valid_time_duration_seconds.present?
updated_at + valid_time_duration_seconds.seconds + 6.hours < Time.current
end
def unique_codename_and_suite
errors.add(:codename, _('has already been taken as Suite')) if codename_exists_as_suite?
errors.add(:suite, _('has already been taken as Codename')) if suite_exists_as_codename?
......
......@@ -2,7 +2,7 @@
module Packages
module Debian
class GenerateDistributionWorker # rubocop:disable Scalability/IdempotentWorker
class GenerateDistributionWorker
include ApplicationWorker
data_consistency :always
......
......@@ -36,7 +36,6 @@ RSpec.describe Packages::Debian::ProcessChangesService do
.to not_change { Packages::Package.count }
.and not_change { Packages::PackageFile.count }
.and not_change { incoming.package_files.count }
.and not_change { distribution.reload.needs_update? }
.and raise_error(Packages::Debian::ExtractChangesMetadataService::ExtractionError, 'is not a changes file')
end
end
......@@ -54,7 +53,6 @@ RSpec.describe Packages::Debian::ProcessChangesService do
.to not_change { Packages::Package.count }
.and not_change { Packages::PackageFile.count }
.and not_change { incoming.package_files.count }
.and not_change { distribution.reload.needs_update? }
.and raise_error(ActiveRecord::ConnectionTimeoutError, 'connect timeout')
end
end
......
......@@ -193,42 +193,6 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze|
end
end
describe '#needs_update?' do
subject { distribution.needs_update? }
context 'with new distribution' do
let(:distribution) { create(factory, container: distribution_with_suite.container) }
it { is_expected.to be_truthy }
end
context 'with file' do
context 'without valid_time_duration_seconds' do
let(:distribution) { create(factory, :with_file, container: distribution_with_suite.container) }
it { is_expected.to be_falsey }
end
context 'with valid_time_duration_seconds' do
let(:distribution) { create(factory, :with_file, container: distribution_with_suite.container, valid_time_duration_seconds: 2.days.to_i) }
context 'when not yet expired' do
it { is_expected.to be_falsey }
end
context 'when expired' do
it do
distribution
travel_to(4.days.from_now) do
is_expected.to be_truthy
end
end
end
end
end
end
if container == :project
describe 'project distribution specifics' do
describe 'relationships' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment