Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
58c1969d4a
commit
61a1ecc5e9
|
@ -372,7 +372,7 @@ GEM
|
||||||
faraday_middleware
|
faraday_middleware
|
||||||
multi_json
|
multi_json
|
||||||
fast_blank (1.0.0)
|
fast_blank (1.0.0)
|
||||||
fast_gettext (1.6.0)
|
fast_gettext (2.1.0)
|
||||||
ffaker (2.10.0)
|
ffaker (2.10.0)
|
||||||
ffi (1.15.3)
|
ffi (1.15.3)
|
||||||
ffi-compiler (1.0.1)
|
ffi-compiler (1.0.1)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddStateToMember < ActiveRecord::Migration[6.1]
|
||||||
|
include Gitlab::Database::MigrationHelpers
|
||||||
|
|
||||||
|
def up
|
||||||
|
unless column_exists?(:members, :state)
|
||||||
|
with_lock_retries do
|
||||||
|
add_column :members, :state, :integer, limit: 2, default: 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
if column_exists?(:members, :state)
|
||||||
|
with_lock_retries do
|
||||||
|
remove_column :members, :state
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1 @@
|
||||||
|
54f7c66eed745b62d0b53a407a96721f90392ab7f800db9c8a2607f22974ef3c
|
|
@ -14873,7 +14873,8 @@ CREATE TABLE members (
|
||||||
requested_at timestamp without time zone,
|
requested_at timestamp without time zone,
|
||||||
expires_at date,
|
expires_at date,
|
||||||
ldap boolean DEFAULT false NOT NULL,
|
ldap boolean DEFAULT false NOT NULL,
|
||||||
override boolean DEFAULT false NOT NULL
|
override boolean DEFAULT false NOT NULL,
|
||||||
|
state smallint DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE SEQUENCE members_id_seq
|
CREATE SEQUENCE members_id_seq
|
||||||
|
|
|
@ -333,6 +333,9 @@ excluded_attributes:
|
||||||
project_members:
|
project_members:
|
||||||
- :source_id
|
- :source_id
|
||||||
- :invite_email_success
|
- :invite_email_success
|
||||||
|
- :state
|
||||||
|
group_members:
|
||||||
|
- :state
|
||||||
metrics:
|
metrics:
|
||||||
- :merge_request_id
|
- :merge_request_id
|
||||||
- :pipeline_id
|
- :pipeline_id
|
||||||
|
|
|
@ -57,6 +57,11 @@ module Gitlab
|
||||||
worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path)
|
worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path)
|
||||||
|
|
||||||
queue_groups = argv.map do |queues_or_query_string|
|
queue_groups = argv.map do |queues_or_query_string|
|
||||||
|
if queues_or_query_string =~ /[\r\n]/
|
||||||
|
raise CommandError,
|
||||||
|
'The queue arguments cannot contain newlines'
|
||||||
|
end
|
||||||
|
|
||||||
next worker_queues if queues_or_query_string == SidekiqConfig::WorkerMatcher::WILDCARD_MATCH
|
next worker_queues if queues_or_query_string == SidekiqConfig::WorkerMatcher::WILDCARD_MATCH
|
||||||
|
|
||||||
# When using the queue query syntax, we treat each queue group
|
# When using the queue query syntax, we treat each queue group
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'fast_spec_helper'
|
||||||
require 'shellwords'
|
require 'shellwords'
|
||||||
|
require 'rspec-parameterized'
|
||||||
|
|
||||||
RSpec.describe 'bin/sidekiq-cluster' do
|
RSpec.describe 'bin/sidekiq-cluster', :aggregate_failures do
|
||||||
using RSpec::Parameterized::TableSyntax
|
using RSpec::Parameterized::TableSyntax
|
||||||
|
|
||||||
|
let(:root) { File.expand_path('../..', __dir__) }
|
||||||
|
|
||||||
context 'when selecting some queues and excluding others' do
|
context 'when selecting some queues and excluding others' do
|
||||||
where(:args, :included, :excluded) do
|
where(:args, :included, :excluded) do
|
||||||
%w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
|
%w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
|
||||||
|
@ -13,10 +16,10 @@ RSpec.describe 'bin/sidekiq-cluster' do
|
||||||
end
|
end
|
||||||
|
|
||||||
with_them do
|
with_them do
|
||||||
it 'runs successfully', :aggregate_failures do
|
it 'runs successfully' do
|
||||||
cmd = %w[bin/sidekiq-cluster --dryrun] + args
|
cmd = %w[bin/sidekiq-cluster --dryrun] + args
|
||||||
|
|
||||||
output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
|
output, status = Gitlab::Popen.popen(cmd, root)
|
||||||
|
|
||||||
expect(status).to be(0)
|
expect(status).to be(0)
|
||||||
expect(output).to include('bundle exec sidekiq')
|
expect(output).to include('bundle exec sidekiq')
|
||||||
|
@ -31,10 +34,10 @@ RSpec.describe 'bin/sidekiq-cluster' do
|
||||||
%w[*],
|
%w[*],
|
||||||
%w[--queue-selector *]
|
%w[--queue-selector *]
|
||||||
].each do |args|
|
].each do |args|
|
||||||
it "runs successfully with `#{args}`", :aggregate_failures do
|
it "runs successfully with `#{args}`" do
|
||||||
cmd = %w[bin/sidekiq-cluster --dryrun] + args
|
cmd = %w[bin/sidekiq-cluster --dryrun] + args
|
||||||
|
|
||||||
output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
|
output, status = Gitlab::Popen.popen(cmd, root)
|
||||||
|
|
||||||
expect(status).to be(0)
|
expect(status).to be(0)
|
||||||
expect(output).to include('bundle exec sidekiq')
|
expect(output).to include('bundle exec sidekiq')
|
||||||
|
@ -43,4 +46,20 @@ RSpec.describe 'bin/sidekiq-cluster' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when arguments contain newlines' do
|
||||||
|
it 'raises an error' do
|
||||||
|
[
|
||||||
|
["default\n"],
|
||||||
|
["defaul\nt"]
|
||||||
|
].each do |args|
|
||||||
|
cmd = %w[bin/sidekiq-cluster --dryrun] + args
|
||||||
|
|
||||||
|
output, status = Gitlab::Popen.popen(cmd, root)
|
||||||
|
|
||||||
|
expect(status).to be(1)
|
||||||
|
expect(output).to include('cannot contain newlines')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,6 +48,18 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
|
||||||
cli.run(%w(*))
|
cli.run(%w(*))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'raises an error when the arguments contain newlines' do
|
||||||
|
invalid_arguments = [
|
||||||
|
["foo\n"],
|
||||||
|
["foo\r"],
|
||||||
|
%W[foo b\nar]
|
||||||
|
]
|
||||||
|
|
||||||
|
invalid_arguments.each do |arguments|
|
||||||
|
expect { cli.run(arguments) }.to raise_error(described_class::CommandError)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'with --negate flag' do
|
context 'with --negate flag' do
|
||||||
it 'starts Sidekiq workers for all queues in all_queues.yml except the ones in argv' do
|
it 'starts Sidekiq workers for all queues in all_queues.yml except the ones in argv' do
|
||||||
expect(Gitlab::SidekiqConfig::CliMethods).to receive(:worker_queues).and_return(['baz'])
|
expect(Gitlab::SidekiqConfig::CliMethods).to receive(:worker_queues).and_return(['baz'])
|
||||||
|
|
|
@ -81,7 +81,7 @@ end
|
||||||
Gitlab::Database.singleton_class.prepend(
|
Gitlab::Database.singleton_class.prepend(
|
||||||
Database::PreventCrossJoins::GitlabDatabaseMixin)
|
Database::PreventCrossJoins::GitlabDatabaseMixin)
|
||||||
|
|
||||||
ALLOW_LIST = Set.new(YAML.load_file(Rails.root.join('.cross-join-allowlist.yml'))).freeze
|
ALLOW_LIST = Set.new(YAML.load_file(File.join(__dir__, 'cross-join-allowlist.yml'))).freeze
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.include(::Database::PreventCrossJoins::SpecHelpers)
|
config.include(::Database::PreventCrossJoins::SpecHelpers)
|
||||||
|
|
Loading…
Reference in New Issue