Commit c1903a84 authored by Roger Rüttimann's avatar Roger Rüttimann

fix loging and move test from project to job_artifacts

parent 346c786d
Pipeline #53647281 failed with stages
in 68 minutes and 33 seconds
......@@ -34,7 +34,7 @@ module Ci
return false if artifacts.empty?
Rails.logger.info "Removing artifacts with ids #{artifacts.collect(&:id)}..."
log_info "Removing artifacts with ids #{artifacts.collect(&:id)}..."
artifacts.each(&:destroy!)
end
......
......@@ -49,6 +49,25 @@ describe Ci::JobArtifact do
end
end
describe '.orphaned' do
let(:project) { create(:project, :repository, public_builds: false) }
let(:pipeline_deleted_branch) { create(:ci_empty_pipeline, project: project) }
let(:pipeline_master) { create(:ci_empty_pipeline, project: project) }
let!(:job_deleted_branch) { create(:ci_build, :artifacts, pipeline: pipeline_deleted_branch, ref: 'deleted_branch') }
let!(:job_master) { create(:ci_build, :artifacts, pipeline: pipeline_master, ref: 'master') }
before do
allow(project.repository).to receive(:ref_names).and_return(['master'])
end
subject { described_class.orphaned(100, project).to_a }
it 'selects the jobs of the deleted branches' do
is_expected.to match_array(job_deleted_branch.job_artifacts)
end
end
describe 'callbacks' do
subject { create(:ci_job_artifact, :archive) }
......
......@@ -4688,24 +4688,6 @@ describe Project do
end
end
describe '#orphaned_builds' do
let(:project) { create(:project, :repository, public_builds: false) }
let(:pipeline_deleted_branch) { create(:ci_empty_pipeline, project: project) }
let(:pipeline_master) { create(:ci_empty_pipeline, project: project) }
let!(:job_deleted_branch) { create(:ci_build, :artifacts, pipeline: pipeline_deleted_branch, ref: 'deleted_branch') }
let!(:job_master) { create(:ci_build, :artifacts, pipeline: pipeline_master, ref: 'master') }
before do
allow(project.repository).to receive(:ref_names).and_return(['master'])
end
subject { project.orphaned_builds }
it 'selects the jobs of the deleted branches' do
is_expected.to eq([job_deleted_branch])
end
end
describe '#has_pool_repsitory?' do
it 'returns false when it does not have a pool repository' do
subject = create(:project, :repository)
......
......@@ -364,7 +364,7 @@ describe API::Jobs do
end
end
describe 'DELETE /projects/artifacts/clean' do
describe 'DELETE /projects/artifacts' do
let(:pipeline_deleted_branch) { create(:ci_empty_pipeline, project: project) }
let(:pipeline_master) { create(:ci_empty_pipeline, project: project) }
let!(:job_deleted_branch) {create(:ci_build, :artifacts, pipeline: pipeline_deleted_branch, ref: 'deleted_branches') }
......
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