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:
-rw-r--r--.gitlab/issue_templates/Bug.md1
-rw-r--r--app/assets/javascripts/commit/pipelines/pipelines_table.vue2
-rw-r--r--app/assets/javascripts/logs/stores/actions.js4
-rw-r--r--app/assets/javascripts/monitoring/stores/actions.js12
-rw-r--r--app/controllers/projects/logs_controller.rb2
-rw-r--r--app/models/application_setting.rb10
-rw-r--r--app/services/pod_logs/elasticsearch_service.rb10
-rw-r--r--app/services/prometheus/proxy_service.rb12
-rw-r--r--app/services/prometheus/proxy_variable_substitution_service.rb11
-rw-r--r--app/validators/untrusted_regexp_validator.rb12
-rw-r--r--changelogs/unreleased/fix_bug_issue_template_markdown_handling.yml5
-rw-r--r--doc/administration/geo/replication/external_database.md2
-rw-r--r--doc/user/analytics/value_stream_analytics.md3
-rw-r--r--lib/gitlab/prometheus/queries/deployment_query.rb4
-rw-r--r--lib/gitlab/prometheus/queries/environment_query.rb4
-rw-r--r--lib/gitlab/prometheus/queries/knative_invocation_query.rb2
-rw-r--r--lib/gitlab/prometheus/queries/matched_metric_query.rb2
-rw-r--r--lib/gitlab/prometheus/queries/query_additional_metrics.rb2
-rw-r--r--lib/gitlab/prometheus_client.rb20
-rw-r--r--locale/gitlab.pot3
-rw-r--r--qa/qa/resource/project.rb3
-rw-r--r--qa/qa/runtime/env.rb7
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb22
-rw-r--r--qa/spec/runtime/env_spec.rb6
-rw-r--r--spec/frontend/commit/pipelines/pipelines_spec.js (renamed from spec/javascripts/commit/pipelines/pipelines_spec.js)40
-rw-r--r--spec/frontend/logs/stores/actions_spec.js8
-rw-r--r--spec/frontend/monitoring/store/actions_spec.js4
-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
-rw-r--r--spec/models/application_setting_spec.rb2
-rw-r--r--spec/services/pod_logs/elasticsearch_service_spec.rb20
-rw-r--r--spec/support/helpers/prometheus_helpers.rb18
35 files changed, 176 insertions, 107 deletions
diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md
index 0d9990657e4..037f83c93d2 100644
--- a/.gitlab/issue_templates/Bug.md
+++ b/.gitlab/issue_templates/Bug.md
@@ -45,6 +45,7 @@ logs, and code as it's tough to read otherwise.)
<details>
<summary>Expand for output related to GitLab environment info</summary>
+
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
diff --git a/app/assets/javascripts/commit/pipelines/pipelines_table.vue b/app/assets/javascripts/commit/pipelines/pipelines_table.vue
index 6b0d184faec..cd9aea85f4d 100644
--- a/app/assets/javascripts/commit/pipelines/pipelines_table.vue
+++ b/app/assets/javascripts/commit/pipelines/pipelines_table.vue
@@ -156,7 +156,7 @@ export default {
<gl-loading-icon
v-if="isLoading"
:label="s__('Pipelines|Loading Pipelines')"
- :size="3"
+ size="lg"
class="prepend-top-20"
/>
diff --git a/app/assets/javascripts/logs/stores/actions.js b/app/assets/javascripts/logs/stores/actions.js
index 834462573cc..1e71b2c7314 100644
--- a/app/assets/javascripts/logs/stores/actions.js
+++ b/app/assets/javascripts/logs/stores/actions.js
@@ -46,8 +46,8 @@ const requestLogsUntilData = state => {
if (state.timeRange.current) {
try {
const { start, end } = convertToFixedRange(state.timeRange.current);
- params.start = start;
- params.end = end;
+ params.start_time = start;
+ params.end_time = end;
} catch {
flashTimeRangeWarning();
}
diff --git a/app/assets/javascripts/monitoring/stores/actions.js b/app/assets/javascripts/monitoring/stores/actions.js
index 7d0d37c1a20..7ea43d57039 100644
--- a/app/assets/javascripts/monitoring/stores/actions.js
+++ b/app/assets/javascripts/monitoring/stores/actions.js
@@ -86,8 +86,8 @@ export const fetchDashboard = ({ state, commit, dispatch }) => {
if (state.timeRange) {
const { start, end } = convertToFixedRange(state.timeRange);
- params.start = start;
- params.end = end;
+ params.start_time = start;
+ params.end_time = end;
}
if (state.currentDashboard) {
@@ -139,16 +139,16 @@ function fetchPrometheusResult(prometheusEndpoint, params) {
* @param {metric} metric
*/
export const fetchPrometheusMetric = ({ commit }, { metric, params }) => {
- const { start, end } = params;
- const timeDiff = (new Date(end) - new Date(start)) / 1000;
+ const { start_time, end_time } = params;
+ const timeDiff = (new Date(end_time) - new Date(start_time)) / 1000;
const minStep = 60;
const queryDataPoints = 600;
const step = Math.max(minStep, Math.ceil(timeDiff / queryDataPoints));
const queryParams = {
- start,
- end,
+ start_time,
+ end_time,
step,
};
diff --git a/app/controllers/projects/logs_controller.rb b/app/controllers/projects/logs_controller.rb
index d598171e92c..ba509235417 100644
--- a/app/controllers/projects/logs_controller.rb
+++ b/app/controllers/projects/logs_controller.rb
@@ -48,7 +48,7 @@ module Projects
end
def elasticsearch_params
- params.permit(:container_name, :pod_name, :search, :start, :end, :cursor)
+ params.permit(:container_name, :pod_name, :search, :start_time, :end_time, :cursor)
end
def environment
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 481e1807a78..3d55269e36f 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -257,7 +257,7 @@ class ApplicationSetting < ApplicationRecord
validates :snippet_size_limit, numericality: { only_integer: true, greater_than: 0 }
- validate :email_restrictions_regex_valid?
+ validates :email_restrictions, untrusted_regexp: true
SUPPORTED_KEY_TYPES.each do |type|
validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type }
@@ -411,14 +411,6 @@ class ApplicationSetting < ApplicationRecord
recaptcha_enabled || login_recaptcha_protection_enabled
end
- def email_restrictions_regex_valid?
- return if email_restrictions.blank?
-
- Gitlab::UntrustedRegexp.new(email_restrictions)
- rescue RegexpError
- errors.add(:email_restrictions, _('is not a valid regular expression'))
- end
-
private
def parsed_grafana_url
diff --git a/app/services/pod_logs/elasticsearch_service.rb b/app/services/pod_logs/elasticsearch_service.rb
index 11862de4ade..0a5185999ab 100644
--- a/app/services/pod_logs/elasticsearch_service.rb
+++ b/app/services/pod_logs/elasticsearch_service.rb
@@ -16,7 +16,7 @@ module PodLogs
private
def valid_params
- super + %w(search start end cursor)
+ super + %w(search start_time end_time cursor)
end
def success_return_keys
@@ -24,8 +24,8 @@ module PodLogs
end
def check_times(result)
- result[:start] = params['start'] if params.key?('start') && Time.iso8601(params['start'])
- result[:end] = params['end'] if params.key?('end') && Time.iso8601(params['end'])
+ result[:start_time] = params['start_time'] if params.key?('start_time') && Time.iso8601(params['start_time'])
+ result[:end_time] = params['end_time'] if params.key?('end_time') && Time.iso8601(params['end_time'])
success(result)
rescue ArgumentError
@@ -53,8 +53,8 @@ module PodLogs
pod_name: result[:pod_name],
container_name: result[:container_name],
search: result[:search],
- start_time: result[:start],
- end_time: result[:end],
+ start_time: result[:start_time],
+ end_time: result[:end_time],
cursor: result[:cursor]
)
diff --git a/app/services/prometheus/proxy_service.rb b/app/services/prometheus/proxy_service.rb
index 3585c90fc8f..99c739a630b 100644
--- a/app/services/prometheus/proxy_service.rb
+++ b/app/services/prometheus/proxy_service.rb
@@ -114,11 +114,23 @@ module Prometheus
end
def filter_params(params, path)
+ params = substitute_params(params)
+
params.slice(*PROXY_SUPPORT.dig(path, :params))
end
def can_proxy?
PROXY_SUPPORT.dig(@path, :method)&.include?(@method)
end
+
+ def substitute_params(params)
+ start_time = params[:start_time]
+ end_time = params[:end_time]
+
+ params['start'] = start_time if start_time
+ params['end'] = end_time if end_time
+
+ params
+ end
end
end
diff --git a/app/services/prometheus/proxy_variable_substitution_service.rb b/app/services/prometheus/proxy_variable_substitution_service.rb
index b34afaf80b8..240586c8419 100644
--- a/app/services/prometheus/proxy_variable_substitution_service.rb
+++ b/app/services/prometheus/proxy_variable_substitution_service.rb
@@ -6,6 +6,7 @@ module Prometheus
steps :validate_variables,
:add_params_to_result,
+ :substitute_params,
:substitute_ruby_variables,
:substitute_liquid_variables
@@ -35,6 +36,16 @@ module Prometheus
success(result)
end
+ def substitute_params(result)
+ start_time = result[:params][:start_time]
+ end_time = result[:params][:end_time]
+
+ result[:params][:start] = start_time if start_time
+ result[:params][:end] = end_time if end_time
+
+ success(result)
+ end
+
def substitute_liquid_variables(result)
return success(result) unless query(result)
diff --git a/app/validators/untrusted_regexp_validator.rb b/app/validators/untrusted_regexp_validator.rb
new file mode 100644
index 00000000000..02ed7dfb4ed
--- /dev/null
+++ b/app/validators/untrusted_regexp_validator.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class UntrustedRegexpValidator < ActiveModel::EachValidator
+ def validate_each(record, attribute, value)
+ return unless value
+
+ Gitlab::UntrustedRegexp.new(value)
+
+ rescue RegexpError => e
+ record.errors.add(attribute, "not valid RE2 syntax: #{e.message}")
+ end
+end
diff --git a/changelogs/unreleased/fix_bug_issue_template_markdown_handling.yml b/changelogs/unreleased/fix_bug_issue_template_markdown_handling.yml
new file mode 100644
index 00000000000..1bc198f7f0b
--- /dev/null
+++ b/changelogs/unreleased/fix_bug_issue_template_markdown_handling.yml
@@ -0,0 +1,5 @@
+---
+title: Fix bug issue template handling of markdown
+merge_request: 27808
+author: Lee Tickett
+type: fixed
diff --git a/doc/administration/geo/replication/external_database.md b/doc/administration/geo/replication/external_database.md
index 210c3a77128..ca6acfc01c8 100644
--- a/doc/administration/geo/replication/external_database.md
+++ b/doc/administration/geo/replication/external_database.md
@@ -196,7 +196,7 @@ the tracking database on port 5432.
GEO_DB_PORT="5432"
query_exec () {
- gitlab-psql -h $GEO_DB_HOST -d $GEO_DB_NAME -p $GEO_DB_PORT -c "${1}"
+ gitlab-psql -h $GEO_DB_HOST -U $GEO_DB_USER -d $GEO_DB_NAME -p $GEO_DB_PORT -c "${1}"
}
query_exec "CREATE EXTENSION postgres_fdw;"
diff --git a/doc/user/analytics/value_stream_analytics.md b/doc/user/analytics/value_stream_analytics.md
index b7c8fe633df..ade415ffb37 100644
--- a/doc/user/analytics/value_stream_analytics.md
+++ b/doc/user/analytics/value_stream_analytics.md
@@ -162,6 +162,9 @@ to customize their Value Stream Analytics.
GitLab allows users to hide default stages and create custom stages that align better to their
development workflow.
+NOTE: **Note:**
+Customizability is [only available for group-level](https://gitlab.com/gitlab-org/gitlab/-/issues/35823#note_272558950) Value Stream Analytics.
+
### Adding a stage
In the following example we're creating a new stage that measures and tracks issues from creation
diff --git a/lib/gitlab/prometheus/queries/deployment_query.rb b/lib/gitlab/prometheus/queries/deployment_query.rb
index fc32c4353f0..13d85d33cc0 100644
--- a/lib/gitlab/prometheus/queries/deployment_query.rb
+++ b/lib/gitlab/prometheus/queries/deployment_query.rb
@@ -18,11 +18,11 @@ module Gitlab
timeframe_end = (deployment.created_at + 30.minutes).to_f
{
- memory_values: client_query_range(memory_query, start: timeframe_start, stop: timeframe_end),
+ memory_values: client_query_range(memory_query, start_time: timeframe_start, end_time: timeframe_end),
memory_before: client_query(memory_avg_query, time: deployment.created_at.to_f),
memory_after: client_query(memory_avg_query, time: timeframe_end),
- cpu_values: client_query_range(cpu_query, start: timeframe_start, stop: timeframe_end),
+ cpu_values: client_query_range(cpu_query, start_time: timeframe_start, end_time: timeframe_end),
cpu_before: client_query(cpu_avg_query, time: deployment.created_at.to_f),
cpu_after: client_query(cpu_avg_query, time: timeframe_end)
}
diff --git a/lib/gitlab/prometheus/queries/environment_query.rb b/lib/gitlab/prometheus/queries/environment_query.rb
index 56195f85a70..5f3093eecd4 100644
--- a/lib/gitlab/prometheus/queries/environment_query.rb
+++ b/lib/gitlab/prometheus/queries/environment_query.rb
@@ -15,9 +15,9 @@ module Gitlab
cpu_query = raw_cpu_usage_query(environment_slug)
{
- memory_values: client_query_range(memory_query, start: timeframe_start, stop: timeframe_end),
+ memory_values: client_query_range(memory_query, start_time: timeframe_start, end_time: timeframe_end),
memory_current: client_query(memory_query, time: timeframe_end),
- cpu_values: client_query_range(cpu_query, start: timeframe_start, stop: timeframe_end),
+ cpu_values: client_query_range(cpu_query, start_time: timeframe_start, end_time: timeframe_end),
cpu_current: client_query(cpu_query, time: timeframe_end)
}
end
diff --git a/lib/gitlab/prometheus/queries/knative_invocation_query.rb b/lib/gitlab/prometheus/queries/knative_invocation_query.rb
index abc90bad9c3..6438995b576 100644
--- a/lib/gitlab/prometheus/queries/knative_invocation_query.rb
+++ b/lib/gitlab/prometheus/queries/knative_invocation_query.rb
@@ -29,7 +29,7 @@ module Gitlab
def run_query(query, context)
query %= context
- client_query_range(query, start: 8.hours.ago.to_f, stop: Time.now.to_f)
+ client_query_range(query, start_time: 8.hours.ago.to_f, end_time: Time.now.to_f)
end
def self.transform_reactive_result(result)
diff --git a/lib/gitlab/prometheus/queries/matched_metric_query.rb b/lib/gitlab/prometheus/queries/matched_metric_query.rb
index 32294756aa2..e4d44df3baf 100644
--- a/lib/gitlab/prometheus/queries/matched_metric_query.rb
+++ b/lib/gitlab/prometheus/queries/matched_metric_query.rb
@@ -43,7 +43,7 @@ module Gitlab
series = metric_groups.flat_map(&:metrics).flat_map(&:required_metrics).uniq
lookup = series.each_slice(MAX_QUERY_ITEMS).flat_map do |batched_series|
- client_series(*batched_series, start: timeframe_start, stop: timeframe_end)
+ client_series(*batched_series, start_time: timeframe_start, end_time: timeframe_end)
.select(&method(:has_matching_label?))
.map { |series_info| [series_info['__name__'], true] }
end
diff --git a/lib/gitlab/prometheus/queries/query_additional_metrics.rb b/lib/gitlab/prometheus/queries/query_additional_metrics.rb
index 1bab2ae7d75..a5e7d0ac9d5 100644
--- a/lib/gitlab/prometheus/queries/query_additional_metrics.rb
+++ b/lib/gitlab/prometheus/queries/query_additional_metrics.rb
@@ -59,7 +59,7 @@ module Gitlab
result =
if query.key?(:query_range)
query[:query_range] %= context
- client_query_range(query[:query_range], start: context[:timeframe_start], stop: context[:timeframe_end])
+ client_query_range(query[:query_range], start_time: context[:timeframe_start], end_time: context[:timeframe_end])
else
query[:query] %= context
client_query(query[:query], time: context[:timeframe_end])
diff --git a/lib/gitlab/prometheus_client.rb b/lib/gitlab/prometheus_client.rb
index 9fefffefcde..12de20a2c37 100644
--- a/lib/gitlab/prometheus_client.rb
+++ b/lib/gitlab/prometheus_client.rb
@@ -47,17 +47,17 @@ module Gitlab
end
end
- def query_range(query, start: 8.hours.ago, stop: Time.now)
- start = start.to_f
- stop = stop.to_f
- step = self.class.compute_step(start, stop)
+ def query_range(query, start_time: 8.hours.ago, end_time: Time.now)
+ start_time = start_time.to_f
+ end_time = end_time.to_f
+ step = self.class.compute_step(start_time, end_time)
get_result('matrix') do
json_api_get(
'query_range',
query: query,
- start: start,
- end: stop,
+ start: start_time,
+ end: end_time,
step: step
)
end
@@ -67,12 +67,12 @@ module Gitlab
json_api_get("label/#{name}/values")
end
- def series(*matches, start: 8.hours.ago, stop: Time.now)
- json_api_get('series', 'match': matches, start: start.to_f, end: stop.to_f)
+ def series(*matches, start_time: 8.hours.ago, end_time: Time.now)
+ json_api_get('series', 'match': matches, start: start_time.to_f, end: end_time.to_f)
end
- def self.compute_step(start, stop)
- diff = stop - start
+ def self.compute_step(start_time, end_time)
+ diff = end_time - start_time
step = (diff / QUERY_RANGE_DATA_POINTS).ceil
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 1293c610d38..28b568ae8a2 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -23939,9 +23939,6 @@ msgstr ""
msgid "is not a valid X509 certificate."
msgstr ""
-msgid "is not a valid regular expression"
-msgstr ""
-
msgid "is not allowed for sign-up"
msgstr ""
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index 62e55e18e9b..cb047f81d02 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -8,6 +8,7 @@ module QA
include Events::Project
include Members
+ attr_accessor :repository_storage # requires admin access
attr_writer :initialize_with_readme
attr_writer :auto_devops_enabled
attr_writer :visibility
@@ -116,6 +117,8 @@ module QA
post_body[:path] = name
end
+ post_body[:repository_storage] = repository_storage if repository_storage
+
post_body
end
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index 1c947b0329f..722648857ea 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -15,7 +15,8 @@ module QA
# supports the given feature
SUPPORTED_FEATURES = {
git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2',
- admin: 'QA_CAN_TEST_ADMIN_FEATURES'
+ admin: 'QA_CAN_TEST_ADMIN_FEATURES',
+ praefect: 'QA_CAN_TEST_PRAEFECT'
}.freeze
def supported_features
@@ -26,6 +27,10 @@ module QA
ENV['QA_ADDITIONAL_REPOSITORY_STORAGE']
end
+ def praefect_repository_storage
+ ENV['QA_PRAEFECT_REPOSITORY_STORAGE']
+ end
+
def admin_password
ENV['GITLAB_ADMIN_PASSWORD']
end
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb
index c2da5104930..09e11b3587f 100644
--- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb
@@ -17,6 +17,28 @@ module QA
expect(project).to have_readme_content('This is a test project')
end
end
+
+ it 'pushes to a project using a specific Praefect repository storage', :smoke, :requires_admin, :requires_praefect, quarantine: { issue: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/276', type: :new } do
+ Flow::Login.sign_in_as_admin
+
+ project = Resource::Project.fabricate_via_api! do |storage_project|
+ storage_project.name = 'specific-repository-storage'
+ storage_project.repository_storage = QA::Runtime::Env.praefect_repository_storage
+ end
+
+ Resource::Repository::Push.fabricate! do |push|
+ push.repository_http_uri = project.repository_http_location.uri
+ push.file_name = 'README.md'
+ push.file_content = "# This is a test project named #{project.name}"
+ push.commit_message = 'Add README.md'
+ push.new_branch = true
+ end
+
+ project.visit!
+
+ expect(page).to have_content('README.md')
+ expect(page).to have_content("This is a test project named #{project.name}")
+ end
end
end
end
diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb
index 0a0bf33a726..6b8777af9fe 100644
--- a/qa/spec/runtime/env_spec.rb
+++ b/qa/spec/runtime/env_spec.rb
@@ -271,6 +271,12 @@ describe QA::Runtime::Env do
env_key: 'QA_CAN_TEST_ADMIN_FEATURES',
default: true
+ it_behaves_like 'boolean method with parameter',
+ method: :can_test?,
+ param: :praefect,
+ env_key: 'QA_CAN_TEST_PRAEFECT',
+ default: true
+
it 'raises ArgumentError if feature is unknown' do
expect { described_class.can_test? :foo }.to raise_error(ArgumentError, 'Unknown feature "foo"')
end
diff --git a/spec/javascripts/commit/pipelines/pipelines_spec.js b/spec/frontend/commit/pipelines/pipelines_spec.js
index 29bdf05b8cf..b88cba90b87 100644
--- a/spec/javascripts/commit/pipelines/pipelines_spec.js
+++ b/spec/frontend/commit/pipelines/pipelines_spec.js
@@ -1,11 +1,11 @@
import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter';
-import mountComponent from 'spec/helpers/vue_mount_component_helper';
+import mountComponent from 'helpers/vue_mount_component_helper';
import axios from '~/lib/utils/axios_utils';
import Api from '~/api';
import pipelinesTable from '~/commit/pipelines/pipelines_table.vue';
-describe('Pipelines table in Commits and Merge requests', function() {
+describe('Pipelines table in Commits and Merge requests', () => {
const jsonFixtureName = 'pipelines/pipelines.json';
let pipeline;
let PipelinesTable;
@@ -37,19 +37,19 @@ describe('Pipelines table in Commits and Merge requests', function() {
describe('successful request', () => {
describe('without pipelines', () => {
- beforeEach(function() {
+ beforeEach(() => {
mock.onGet('endpoint.json').reply(200, []);
vm = mountComponent(PipelinesTable, props);
});
- it('should render the empty state', function(done) {
- setTimeout(() => {
+ it('should render the empty state', done => {
+ setImmediate(() => {
expect(vm.$el.querySelector('.empty-state')).toBeDefined();
expect(vm.$el.querySelector('.realtime-loading')).toBe(null);
expect(vm.$el.querySelector('.js-pipelines-error-state')).toBe(null);
done();
- }, 0);
+ });
});
});
@@ -60,19 +60,19 @@ describe('Pipelines table in Commits and Merge requests', function() {
});
it('should render a table with the received pipelines', done => {
- setTimeout(() => {
+ setImmediate(() => {
expect(vm.$el.querySelectorAll('.ci-table .commit').length).toEqual(1);
expect(vm.$el.querySelector('.realtime-loading')).toBe(null);
expect(vm.$el.querySelector('.empty-state')).toBe(null);
expect(vm.$el.querySelector('.js-pipelines-error-state')).toBe(null);
done();
- }, 0);
+ });
});
describe('with pagination', () => {
it('should make an API request when using pagination', done => {
- setTimeout(() => {
- spyOn(vm, 'updateContent');
+ setImmediate(() => {
+ jest.spyOn(vm, 'updateContent').mockImplementation(() => {});
vm.store.state.pageInfo = {
page: 1,
@@ -135,7 +135,7 @@ describe('Pipelines table in Commits and Merge requests', function() {
}),
);
- setTimeout(() => {
+ setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).not.toBeNull();
done();
});
@@ -156,7 +156,7 @@ describe('Pipelines table in Commits and Merge requests', function() {
}),
);
- setTimeout(() => {
+ setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull();
done();
});
@@ -177,7 +177,7 @@ describe('Pipelines table in Commits and Merge requests', function() {
}),
);
- setTimeout(() => {
+ setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull();
done();
});
@@ -198,7 +198,7 @@ describe('Pipelines table in Commits and Merge requests', function() {
}),
);
- setTimeout(() => {
+ setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull();
done();
});
@@ -222,15 +222,15 @@ describe('Pipelines table in Commits and Merge requests', function() {
});
it('updates the loading state', done => {
- spyOn(Api, 'postMergeRequestPipeline').and.returnValue(Promise.resolve());
+ jest.spyOn(Api, 'postMergeRequestPipeline').mockReturnValue(Promise.resolve());
- setTimeout(() => {
+ setImmediate(() => {
vm.$el.querySelector('.js-run-mr-pipeline').click();
vm.$nextTick(() => {
expect(vm.state.isRunningMergeRequestPipeline).toBe(true);
- setTimeout(() => {
+ setImmediate(() => {
expect(vm.state.isRunningMergeRequestPipeline).toBe(false);
done();
@@ -248,14 +248,14 @@ describe('Pipelines table in Commits and Merge requests', function() {
vm = mountComponent(PipelinesTable, props);
});
- it('should render error state', function(done) {
- setTimeout(() => {
+ it('should render error state', done => {
+ setImmediate(() => {
expect(vm.$el.querySelector('.js-pipelines-error-state')).toBeDefined();
expect(vm.$el.querySelector('.realtime-loading')).toBe(null);
expect(vm.$el.querySelector('.js-empty-state')).toBe(null);
expect(vm.$el.querySelector('.ci-table')).toBe(null);
done();
- }, 0);
+ });
});
});
});
diff --git a/spec/frontend/logs/stores/actions_spec.js b/spec/frontend/logs/stores/actions_spec.js
index 1754931bcaf..303737a11cd 100644
--- a/spec/frontend/logs/stores/actions_spec.js
+++ b/spec/frontend/logs/stores/actions_spec.js
@@ -202,8 +202,8 @@ describe('Logs Store actions', () => {
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
expect(latestGetParams()).toEqual({
pod_name: mockPodName,
- start: mockFixedRange.start,
- end: mockFixedRange.end,
+ start_time: mockFixedRange.start,
+ end_time: mockFixedRange.end,
cursor: mockCursor,
});
});
@@ -280,8 +280,8 @@ describe('Logs Store actions', () => {
() => {
expect(latestGetParams()).toEqual({
pod_name: mockPodName,
- start: mockFixedRange.start,
- end: mockFixedRange.end,
+ start_time: mockFixedRange.start,
+ end_time: mockFixedRange.end,
cursor: mockCursor,
});
},
diff --git a/spec/frontend/monitoring/store/actions_spec.js b/spec/frontend/monitoring/store/actions_spec.js
index ba41a75ceec..203bc6f4e0e 100644
--- a/spec/frontend/monitoring/store/actions_spec.js
+++ b/spec/frontend/monitoring/store/actions_spec.js
@@ -509,8 +509,8 @@ describe('Monitoring store actions', () => {
});
describe('fetchPrometheusMetric', () => {
const params = {
- start: '2019-08-06T12:40:02.184Z',
- end: '2019-08-06T20:40:02.184Z',
+ start_time: '2019-08-06T12:40:02.184Z',
+ end_time: '2019-08-06T20:40:02.184Z',
};
let metric;
let state;
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
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index 9dad6b1e766..4c96b0079df 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -715,7 +715,7 @@ describe ApplicationSetting do
subject.email_restrictions = '+'
expect(subject).not_to be_valid
- expect(subject.errors.messages[:email_restrictions].first).to eq(_('is not a valid regular expression'))
+ expect(subject.errors.messages[:email_restrictions].first).to eq(_('not valid RE2 syntax: no argument for repetition operator: +'))
end
end
diff --git a/spec/services/pod_logs/elasticsearch_service_spec.rb b/spec/services/pod_logs/elasticsearch_service_spec.rb
index 1387d2cfb8e..39aa910d878 100644
--- a/spec/services/pod_logs/elasticsearch_service_spec.rb
+++ b/spec/services/pod_logs/elasticsearch_service_spec.rb
@@ -27,8 +27,8 @@ describe ::PodLogs::ElasticsearchService do
context 'with start and end provided and valid' do
let(:params) do
{
- 'start' => start_time,
- 'end' => end_time
+ 'start_time' => start_time,
+ 'end_time' => end_time
}
end
@@ -36,8 +36,8 @@ describe ::PodLogs::ElasticsearchService do
result = subject.send(:check_times, {})
expect(result[:status]).to eq(:success)
- expect(result[:start]).to eq(start_time)
- expect(result[:end]).to eq(end_time)
+ expect(result[:start_time]).to eq(start_time)
+ expect(result[:end_time]).to eq(end_time)
end
end
@@ -57,8 +57,8 @@ describe ::PodLogs::ElasticsearchService do
context 'with start valid and end invalid' do
let(:params) do
{
- 'start' => start_time,
- 'end' => 'invalid date'
+ 'start_time' => start_time,
+ 'end_time' => 'invalid date'
}
end
@@ -73,8 +73,8 @@ describe ::PodLogs::ElasticsearchService do
context 'with start invalid and end valid' do
let(:params) do
{
- 'start' => 'invalid date',
- 'end' => end_time
+ 'start_time' => 'invalid date',
+ 'end_time' => end_time
}
end
@@ -153,8 +153,8 @@ describe ::PodLogs::ElasticsearchService do
pod_name: pod_name,
container_name: container_name,
search: search,
- start: start_time,
- end: end_time,
+ start_time: start_time,
+ end_time: end_time,
cursor: cursor
}
end
diff --git a/spec/support/helpers/prometheus_helpers.rb b/spec/support/helpers/prometheus_helpers.rb
index 7c03746a395..0fdc4de1b36 100644
--- a/spec/support/helpers/prometheus_helpers.rb
+++ b/spec/support/helpers/prometheus_helpers.rb
@@ -31,15 +31,15 @@ module PrometheusHelpers
"https://prometheus.example.com/api/v1/query?#{query}"
end
- def prometheus_query_range_url(prometheus_query, start: 8.hours.ago, stop: Time.now, step: nil)
- start = start.to_f
- stop = stop.to_f
- step ||= Gitlab::PrometheusClient.compute_step(start, stop)
+ def prometheus_query_range_url(prometheus_query, start_time: 8.hours.ago, end_time: Time.now, step: nil)
+ start_time = start_time.to_f
+ end_time = end_time.to_f
+ step ||= Gitlab::PrometheusClient.compute_step(start_time, end_time)
query = {
query: prometheus_query,
- start: start,
- end: stop,
+ start: start_time,
+ end: end_time,
step: step
}.to_query
@@ -50,11 +50,11 @@ module PrometheusHelpers
"https://prometheus.example.com/api/v1/label/#{name}/values"
end
- def prometheus_series_url(*matches, start: 8.hours.ago, stop: Time.now)
+ def prometheus_series_url(*matches, start_time: 8.hours.ago, end_time: Time.now)
query = {
match: matches,
- start: start.to_f,
- end: stop.to_f
+ start: start_time.to_f,
+ end: end_time.to_f
}.to_query
"https://prometheus.example.com/api/v1/series?#{query}"
end