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

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

require 'spec_helper'

describe Gitlab::Prometheus::Queries::AdditionalMetricsDeploymentQuery do
  around do |example|
    Timecop.freeze(Time.local(2008, 9, 1, 12, 0, 0)) { example.run }
  end

  include_examples 'additional metrics query' do
    let(:project) { create(:project, :repository) }
    let(:deployment) { create(:deployment, environment: environment, project: project) }
    let(:query_params) { [deployment.id] }

    it 'queries using specific time' do
      expect(client).to receive(:query_range).with(anything,
                                                   start_time: (deployment.created_at - 30.minutes).to_f,
                                                   end_time: (deployment.created_at + 30.minutes).to_f)

      expect(query_result).not_to be_nil
    end
  end
end