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

runner_shared_examples.rb « ci « api « lib « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bdb0316bf5abcfec2e84706ba6e67feca2b17fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

RSpec.shared_examples 'API::CI::Runner application context metadata' do |api_route|
  it 'contains correct context metadata' do
    # Avoids popping the context from the thread so we can
    # check its content after the request.
    allow(Labkit::Context).to receive(:pop)

    send_request

    Labkit::Context.with_context do |context|
      expected_context = {
        'meta.caller_id' => api_route,
        'meta.user' => job.user.username,
        'meta.project' => job.project.full_path,
        'meta.root_namespace' => job.project.full_path_components.first
      }

      expect(context.to_h).to include(expected_context)
    end
  end
end