summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb
index 687bb82a8ef..f7774e199fb 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user, developer_projects: [project]) }
- let(:seeds_block) { }
+ let(:seeds_block) {}
let(:command) { initialize_command }
let(:pipeline) { build(:ci_pipeline, project: project) }
@@ -205,6 +205,30 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end
end
+ describe '#rule_variables' do
+ let(:config) do
+ {
+ variables: { VAR1: 11 },
+ workflow: {
+ rules: [{ if: '$CI_PIPELINE_SOURCE',
+ variables: { SYMBOL: :symbol, STRING: "string", INTEGER: 1 } },
+ { when: 'always' }]
+ },
+ rspec: { script: 'rake' }
+ }
+ end
+
+ let(:rspec_variables) { command.pipeline_seed.stages[0].statuses[0].variables.to_hash }
+
+ it 'correctly parses rule variables' do
+ run_chain
+
+ expect(rspec_variables['SYMBOL']).to eq("symbol")
+ expect(rspec_variables['STRING']).to eq("string")
+ expect(rspec_variables['INTEGER']).to eq("1")
+ end
+ end
+
context 'N+1 queries' do
it 'avoids N+1 queries when calculating variables of jobs', :use_sql_query_cache do
warm_up_pipeline, warm_up_command = prepare_pipeline1