Commit a26ee804 authored by Shinya Maeda's avatar Shinya Maeda

missing the public folder is InvaildStateError

parent b4d9d4db
...@@ -31,7 +31,7 @@ module Projects ...@@ -31,7 +31,7 @@ module Projects
# Check if we did extract public directory # Check if we did extract public directory
archive_public_path = File.join(archive_path, 'public') archive_public_path = File.join(archive_path, 'public')
raise FailedToExtractError, 'pages miss the public folder' unless Dir.exist?(archive_public_path) raise InvaildStateError, 'pages miss the public folder' unless Dir.exist?(archive_public_path)
raise InvaildStateError, 'pages are outdated' unless latest? raise InvaildStateError, 'pages are outdated' unless latest?
deploy_page!(archive_public_path) deploy_page!(archive_public_path)
...@@ -41,6 +41,7 @@ module Projects ...@@ -41,6 +41,7 @@ module Projects
error(e.message) error(e.message)
rescue => e rescue => e
error(e.message, false) error(e.message, false)
raise e
end end
private private
......
...@@ -87,7 +87,8 @@ describe Projects::UpdatePagesService do ...@@ -87,7 +87,8 @@ describe Projects::UpdatePagesService do
it 'fails for empty file fails' do it 'fails for empty file fails' do
build.update_attributes(legacy_artifacts_file: empty_file) build.update_attributes(legacy_artifacts_file: empty_file)
expect(execute).not_to eq(:success) expect { execute }
.to raise_error(Projects::UpdatePagesService::FailedToExtractError)
end end
end end
end end
...@@ -159,7 +160,8 @@ describe Projects::UpdatePagesService do ...@@ -159,7 +160,8 @@ describe Projects::UpdatePagesService do
it 'fails for empty file fails' do it 'fails for empty file fails' do
build.job_artifacts_archive.update_attributes(file: empty_file) build.job_artifacts_archive.update_attributes(file: empty_file)
expect(execute).not_to eq(:success) expect { execute }
.to raise_error(Projects::UpdatePagesService::FailedToExtractError)
end end
context 'when timeout happens by DNS error' do context 'when timeout happens by DNS error' do
...@@ -169,7 +171,7 @@ describe Projects::UpdatePagesService do ...@@ -169,7 +171,7 @@ describe Projects::UpdatePagesService do
end end
it 'raises an error' do it 'raises an error' do
execute expect { execute }.to raise_error(SocketError)
build.reload build.reload
expect(deploy_status).to be_failed expect(deploy_status).to be_failed
...@@ -185,7 +187,8 @@ describe Projects::UpdatePagesService do ...@@ -185,7 +187,8 @@ describe Projects::UpdatePagesService do
end end
it 'raises an error' do it 'raises an error' do
execute expect { execute }
.to raise_error(Projects::UpdatePagesService::FailedToExtractError)
build.reload build.reload
expect(deploy_status).to be_failed expect(deploy_status).to be_failed
...@@ -198,7 +201,7 @@ describe Projects::UpdatePagesService do ...@@ -198,7 +201,7 @@ describe Projects::UpdatePagesService do
allow(build).to receive(:artifacts_metadata?).and_return(false) allow(build).to receive(:artifacts_metadata?).and_return(false)
end end
it 'raises an error' do it 'does not raise an error and remove artifacts as failed job' do
execute execute
build.reload build.reload
......
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