diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-02-27 20:12:28 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-03-04 16:09:38 +0300 |
commit | d9fb27f42ac65b72c92fecdc2a3a292c76e9d7d7 (patch) | |
tree | a4f1acbd2afcb32f673e860fd591b7eed22ae8d2 /spec/lib/gitlab/ci/templates/templates_spec.rb | |
parent | b1ef83914c274fd922290201ba86a4388c24e429 (diff) |
Make serverless template a valid abstract template
Diffstat (limited to 'spec/lib/gitlab/ci/templates/templates_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/templates/templates_spec.rb | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/spec/lib/gitlab/ci/templates/templates_spec.rb b/spec/lib/gitlab/ci/templates/templates_spec.rb index 0dd74399a47..5dad8b1ba92 100644 --- a/spec/lib/gitlab/ci/templates/templates_spec.rb +++ b/spec/lib/gitlab/ci/templates/templates_spec.rb @@ -3,9 +3,40 @@ require 'spec_helper' describe "CI YML Templates" do - Gitlab::Template::GitlabCiYmlTemplate.all.each do |template| - it "#{template.name} should be valid" do - expect { Gitlab::Ci::YamlProcessor.new(template.content) }.not_to raise_error + ABSTRACT_TEMPLATES = %w[Serverless] + + def self.concrete_templates + Gitlab::Template::GitlabCiYmlTemplate.all.reject do |template| + ABSTRACT_TEMPLATES.include?(template.name) + end + end + + def self.abstract_templates + Gitlab::Template::GitlabCiYmlTemplate.all.select do |template| + ABSTRACT_TEMPLATES.include?(template.name) + end + end + + describe 'concrete templates with CI/CD jobs' do + concrete_templates.each do |template| + it "#{template.name} template should be valid" do + expect { Gitlab::Ci::YamlProcessor.new(template.content) } + .not_to raise_error + end + end + end + + describe 'abstract templates without concrete jobs defined' do + abstract_templates.each do |template| + it "#{template.name} template should be valid after being implemented" do + content = template.content + <<~EOS + concrete_build_implemented_by_a_user: + stage: build + script: do something + EOS + + expect { Gitlab::Ci::YamlProcessor.new(content) }.not_to raise_error + end end end end |