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

log_downstream_pipeline_shared_examples.rb « ci « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c3b9ec4151f95d465137f3f298b900de7111103 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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
    log_entry = record_downstream_pipeline_logs do
      downstream_pipeline
    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: downstream_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