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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 03:09:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 03:09:24 +0300
commit2711c26beaca6c3a5a3be4b65e01557faf0185b6 (patch)
tree25d0c2ddb47e87712044884f558a9104c686805f /spec/lib/gitlab
parent8a7aaf86831d2a556578ae558a4fcab8bb659b20 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb4
-rw-r--r--spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb6
-rw-r--r--spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb10
-rw-r--r--spec/lib/gitlab/prometheus/queries/knative_invocation_query_spec.rb2
-rw-r--r--spec/lib/gitlab/prometheus_client_spec.rb8
5 files changed, 15 insertions, 15 deletions
diff --git a/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb b/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
index 15edc649702..55e89395452 100644
--- a/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
+++ b/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
@@ -14,8 +14,8 @@ describe Gitlab::Prometheus::Queries::AdditionalMetricsDeploymentQuery do
it 'queries using specific time' do
expect(client).to receive(:query_range).with(anything,
- start: (deployment.created_at - 30.minutes).to_f,
- stop: (deployment.created_at + 30.minutes).to_f)
+ 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
diff --git a/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb b/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
index 35dbdd55cfa..95df8880b90 100644
--- a/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
+++ b/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
@@ -12,7 +12,7 @@ describe Gitlab::Prometheus::Queries::AdditionalMetricsEnvironmentQuery do
it 'queries using specific time' do
expect(client).to receive(:query_range)
- .with(anything, start: 8.hours.ago.to_f, stop: Time.now.to_f)
+ .with(anything, start_time: 8.hours.ago.to_f, end_time: Time.now.to_f)
expect(query_result).not_to be_nil
end
@@ -25,7 +25,7 @@ describe Gitlab::Prometheus::Queries::AdditionalMetricsEnvironmentQuery do
it 'queries using the provided times' do
expect(client).to receive(:query_range)
- .with(anything, start: start_time, stop: end_time)
+ .with(anything, start_time: start_time, end_time: end_time)
expect(query_result).not_to be_nil
end
end
@@ -36,7 +36,7 @@ describe Gitlab::Prometheus::Queries::AdditionalMetricsEnvironmentQuery do
it 'queries using the provided times converted to unix' do
expect(client).to receive(:query_range)
- .with(anything, start: start_time.to_f, stop: end_time.to_f)
+ .with(anything, start_time: start_time.to_f, end_time: end_time.to_f)
expect(query_result).not_to be_nil
end
end
diff --git a/spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb b/spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb
index d82b7665f85..4af233291f6 100644
--- a/spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb
+++ b/spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb
@@ -16,22 +16,22 @@ describe Gitlab::Prometheus::Queries::DeploymentQuery do
it 'sends appropriate queries to prometheus' do
start_time = (deployment.created_at - 30.minutes).to_f
- stop_time = (deployment.created_at + 30.minutes).to_f
+ end_time = (deployment.created_at + 30.minutes).to_f
created_at = deployment.created_at.to_f
expect(client).to receive(:query_range).with('avg(container_memory_usage_bytes{container_name!="POD",environment="environment-slug"}) / 2^20',
- start: start_time, stop: stop_time)
+ start_time: start_time, end_time: end_time)
expect(client).to receive(:query).with('avg(avg_over_time(container_memory_usage_bytes{container_name!="POD",environment="environment-slug"}[30m]))',
time: created_at)
expect(client).to receive(:query).with('avg(avg_over_time(container_memory_usage_bytes{container_name!="POD",environment="environment-slug"}[30m]))',
- time: stop_time)
+ time: end_time)
expect(client).to receive(:query_range).with('avg(rate(container_cpu_usage_seconds_total{container_name!="POD",environment="environment-slug"}[2m])) * 100',
- start: start_time, stop: stop_time)
+ start_time: start_time, end_time: end_time)
expect(client).to receive(:query).with('avg(rate(container_cpu_usage_seconds_total{container_name!="POD",environment="environment-slug"}[30m])) * 100',
time: created_at)
expect(client).to receive(:query).with('avg(rate(container_cpu_usage_seconds_total{container_name!="POD",environment="environment-slug"}[30m])) * 100',
- time: stop_time)
+ time: end_time)
expect(subject.query(deployment.id)).to eq(memory_values: nil, memory_before: nil, memory_after: nil,
cpu_values: nil, cpu_before: nil, cpu_after: nil)
diff --git a/spec/lib/gitlab/prometheus/queries/knative_invocation_query_spec.rb b/spec/lib/gitlab/prometheus/queries/knative_invocation_query_spec.rb
index ad254d3c50a..8eefd22bd29 100644
--- a/spec/lib/gitlab/prometheus/queries/knative_invocation_query_spec.rb
+++ b/spec/lib/gitlab/prometheus/queries/knative_invocation_query_spec.rb
@@ -22,7 +22,7 @@ describe Gitlab::Prometheus::Queries::KnativeInvocationQuery do
it 'has the query, but no data' do
expect(client).to receive(:query_range).with(
'sum(ceil(rate(istio_requests_total{destination_service_namespace="test-ns", destination_service=~"test-name.*"}[1m])*60))',
- hash_including(:start, :stop)
+ hash_including(:start_time, :end_time)
)
subject.query(serverless_func.id)
diff --git a/spec/lib/gitlab/prometheus_client_spec.rb b/spec/lib/gitlab/prometheus_client_spec.rb
index 4f9315e28e9..5eb133a5bf4 100644
--- a/spec/lib/gitlab/prometheus_client_spec.rb
+++ b/spec/lib/gitlab/prometheus_client_spec.rb
@@ -193,23 +193,23 @@ describe Gitlab::PrometheusClient do
let(:time_stop) { Time.now.in_time_zone("Warsaw") }
let(:time_start) { time_stop - 8.hours }
- let(:query_url) { prometheus_query_range_url(prometheus_query, start: time_start.utc.to_f, stop: time_stop.utc.to_f) }
+ let(:query_url) { prometheus_query_range_url(prometheus_query, start_time: time_start.utc.to_f, end_time: time_stop.utc.to_f) }
it 'passed dates are properly converted to utc' do
req_stub = stub_prometheus_request(query_url, body: prometheus_values_body('vector'))
- subject.query_range(prometheus_query, start: time_start, stop: time_stop)
+ subject.query_range(prometheus_query, start_time: time_start, end_time: time_stop)
expect(req_stub).to have_been_requested
end
end
context 'when a start time is passed' do
- let(:query_url) { prometheus_query_range_url(prometheus_query, start: 2.hours.ago) }
+ let(:query_url) { prometheus_query_range_url(prometheus_query, start_time: 2.hours.ago) }
it 'passed it in the requested URL' do
req_stub = stub_prometheus_request(query_url, body: prometheus_values_body('vector'))
- subject.query_range(prometheus_query, start: 2.hours.ago)
+ subject.query_range(prometheus_query, start_time: 2.hours.ago)
expect(req_stub).to have_been_requested
end
end