Skip to content
Snippets Groups Projects
Commit bef75b2b authored by Ahmad Tolba's avatar Ahmad Tolba
Browse files

Merge branch '14-6-stable-ee-patch-6' into '14-6-stable-ee'

Prepare 14.6.6-ee release

See merge request gitlab-org/gitlab!81885
parents 124df2ec 51d40420
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -23,6 +23,8 @@ module Import
 
return ServiceResponse.error(message: "#{@params[:url]} is not a valid URL") unless uri
 
return ServiceResponse.success if uri.scheme == 'git'
uri.fragment = nil
url = Gitlab::Utils.append_path(uri.to_s, "/info/refs?service=#{GIT_SERVICE_NAME}")
 
Loading
Loading
Loading
Loading
@@ -95,7 +95,7 @@ module Geo
#
# @return [Boolean] whether the file exists on disk or in remote storage
def file_exists?
carrierwave_uploader.file.exists?
carrierwave_uploader.file&.exists?
end
 
def deleted_params
Loading
Loading
Loading
Loading
@@ -231,4 +231,29 @@ RSpec.shared_examples 'a blob replicator' do
end
end
end
describe '#file_exists?' do
let(:file) { double(exists?: true) }
let(:uploader) { double(file: file) }
subject { replicator.file_exists? }
before do
allow(replicator).to receive(:carrierwave_uploader).and_return(uploader)
end
it { is_expected.to be_truthy }
context 'when the file does not exist' do
let(:file) { double(exists?: false) }
it { is_expected.to be_falsey }
end
context 'when the file is nil' do
let(:file) { nil }
it { is_expected.to be_falsey }
end
end
end
Loading
Loading
@@ -99,6 +99,9 @@ module Gitlab
# ^--+--+- components of hashed storage project path
cmd += %w[-mindepth 6 -maxdepth 6]
 
# Intentionally exclude pipeline artifacts which match the same path
cmd += %w[-not -path */pipelines/*]
# Artifact directories are named on their ID
cmd += %w[-type d]
 
Loading
Loading
Loading
Loading
@@ -34,10 +34,33 @@ RSpec.describe Gitlab::Cleanup::OrphanJobArtifactFiles do
cleanup.run!
end
 
it 'finds artifacts on disk' do
it 'finds job artifacts on disk' do
artifact = create(:ci_job_artifact, :archive)
artifact_directory = artifact.file.relative_path.to_s.split('/')[0...6].join('/')
cleaned = []
expect(cleanup).to receive(:find_artifacts).and_wrap_original do |original_method, *args, &block|
original_method.call(*args) { |dir| cleaned << dir }
end
cleanup.run!
expect(cleaned).to include(/#{artifact_directory}/)
end
it 'does not find pipeline artifacts on disk' do
artifact = create(:ci_pipeline_artifact, :with_coverage_report)
# using 0...6 to match the -min/maxdepth 6 strictly, since this is one directory
# deeper than job artifacts, and .dirname would not match
artifact_directory = artifact.file.relative_path.to_s.split('/')[0...6].join('/')
expect(cleanup).to receive(:find_artifacts).and_wrap_original do |original_method, *args, &block|
# this can either _not_ yield at all, or yield with any other file
# except the one that we're explicitly excluding
original_method.call(*args) { |path| expect(path).not_to match(artifact_directory) }
end
 
expect(cleanup).to receive(:find_artifacts).and_yield(artifact.file.path)
cleanup.run!
end
 
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ RSpec.describe WebHookLog do
let(:hook) { create(:project_hook) }
 
it 'does not return web hook logs that are too old' do
create(:web_hook_log, web_hook: hook, created_at: 91.days.ago)
create(:web_hook_log, web_hook: hook, created_at: 10.days.ago)
 
expect(described_class.recent.size).to be_zero
end
Loading
Loading
Loading
Loading
@@ -24,6 +24,17 @@ RSpec.describe Import::ValidateRemoteGitEndpointService do
expect(Gitlab::HTTP).to have_received(:get).with(endpoint_url, basic_auth: nil, stream_body: true, follow_redirects: false)
end
 
context 'when uri is using git:// protocol' do
subject { described_class.new(url: 'git://demo.host/repo')}
it 'returns success' do
result = subject.execute
expect(result).to be_a(ServiceResponse)
expect(result.success?).to be(true)
end
end
context 'when receiving HTTP response' do
subject { described_class.new(url: base_url) }
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment