Skip to content
Snippets Groups Projects
Commit ae4ef817 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 194b499a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,14 +5,18 @@ module Gitlab
HEADER_NAME = 'Poll-Interval'
 
def self.set_header(response, interval:)
if polling_enabled?
multiplier = Gitlab::CurrentSettings.polling_interval_multiplier
value = (interval * multiplier).to_i
else
value = -1
end
response.headers[HEADER_NAME] = polling_interval_value(interval).to_s
end
def self.set_api_header(context, interval:)
context.header HEADER_NAME, polling_interval_value(interval).to_s
end
def self.polling_interval_value(interval)
return -1 unless polling_enabled?
 
response.headers[HEADER_NAME] = value.to_s
multiplier = Gitlab::CurrentSettings.polling_interval_multiplier
(interval * multiplier).to_i
end
 
def self.polling_enabled?
Loading
Loading
Loading
Loading
@@ -18323,7 +18323,7 @@ msgstr ""
msgid "Size settings for static websites"
msgstr ""
 
msgid "Skip older, pending deployment jobs"
msgid "Skip outdated deployment jobs"
msgstr ""
 
msgid "Skip this for now"
Loading
Loading
# frozen_string_literal: true
module RuboCop
module Cop
class FilenameLength < Cop
include RangeHelp
FILEPATH_MAX_BYTES = 256
FILENAME_MAX_BYTES = 100
MSG_FILEPATH_LEN = "This file path is too long. It should be #{FILEPATH_MAX_BYTES} or less"
MSG_FILENAME_LEN = "This file name is too long. It should be #{FILENAME_MAX_BYTES} or less"
def investigate(processed_source)
file_path = processed_source.file_path
return if config.file_to_exclude?(file_path)
if file_path.bytesize > FILEPATH_MAX_BYTES
add_offense(nil, location: source_range(processed_source.buffer, 1, 0, 1), message: MSG_FILEPATH_LEN)
elsif File.basename(file_path).bytesize > FILENAME_MAX_BYTES
add_offense(nil, location: source_range(processed_source.buffer, 1, 0, 1), message: MSG_FILENAME_LEN)
end
end
end
end
end
Loading
Loading
@@ -32,7 +32,9 @@ describe('Snippet header component', () => {
const errorMsg = 'Foo bar';
const err = { message: errorMsg };
 
const resolveMutate = jest.fn(() => Promise.resolve({ data: {} }));
const resolveMutate = jest.fn(() =>
Promise.resolve({ data: { destroySnippet: { errors: [] } } }),
);
const rejectMutation = jest.fn(() => Promise.reject(err));
 
const mutationTypes = {
Loading
Loading
Loading
Loading
@@ -67,17 +67,6 @@ describe Types::BaseField do
expect(field.to_graphql.complexity.call({}, { first: 1 }, 2)).to eq 2
expect(field.to_graphql.complexity.call({}, { first: 1, foo: true }, 2)).to eq 4
end
context 'when graphql_resolver_complexity is disabled' do
before do
stub_feature_flags(graphql_resolver_complexity: false)
end
it 'sets default field complexity' do
expect(field.to_graphql.complexity.call({}, {}, 2)).to eq 1
expect(field.to_graphql.complexity.call({}, { first: 50 }, 2)).to eq 1
end
end
end
 
context 'and is not a connection' do
Loading
Loading
Loading
Loading
@@ -431,6 +431,7 @@ project:
- sourced_pipelines
- prometheus_metrics
- vulnerabilities
- vulnerability_exports
- vulnerability_findings
- vulnerability_feedback
- vulnerability_identifiers
Loading
Loading
Loading
Loading
@@ -33,4 +33,36 @@ describe Gitlab::PollingInterval do
end
end
end
describe '.set_api_header' do
let(:context) { double(Grape::Endpoint) }
before do
allow(context).to receive(:header)
end
context 'when polling is disabled' do
before do
stub_application_setting(polling_interval_multiplier: 0)
end
it 'sets value to -1' do
expect(context).to receive(:header).with('Poll-Interval', '-1')
polling_interval.set_api_header(context, interval: 10_000)
end
end
context 'when polling is enabled' do
before do
stub_application_setting(polling_interval_multiplier: 0.33333)
end
it 'applies modifier to base interval' do
expect(context).to receive(:header).with('Poll-Interval', '3333')
polling_interval.set_api_header(context, interval: 10_000)
end
end
end
end
Loading
Loading
@@ -165,7 +165,6 @@ describe 'GraphQL' do
 
before do
stub_const('GitlabSchema::DEFAULT_MAX_COMPLEXITY', 6)
stub_feature_flags(graphql_resolver_complexity: true)
end
 
context 'when fetching single resource' do
Loading
Loading
@@ -186,18 +185,6 @@ describe 'GraphQL' do
 
expect_graphql_errors_to_include(/which exceeds max complexity/)
end
context 'when graphql_resolver_complexity is disabled' do
before do
stub_feature_flags(graphql_resolver_complexity: false)
end
it 'processes the query' do
post_graphql(query)
expect(graphql_errors).to be_nil
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/filename_length'
require_relative '../../support/helpers/expect_offense'
describe RuboCop::Cop::FilenameLength do
subject(:cop) { described_class.new }
it 'does not flag files with names 100 characters long' do
expect_no_offenses('puts "it does not matter"', 'a' * 100)
end
it 'tags files with names 101 characters long' do
filename = 'a' * 101
expect_offense(<<~SOURCE, filename)
source code
^ This file name is too long. It should be 100 or less
SOURCE
end
it 'tags files with names 256 characters long' do
filename = 'a' * 256
expect_offense(<<~SOURCE, filename)
source code
^ This file name is too long. It should be 100 or less
SOURCE
end
it 'tags files with filepath 256 characters long' do
filepath = File.join 'a', 'b' * 254
expect_offense(<<~SOURCE, filepath)
source code
^ This file name is too long. It should be 100 or less
SOURCE
end
it 'tags files with filepath 257 characters long' do
filepath = File.join 'a', 'b' * 255
expect_offense(<<~SOURCE, filepath)
source code
^ This file path is too long. It should be 256 or less
SOURCE
end
end
Loading
Loading
@@ -91,4 +91,20 @@ describe 'layouts/nav/sidebar/_admin' do
it_behaves_like 'page has active tab', 'Monitoring'
it_behaves_like 'page has active sub tab', 'Background Jobs'
end
context 'on settings' do
before do
render
end
it 'includes General link' do
expect(rendered).to have_link('General', href: general_admin_application_settings_path)
end
context 'when GitLab FOSS' do
it 'does not include Templates link' do
expect(rendered).not_to have_link('Templates', href: '/admin/application_settings/templates')
end
end
end
end
Loading
Loading
@@ -44,11 +44,35 @@ describe WaitableWorker do
expect(worker.counter).to eq(6)
end
 
it 'runs > 3 jobs using sidekiq' do
it 'runs > 3 jobs using sidekiq and a waiter key' do
expect(worker).to receive(:bulk_perform_async)
.with([[1, anything], [2, anything], [3, anything], [4, anything]])
 
worker.bulk_perform_and_wait([[1], [2], [3], [4]])
end
it 'runs > 10 * timeout jobs using sidekiq and no waiter key' do
arguments = 1.upto(21).map { |i| [i] }
expect(worker).to receive(:bulk_perform_async).with(arguments)
worker.bulk_perform_and_wait(arguments, timeout: 2)
end
context 'when the skip_job_waiter_for_large_batches flag is disabled' do
before do
stub_feature_flags(skip_job_waiter_for_large_batches: false)
end
it 'runs jobs over 10 * the timeout using a waiter key' do
arguments = 1.upto(21).map { |i| [i] }
arguments_with_waiter = arguments.map { |arg| arg + [anything] }
expect(worker).to receive(:bulk_perform_async).with(arguments_with_waiter)
worker.bulk_perform_and_wait(arguments, timeout: 2)
end
end
end
 
describe '.bulk_perform_inline' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment