BigW Consortium Gitlab

Commit b097d065 by Grzegorz Bizon

Merge branch '5836-move-lib-ci-into-gitlab-namespace' into 'master'

Resolve "Move `lib/ci` to `lib/gitlab/ci`" Closes #5836 See merge request !14078
parents 373ff978 e83a8187
......@@ -7,11 +7,11 @@ module Ci
def create
@content = params[:content]
@error = Ci::GitlabCiYamlProcessor.validation_message(@content)
@error = Gitlab::Ci::YamlProcessor.validation_message(@content)
@status = @error.blank?
if @error.blank?
@config_processor = Ci::GitlabCiYamlProcessor.new(@content)
@config_processor = Gitlab::Ci::YamlProcessor.new(@content)
@stages = @config_processor.stages
@builds = @config_processor.builds
@jobs = @config_processor.jobs
......
......@@ -132,10 +132,10 @@ class Projects::PipelinesController < Projects::ApplicationController
def charts
@charts = {}
@charts[:week] = Ci::Charts::WeekChart.new(project)
@charts[:month] = Ci::Charts::MonthChart.new(project)
@charts[:year] = Ci::Charts::YearChart.new(project)
@charts[:pipeline_times] = Ci::Charts::PipelineTime.new(project)
@charts[:week] = Gitlab::Ci::Charts::WeekChart.new(project)
@charts[:month] = Gitlab::Ci::Charts::MonthChart.new(project)
@charts[:year] = Gitlab::Ci::Charts::YearChart.new(project)
@charts[:pipeline_times] = Gitlab::Ci::Charts::PipelineTime.new(project)
@counts = {}
@counts[:total] = @project.pipelines.count(:all)
......
......@@ -13,7 +13,7 @@ module BlobViewer
prepare!
@validation_message = Ci::GitlabCiYamlProcessor.validation_message(blob.data)
@validation_message = Gitlab::Ci::YamlProcessor.validation_message(blob.data)
end
def valid?
......
......@@ -446,8 +446,8 @@ module Ci
return unless trace
trace = trace.dup
Ci::MaskSecret.mask!(trace, project.runners_token) if project
Ci::MaskSecret.mask!(trace, token)
Gitlab::Ci::MaskSecret.mask!(trace, project.runners_token) if project
Gitlab::Ci::MaskSecret.mask!(trace, token)
trace
end
......
module Ci
class GroupVariable < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include HasVariable
include Presentable
......
module Ci
class Pipeline < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include HasStatus
include Importable
include AfterCommitQueue
......@@ -336,8 +336,8 @@ module Ci
return @config_processor if defined?(@config_processor)
@config_processor ||= begin
Ci::GitlabCiYamlProcessor.new(ci_yaml_file, project.full_path)
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
Gitlab::Ci::YamlProcessor.new(ci_yaml_file, project.full_path)
rescue Gitlab::Ci::YamlProcessor::ValidationError, Psych::SyntaxError => e
self.yaml_errors = e.message
nil
rescue
......
module Ci
class PipelineSchedule < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include Importable
acts_as_paranoid
......
module Ci
class PipelineScheduleVariable < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include HasVariable
belongs_to :pipeline_schedule
......
module Ci
class PipelineVariable < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include HasVariable
belongs_to :pipeline
......
module Ci
class Runner < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
RUNNER_QUEUE_EXPIRY_TIME = 60.minutes
ONLINE_CONTACT_TIMEOUT = 1.hour
......
module Ci
class RunnerProject < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
belongs_to :runner
belongs_to :project
......
module Ci
class Stage < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include Importable
include HasStatus
include Gitlab::OptimisticLocking
......
module Ci
class Trigger < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
acts_as_paranoid
......
module Ci
class TriggerRequest < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
belongs_to :trigger
belongs_to :pipeline, foreign_key: :commit_id
......
module Ci
class Variable < ActiveRecord::Base
extend Ci::Model
extend Gitlab::Ci::Model
include HasVariable
include Presentable
......
---
title: Move `lib/ci` to `lib/gitlab/ci`
merge_request: 14078
author: Maxim Rydkin
type: other
......@@ -6,7 +6,7 @@ module API
requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
end
post '/lint' do
error = Ci::GitlabCiYamlProcessor.validation_message(params[:content])
error = Gitlab::Ci::YamlProcessor.validation_message(params[:content])
status 200
......
# ANSI color library
#
# Implementation per http://en.wikipedia.org/wiki/ANSI_escape_code
module Ci
module Gitlab
module Ci
module Ansi2html
# keys represent the trailing digit in color changing command (30-37, 40-47, 90-97. 100-107)
COLOR = {
......@@ -328,4 +329,5 @@ module Ci
end
end
end
end
end
module Ci
module Gitlab
module Ci
module Charts
module DailyInterval
def grouped_count(query)
query
.group("DATE(#{Ci::Pipeline.table_name}.created_at)")
.group("DATE(#{::Ci::Pipeline.table_name}.created_at)")
.count(:created_at)
.transform_keys { |date| date.strftime(@format) }
end
......@@ -17,12 +18,12 @@ module Ci
def grouped_count(query)
if Gitlab::Database.postgresql?
query
.group("to_char(#{Ci::Pipeline.table_name}.created_at, '01 Month YYYY')")
.group("to_char(#{::Ci::Pipeline.table_name}.created_at, '01 Month YYYY')")
.count(:created_at)
.transform_keys(&:squish)
else
query
.group("DATE_FORMAT(#{Ci::Pipeline.table_name}.created_at, '01 %M %Y')")
.group("DATE_FORMAT(#{::Ci::Pipeline.table_name}.created_at, '01 %M %Y')")
.count(:created_at)
end
end
......@@ -47,7 +48,7 @@ module Ci
def collect
query = project.pipelines
.where("? > #{Ci::Pipeline.table_name}.created_at AND #{Ci::Pipeline.table_name}.created_at > ?", @to, @from) # rubocop:disable GitlabSecurity/SqlInjection
.where("? > #{::Ci::Pipeline.table_name}.created_at AND #{::Ci::Pipeline.table_name}.created_at > ?", @to, @from) # rubocop:disable GitlabSecurity/SqlInjection
totals_count = grouped_count(query)
success_count = grouped_count(query.success)
......@@ -113,4 +114,5 @@ module Ci
end
end
end
end
end
module Ci::MaskSecret
module Gitlab
module Ci::MaskSecret
class << self
def mask!(value, token)
return value unless value.present? && token.present?
......@@ -7,4 +8,5 @@ module Ci::MaskSecret
value
end
end
end
end
module Ci
module Gitlab
module Ci
module Model
def table_name_prefix
"ci_"
......@@ -8,4 +9,5 @@ module Ci
@model_name ||= ActiveModel::Name.new(self, nil, self.name.split("::").last)
end
end
end
end
......@@ -56,13 +56,13 @@ module Gitlab
end
def html_with_state(state = nil)
::Ci::Ansi2html.convert(stream, state)
::Gitlab::Ci::Ansi2html.convert(stream, state)
end
def html(last_lines: nil)
text = raw(last_lines: last_lines)
buffer = StringIO.new(text)
::Ci::Ansi2html.convert(buffer).html
::Gitlab::Ci::Ansi2html.convert(buffer).html
end
def extract_coverage(regex)
......
module Ci
class GitlabCiYamlProcessor
module Gitlab
module Ci
class YamlProcessor
ValidationError = Class.new(StandardError)
include Gitlab::Ci::Config::Entry::LegacyValidationHelpers
......@@ -73,7 +74,7 @@ module Ci
return 'Please provide content of .gitlab-ci.yml' if content.blank?
begin
Ci::GitlabCiYamlProcessor.new(content)
Gitlab::Ci::YamlProcessor.new(content)
nil
rescue ValidationError, Psych::SyntaxError => e
e.message
......@@ -248,4 +249,5 @@ module Ci
end
end
end
end
end
require 'spec_helper'
describe Ci::Ansi2html do
describe Gitlab::Ci::Ansi2html do
subject { described_class }
it "prints non-ansi as-is" do
......
require 'spec_helper'
describe Ci::Charts do
describe Gitlab::Ci::Charts do
context "pipeline_times" do
let(:project) { create(:project) }
let(:chart) { Ci::Charts::PipelineTime.new(project) }
let(:chart) { Gitlab::Ci::Charts::PipelineTime.new(project) }
subject { chart.pipeline_times }
......
require 'spec_helper'
describe Ci::MaskSecret do
describe Gitlab::Ci::MaskSecret do
subject { described_class }
describe '#mask' do
......
require 'spec_helper'
module Ci
describe GitlabCiYamlProcessor, :lib do
module Gitlab
module Ci
describe YamlProcessor, :lib do
subject { described_class.new(config, path) }
let(:path) { 'path' }
......@@ -212,7 +213,7 @@ module Ci
rspec: { script: "rspec" }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref(type, "master").first).to eq({
......@@ -240,7 +241,7 @@ module Ci
rspec: { script: "rspec", only: ["deploy"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(0)
end
......@@ -251,7 +252,7 @@ module Ci
rspec: { script: "rspec", only: ["/^deploy$/"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(0)
end
......@@ -262,7 +263,7 @@ module Ci
rspec: { script: "rspec", only: ["master"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(1)
end
......@@ -273,7 +274,7 @@ module Ci
rspec: { script: "rspec", type: type, only: %w(master deploy) }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1)
end
......@@ -284,7 +285,7 @@ module Ci
rspec: { script: "rspec", type: type, only: ["branches"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1)
end
......@@ -295,7 +296,7 @@ module Ci
rspec: { script: "rspec", type: type, only: ["tags"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0)
end
......@@ -314,7 +315,7 @@ module Ci
rspec: { script: "rspec", type: type, only: [possibility[:keyword]] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, possibility[:source]).size).to eq(1)
end
......@@ -334,7 +335,7 @@ module Ci
rspec: { script: "rspec", type: type, only: [possibility[:keyword]] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, possibility[:source]).size).to eq(0)
end
......@@ -346,7 +347,7 @@ module Ci
rspec: { script: "rspec", type: type, only: ["branches@path"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1)
end
......@@ -357,7 +358,7 @@ module Ci
rspec: { script: "rspec", type: type, only: ["branches@fork"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0)
end
......@@ -370,7 +371,7 @@ module Ci
production: { script: "deploy", type: "deploy", only: ["master@path", "deploy"] }
})
config_processor = GitlabCiYamlProcessor.new(config, 'fork')
config_processor = Gitlab::Ci::YamlProcessor.new(config, 'fork')
expect(config_processor.builds_for_stage_and_ref("deploy", "deploy").size).to eq(2)
expect(config_processor.builds_for_stage_and_ref("test", "deploy").size).to eq(1)
......@@ -379,13 +380,13 @@ module Ci
context 'for invalid value' do
let(:config) { { rspec: { script: "rspec", type: "test", only: only } } }
let(:processor) { GitlabCiYamlProcessor.new(YAML.dump(config)) }
let(:processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)) }
context 'when it is integer' do
let(:only) { 1 }
it do
expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError,
expect { processor }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'jobs:rspec:only has to be either an array of conditions or a hash')
end
end
......@@ -394,7 +395,7 @@ module Ci
let(:only) { [1, 1] }
it do
expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError,
expect { processor }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'jobs:rspec:only config should be an array of strings or regexps')
end
end
......@@ -403,7 +404,7 @@ module Ci
let(:only) { ["/*invalid/"] }
it do
expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError,
expect { processor }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'jobs:rspec:only config should be an array of strings or regexps')
end
end
......@@ -417,7 +418,7 @@ module Ci
rspec: { script: "rspec", except: ["deploy"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(1)
end
......@@ -428,7 +429,7 @@ module Ci
rspec: { script: "rspec", except: ["/^deploy$/"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(1)
end
......@@ -439,7 +440,7 @@ module Ci
rspec: { script: "rspec", except: ["master"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq(0)
end
......@@ -450,7 +451,7 @@ module Ci
rspec: { script: "rspec", type: type, except: %w(master deploy) }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0)
end
......@@ -461,7 +462,7 @@ module Ci
rspec: { script: "rspec", type: type, except: ["branches"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0)
end
......@@ -472,7 +473,7 @@ module Ci
rspec: { script: "rspec", type: type, except: ["tags"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1)
end
......@@ -491,7 +492,7 @@ module Ci
rspec: { script: "rspec", type: type, except: [possibility[:keyword]] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, possibility[:source]).size).to eq(0)
end
......@@ -511,7 +512,7 @@ module Ci
rspec: { script: "rspec", type: type, except: [possibility[:keyword]] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, possibility[:source]).size).to eq(1)
end
......@@ -523,7 +524,7 @@ module Ci
rspec: { script: "rspec", type: type, except: ["branches@path"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0)
end
......@@ -534,7 +535,7 @@ module Ci
rspec: { script: "rspec", type: type, except: ["branches@fork"] }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1)
end
......@@ -547,7 +548,7 @@ module Ci
production: { script: "deploy", type: "deploy", except: ["master@fork"] }
})
config_processor = GitlabCiYamlProcessor.new(config, 'fork')
config_processor = Gitlab::Ci::YamlProcessor.new(config, 'fork')
expect(config_processor.builds_for_stage_and_ref("deploy", "deploy").size).to eq(2)
expect(config_processor.builds_for_stage_and_ref("test", "test").size).to eq(0)
......@@ -556,13 +557,13 @@ module Ci
context 'for invalid value' do
let(:config) { { rspec: { script: "rspec", except: except } } }
let(:processor) { GitlabCiYamlProcessor.new(YAML.dump(config)) }
let(:processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)) }
context 'when it is integer' do
let(:except) { 1 }
it do
expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError,
expect { processor }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'jobs:rspec:except has to be either an array of conditions or a hash')
end
end
......@@ -571,7 +572,7 @@ module Ci
let(:except) { [1, 1] }
it do
expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError,
expect { processor }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'jobs:rspec:except config should be an array of strings or regexps')
end
end
......@@ -580,7 +581,7 @@ module Ci
let(:except) { ["/*invalid/"] }
it do
expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError,
expect { processor }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'jobs:rspec:except config should be an array of strings or regexps')
end
end
......@@ -590,7 +591,7 @@ module Ci
describe "Scripts handling" do
let(:config_data) { YAML.dump(config) }
let(:config_processor) { GitlabCiYamlProcessor.new(config_data, path) }
let(:config_processor) { Gitlab::Ci::YamlProcessor.new(config_data, path) }
subject { config_processor.builds_for_stage_and_ref("test", "master").first }
......@@ -673,7 +674,7 @@ module Ci
before_script: ["pwd"],
rspec: { script: "rspec" } })
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
......@@ -708,7 +709,7 @@ module Ci
command: ["/usr/local/bin/init", "run"] }, "docker:dind"],
script: "rspec" } })
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
......@@ -741,7 +742,7 @@ module Ci
before_script: ["pwd"],
rspec: { script: "rspec" } })
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
......@@ -770,7 +771,7 @@ module Ci
before_script: ["pwd"],
rspec: { image: "ruby:2.5", services: ["postgresql", "docker:dind"], script: "rspec" } })
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
......@@ -796,7 +797,7 @@ module Ci
end
describe 'Variables' do
let(:config_processor) { GitlabCiYamlProcessor.new(YAML.dump(config), path) }
let(:config_processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(config), path) }
subject { config_processor.builds.first[:yaml_variables] }
......@@ -873,7 +874,7 @@ module Ci
it 'raises error' do
expect { subject }
.to raise_error(GitlabCiYamlProcessor::ValidationError,
.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
/jobs:rspec:variables config should be a hash of key value pairs/)
end
end
......@@ -917,7 +918,7 @@ module Ci
rspec: { script: "rspec", when: when_state }
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
builds = config_processor.builds_for_stage_and_ref("test", "master")
expect(builds.size).to eq(1)
......@@ -933,8 +934,8 @@ module Ci
{ cache: { untracked: true, invalid: 'key' },
rspec: { script: 'rspec' } })
expect { GitlabCiYamlProcessor.new(config) }.to raise_error(
GitlabCiYamlProcessor::ValidationError,
expect { Gitlab::Ci::YamlProcessor.new(config) }.to raise_error(
Gitlab::Ci::YamlProcessor::ValidationError,
'cache config contains unknown keys: invalid'
)
end
......@@ -948,7 +949,7 @@ module Ci
}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = Gitlab::Ci::YamlProcessor.new(config)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq(
......@@ -967,7 +968,7 @@ module Ci
}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = Gitlab::Ci::YamlProcessor.new(config)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq(
......@@ -987,7 +988,7 @@ module Ci
}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = Gitlab::Ci::YamlProcessor.new(config)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq(
......@@ -1016,7 +1017,7 @@ module Ci
}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = Gitlab::Ci::YamlProcessor.new(config)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(1)
expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
......@@ -1054,7 +1055,7 @@ module Ci
}
})
config_processor = GitlabCiYamlProcessor.new(config, path)
config_processor = Gitlab::Ci::YamlProcessor.new(config, path)
builds = config_processor.builds_for_stage_and_ref("test", "master")
expect(builds.size).to eq(1)
......@@ -1070,7 +1071,7 @@ module Ci
}
end
let(:processor) { GitlabCiYamlProcessor.new(YAML.dump(config)) }
let(:processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)) }
let(:builds) { processor.builds_for_stage_and_ref('deploy', 'master') }
context 'when a production environment is specified' do
......@@ -1193,7 +1194,7 @@ module Ci
}
end
subject { GitlabCiYamlProcessor.new(YAML.dump(config)) }
subject { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)) }
context 'no dependencies' do
let(:dependencies) { }
......@@ -1216,18 +1217,18 @@ module Ci
context 'undefined dependency' do
let(:dependencies) { ['undefined'] }
it { expect { subject }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'test1 job: undefined dependency: undefined') }
it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'test1 job: undefined dependency: undefined') }
end
context 'dependencies to deploy' do
let(:dependencies) { ['deploy'] }
it { expect { subject }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'test1 job: dependency deploy is not defined in prior stages') }
it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'test1 job: dependency deploy is not defined in prior stages') }
end
end
describe "Hidden jobs" do
let(:config_processor) { GitlabCiYamlProcessor.new(config) }
let(:config_processor) { Gitlab::Ci::YamlProcessor.new(config) }
subject { config_processor.builds_for_stage_and_ref("test", "master") }
shared_examples 'hidden_job_handling' do
......@@ -1275,7 +1276,7 @@ module Ci
end
describe "YAML Alias/Anchor" do
let(:config_processor) { GitlabCiYamlProcessor.new(config) }
let(:config_processor) { Gitlab::Ci::YamlProcessor.new(config) }
subject { config_processor.builds_for_stage_and_ref("build", "master") }
shared_examples 'job_templates_handling' do
......@@ -1366,284 +1367,284 @@ EOT
describe "Error handling" do
it "fails to parse YAML" do
expect {GitlabCiYamlProcessor.new("invalid: yaml: test")}.to raise_error(Psych::SyntaxError)
expect {Gitlab::Ci::YamlProcessor.new("invalid: yaml: test")}.to raise_error(Psych::SyntaxError)
end
it "indicates that object is invalid" do
expect {GitlabCiYamlProcessor.new("invalid_yaml")}.to raise_error(GitlabCiYamlProcessor::ValidationError)
expect {Gitlab::Ci::YamlProcessor.new("invalid_yaml")}.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError)
end
it "returns errors if tags parameter is invalid" do
config = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec tags should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec tags should be an array of strings")
end
it "returns errors if before_script parameter is invalid" do
config = YAML.dump({ before_script: "bundle update", rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "before_script config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "before_script config should be an array of strings")
end
it "returns errors if job before_script parameter is not an array of strings" do
config = YAML.dump({ rspec: { script: "test", before_script: [10, "test"] } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:before_script config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:before_script config should be an array of strings")
end
it "returns errors if after_script parameter is invalid" do
config = YAML.dump({ after_script: "bundle update", rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "after_script config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "after_script config should be an array of strings")
end
it "returns errors if job after_script parameter is not an array of strings" do
config = YAML.dump({ rspec: { script: "test", after_script: [10, "test"] } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:after_script config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:after_script config should be an array of strings")
end
it "returns errors if image parameter is invalid" do
config = YAML.dump({ image: ["test"], rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "image config should be a hash or a string")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "image config should be a hash or a string")
end
it "returns errors if job name is blank" do
config = YAML.dump({ '' => { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:job name can't be blank")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:job name can't be blank")
end
it "returns errors if job name is non-string" do
config = YAML.dump({ 10 => { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:10 name should be a symbol")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:10 name should be a symbol")
end
it "returns errors if job image parameter is invalid" do
config = YAML.dump({ rspec: { script: "test", image: ["test"] } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:image config should be a hash or a string")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:image config should be a hash or a string")
end
it "returns errors if services parameter is not an array" do
config = YAML.dump({ services: "test", rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services config should be a array")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "services config should be a array")
end
it "returns errors if services parameter is not an array of strings" do
config = YAML.dump({ services: [10, "test"], rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "service config should be a hash or a string")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "service config should be a hash or a string")
end
it "returns errors if job services parameter is not an array" do
config = YAML.dump({ rspec: { script: "test", services: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:services config should be a array")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:services config should be a array")
end
it "returns errors if job services parameter is not an array of strings" do
config = YAML.dump({ rspec: { script: "test", services: [10, "test"] } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "service config should be a hash or a string")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "service config should be a hash or a string")
end
it "returns error if job configuration is invalid" do
config = YAML.dump({ extra: "bundle update" })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:extra config should be a hash")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:extra config should be a hash")
end
it "returns errors if services configuration is not correct" do
config = YAML.dump({ extra: { script: 'rspec', services: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:extra:services config should be a array")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:extra:services config should be a array")
end
it "returns errors if there are no jobs defined" do
config = YAML.dump({ before_script: ["bundle update"] })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs config should contain at least one visible job")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs config should contain at least one visible job")
end
it "returns errors if there are no visible jobs defined" do
config = YAML.dump({ before_script: ["bundle update"], '.hidden'.to_sym => { script: 'ls' } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs config should contain at least one visible job")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs config should contain at least one visible job")
end
it "returns errors if job allow_failure parameter is not an boolean" do
config = YAML.dump({ rspec: { script: "test", allow_failure: "string" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec allow failure should be a boolean value")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec allow failure should be a boolean value")
end
it "returns errors if job stage is not a string" do
config = YAML.dump({ rspec: { script: "test", type: 1 } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:type config should be a string")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:type config should be a string")
end
it "returns errors if job stage is not a pre-defined stage" do
config = YAML.dump({ rspec: { script: "test", type: "acceptance" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end
it "returns errors if job stage is not a defined stage" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", type: "acceptance" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "rspec job: stage parameter should be build, test")
end
it "returns errors if stages is not an array" do
config = YAML.dump({ stages: "test", rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "stages config should be an array of strings")
end
it "returns errors if stages is not an array of strings" do
config = YAML.dump({ stages: [true, "test"], rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "stages config should be an array of strings")
end
it "returns errors if variables is not a map" do
config = YAML.dump({ variables: "test", rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables config should be a hash of key value pairs")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "variables config should be a hash of key value pairs")
end
it "returns errors if variables is not a map of key-value strings" do
config = YAML.dump({ variables: { test: false }, rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables config should be a hash of key value pairs")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "variables config should be a hash of key value pairs")
end
it "returns errors if job when is not on_success, on_failure or always" do
config = YAML.dump({ rspec: { script: "test", when: 1 } })
expect do
GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec when should be on_success, on_failure, always or manual")
Gitlab::Ci::YamlProcessor.new(config, path)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec when should be on_success, on_failure, always or manual")
end
it "returns errors if job artifacts:name is not an a string" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", artifacts: { name: 1 } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:artifacts name should be a string")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:artifacts name should be a string")
end
it "returns errors if job artifacts:when is not an a predefined value" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", artifacts: { when: 1 } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:artifacts when should be on_success, on_failure or always")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:artifacts when should be on_success, on_failure or always")
end
it "returns errors if job artifacts:expire_in is not an a string" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", artifacts: { expire_in: 1 } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:artifacts expire in should be a duration")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:artifacts expire in should be a duration")
end
it "returns errors if job artifacts:expire_in is not an a valid duration" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", artifacts: { expire_in: "7 elephants" } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:artifacts expire in should be a duration")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:artifacts expire in should be a duration")
end
it "returns errors if job artifacts:untracked is not an array of strings" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", artifacts: { untracked: "string" } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:artifacts untracked should be a boolean value")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:artifacts untracked should be a boolean value")
end
it "returns errors if job artifacts:paths is not an array of strings" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", artifacts: { paths: "string" } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:artifacts paths should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:artifacts paths should be an array of strings")
end
it "returns errors if cache:untracked is not an array of strings" do
config = YAML.dump({ cache: { untracked: "string" }, rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "cache:untracked config should be a boolean value")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "cache:untracked config should be a boolean value")
end
it "returns errors if cache:paths is not an array of strings" do
config = YAML.dump({ cache: { paths: "string" }, rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "cache:paths config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "cache:paths config should be an array of strings")
end
it "returns errors if cache:key is not a string" do
config = YAML.dump({ cache: { key: 1 }, rspec: { script: "test" } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "cache:key config should be a string or symbol")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "cache:key config should be a string or symbol")
end
it "returns errors if job cache:key is not an a string" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", cache: { key: 1 } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:cache:key config should be a string or symbol")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:cache:key config should be a string or symbol")
end
it "returns errors if job cache:untracked is not an array of strings" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", cache: { untracked: "string" } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:cache:untracked config should be a boolean value")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:cache:untracked config should be a boolean value")
end
it "returns errors if job cache:paths is not an array of strings" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", cache: { paths: "string" } } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:cache:paths config should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:cache:paths config should be an array of strings")
end
it "returns errors if job dependencies is not an array of strings" do
config = YAML.dump({ types: %w(build test), rspec: { script: "test", dependencies: "string" } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec dependencies should be an array of strings")
Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec dependencies should be an array of strings")
end
end
......@@ -1654,7 +1655,7 @@ EOT
it "does not return errors for #{file}" do
file = File.read(file)
expect { GitlabCiYamlProcessor.new(file) }.not_to raise_error
expect { Gitlab::Ci::YamlProcessor.new(file) }.not_to raise_error
end
end
end
......@@ -1664,7 +1665,7 @@ EOT
it "returns an error about invalid configutaion" do
content = YAML.dump("invalid: yaml: test")
expect(GitlabCiYamlProcessor.validation_message(content))
expect(Gitlab::Ci::YamlProcessor.validation_message(content))
.to eq "Invalid configuration format"
end
end
......@@ -1673,14 +1674,14 @@ EOT
it "returns an error about invalid tags" do
content = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
expect(GitlabCiYamlProcessor.validation_message(content))
expect(Gitlab::Ci::YamlProcessor.validation_message(content))
.to eq "jobs:rspec tags should be an array of strings"
end
end
context "when YAML content is empty" do
it "returns an error about missing content" do
expect(GitlabCiYamlProcessor.validation_message(''))
expect(Gitlab::Ci::YamlProcessor.validation_message(''))
.to eq "Please provide content of .gitlab-ci.yml"
end
end
......@@ -1689,7 +1690,8 @@ EOT
it "does not return any errors" do
content = File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
expect(GitlabCiYamlProcessor.validation_message(content)).to be_nil
expect(Gitlab::Ci::YamlProcessor.validation_message(content)).to be_nil
end
end
end
end
......
......@@ -119,7 +119,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
it 'has no when YML attributes but only the DB column' do
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file).and_return(File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')))
expect_any_instance_of(Ci::GitlabCiYamlProcessor).not_to receive(:build_attributes)
expect_any_instance_of(Gitlab::Ci::YamlProcessor).not_to receive(:build_attributes)
saved_project_json
end
......
......@@ -4,7 +4,7 @@ describe 'ci/lints/show' do
include Devise::Test::ControllerHelpers
describe 'XSS protection' do
let(:config_processor) { Ci::GitlabCiYamlProcessor.new(YAML.dump(content)) }
let(:config_processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(content)) }
before do
assign(:status, true)
assign(:builds, config_processor.builds)
......@@ -59,7 +59,7 @@ describe 'ci/lints/show' do
}
end
let(:config_processor) { Ci::GitlabCiYamlProcessor.new(YAML.dump(content)) }
let(:config_processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(content)) }
context 'when the content is valid' do
before do
......
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