Make sure that artifacts_file is nullified after removing artifacts
This commit is contained in:
parent
faee4763f7
commit
d63673d6df
2 changed files with 13 additions and 0 deletions
|
@ -341,6 +341,7 @@ module Ci
|
||||||
def erase_artifacts!
|
def erase_artifacts!
|
||||||
remove_artifacts_file!
|
remove_artifacts_file!
|
||||||
remove_artifacts_metadata!
|
remove_artifacts_metadata!
|
||||||
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
def erase(opts = {})
|
def erase(opts = {})
|
||||||
|
|
|
@ -20,6 +20,10 @@ describe ExpireBuildArtifactsWorker do
|
||||||
it 'does remove files' do
|
it 'does remove files' do
|
||||||
expect(build.reload.artifacts_file.exists?).to be_falsey
|
expect(build.reload.artifacts_file.exists?).to be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does nullify artifacts_file column' do
|
||||||
|
expect(build.reload.artifacts_file_identifier).to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with not yet expired artifacts' do
|
context 'with not yet expired artifacts' do
|
||||||
|
@ -32,6 +36,10 @@ describe ExpireBuildArtifactsWorker do
|
||||||
it 'does not remove files' do
|
it 'does not remove files' do
|
||||||
expect(build.reload.artifacts_file.exists?).to be_truthy
|
expect(build.reload.artifacts_file.exists?).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not nullify artifacts_file column' do
|
||||||
|
expect(build.reload.artifacts_file_identifier).not_to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'without expire date' do
|
context 'without expire date' do
|
||||||
|
@ -44,6 +52,10 @@ describe ExpireBuildArtifactsWorker do
|
||||||
it 'does not remove files' do
|
it 'does not remove files' do
|
||||||
expect(build.reload.artifacts_file.exists?).to be_truthy
|
expect(build.reload.artifacts_file.exists?).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not nullify artifacts_file column' do
|
||||||
|
expect(build.reload.artifacts_file_identifier).not_to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for expired artifacts' do
|
context 'for expired artifacts' do
|
||||||
|
|
Loading…
Reference in a new issue