Commit 9d8dca08 authored by Lin Jen-Shin's avatar Lin Jen-Shin
parent 1bc0d732
......@@ -19,6 +19,7 @@ module Ci
acts_as_taggable
before_save :update_artifacts_size, if: :artifacts_file_changed?
before_destroy { project }
after_create :execute_hooks
......@@ -340,7 +341,6 @@ module Ci
def erase_artifacts!
remove_artifacts_file!
remove_artifacts_metadata!
self.artifacts_size = nil
save
end
......@@ -381,6 +381,10 @@ module Ci
private
def update_artifacts_size
self.artifacts_size = artifacts_file.size
end
def erase_trace!
self.trace = nil
end
......
......@@ -147,7 +147,6 @@ module Ci
build.artifacts_file = artifacts
build.artifacts_metadata = metadata
build.artifacts_expire_in = params['expire_in']
build.artifacts_size = artifacts.size
if build.save
present(build, with: Entities::BuildDetails)
......
......@@ -476,13 +476,17 @@ describe Ci::API::API do
describe 'DELETE /builds/:id/artifacts' do
let(:build) { create(:ci_build, :artifacts) }
before { delete delete_url, token: build.token }
before do
delete delete_url, token: build.token
build.reload
end
it 'should remove build artifacts' do
expect(response).to have_http_status(200)
expect(build.artifacts_file.exists?).to be_falsy
expect(build.artifacts_metadata.exists?).to be_falsy
expect(build.artifacts_size).to be_falsy
expect(build.artifacts_size).to eq(0)
end
end
......
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