diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/support/shared_examples/ci | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/support/shared_examples/ci')
-rw-r--r-- | spec/support/shared_examples/ci/log_downstream_pipeline_shared_examples.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/support/shared_examples/ci/log_downstream_pipeline_shared_examples.rb b/spec/support/shared_examples/ci/log_downstream_pipeline_shared_examples.rb new file mode 100644 index 00000000000..db724dcfe99 --- /dev/null +++ b/spec/support/shared_examples/ci/log_downstream_pipeline_shared_examples.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'logs downstream pipeline creation' do + def record_downstream_pipeline_logs + logs = [] + allow(::Gitlab::AppLogger).to receive(:info) do |args| + logs << args + end + + yield + + logs.find { |log| log[:message] == "downstream pipeline created" } + end + + it 'logs details' do + pipeline = nil + + log_entry = record_downstream_pipeline_logs do + pipeline = subject + end + + expect(log_entry).to be_present + expect(log_entry).to eq( + message: "downstream pipeline created", + class: described_class.name, + root_pipeline_id: expected_root_pipeline.id, + downstream_pipeline_id: pipeline.id, + downstream_pipeline_relationship: expected_downstream_relationship, + hierarchy_size: expected_hierarchy_size, + root_pipeline_plan: expected_root_pipeline.project.actual_plan_name, + root_pipeline_namespace_path: expected_root_pipeline.project.namespace.full_path, + root_pipeline_project_path: expected_root_pipeline.project.full_path) + end +end |