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 ...@@ -96,18 +96,8 @@ module Packages
architectures.pluck(:name).sort architectures.pluck(:name).sort
end end
def needs_update?
!file.exists? || time_duration_expired?
end
private 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 def unique_codename_and_suite
errors.add(:codename, _('has already been taken as Suite')) if codename_exists_as_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? errors.add(:suite, _('has already been taken as Codename')) if suite_exists_as_codename?
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Packages module Packages
module Debian module Debian
class GenerateDistributionWorker # rubocop:disable Scalability/IdempotentWorker class GenerateDistributionWorker
include ApplicationWorker include ApplicationWorker
data_consistency :always data_consistency :always
......
...@@ -36,7 +36,6 @@ RSpec.describe Packages::Debian::ProcessChangesService do ...@@ -36,7 +36,6 @@ RSpec.describe Packages::Debian::ProcessChangesService do
.to not_change { Packages::Package.count } .to not_change { Packages::Package.count }
.and not_change { Packages::PackageFile.count } .and not_change { Packages::PackageFile.count }
.and not_change { incoming.package_files.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') .and raise_error(Packages::Debian::ExtractChangesMetadataService::ExtractionError, 'is not a changes file')
end end
end end
...@@ -54,7 +53,6 @@ RSpec.describe Packages::Debian::ProcessChangesService do ...@@ -54,7 +53,6 @@ RSpec.describe Packages::Debian::ProcessChangesService do
.to not_change { Packages::Package.count } .to not_change { Packages::Package.count }
.and not_change { Packages::PackageFile.count } .and not_change { Packages::PackageFile.count }
.and not_change { incoming.package_files.count } .and not_change { incoming.package_files.count }
.and not_change { distribution.reload.needs_update? }
.and raise_error(ActiveRecord::ConnectionTimeoutError, 'connect timeout') .and raise_error(ActiveRecord::ConnectionTimeoutError, 'connect timeout')
end end
end end
......
...@@ -193,42 +193,6 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze| ...@@ -193,42 +193,6 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze|
end end
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 if container == :project
describe 'project distribution specifics' do describe 'project distribution specifics' do
describe 'relationships' 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