Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-02-05 05:56:16 +0300
committerDylan Griffith <dyl.griffith@gmail.com>2018-02-07 02:09:01 +0300
commit66d41d2c22ca949cb1877818b923109c914dffa9 (patch)
tree8098786d2caaba7b86565ff1465c780fd3f4d4c4 /spec/lib/gitlab/ci/config
parentcf887a8b3108edb715ee5618377f4ffab1824d85 (diff)
Handle all YAML parser exceptions in .gitlab-ci.yml (fixes #41209)
- Move the exception handling as close to the source as possible to avoid leaking Psych ahstraction - Also remove unnecessary rescue all statement from LintsController. This should not be necessary anymore since any YAML errors should all be caught by the #validation_message method.
Diffstat (limited to 'spec/lib/gitlab/ci/config')
-rw-r--r--spec/lib/gitlab/ci/config/loader_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/loader_spec.rb b/spec/lib/gitlab/ci/config/loader_spec.rb
index 2d44b1f60f1..590fc8904c1 100644
--- a/spec/lib/gitlab/ci/config/loader_spec.rb
+++ b/spec/lib/gitlab/ci/config/loader_spec.rb
@@ -38,6 +38,16 @@ describe Gitlab::Ci::Config::Loader do
end
end
+ context 'when there is an unknown alias' do
+ let(:yml) { 'steps: *bad_alias' }
+
+ describe '#initialize' do
+ it 'raises FormatError' do
+ expect { loader }.to raise_error(Gitlab::Ci::Config::Loader::FormatError, 'Unknown alias: bad_alias')
+ end
+ end
+ end
+
context 'when yaml config is empty' do
let(:yml) { '' }