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

Add latest changes from gitlab-org/gitlab@master

parent ccaa9448
No related branches found
No related tags found
No related merge requests found
namespace :gitlab do
namespace :shell do
desc "GitLab | Install or upgrade gitlab-shell"
desc "GitLab | Shell | Install or upgrade gitlab-shell"
task :install, [:repo] => :gitlab_environment do |t, args|
warn_user_is_not_gitlab
 
Loading
Loading
@@ -54,12 +54,12 @@ namespace :gitlab do
Gitlab::Shell.ensure_secret_token!
end
 
desc "GitLab | Setup gitlab-shell"
desc "GitLab | Shell | Setup gitlab-shell"
task setup: :gitlab_environment do
setup
end
 
desc "GitLab | Build missing projects"
desc "GitLab | Shell | Build missing projects"
task build_missing_projects: :gitlab_environment do
Project.find_each(batch_size: 1000) do |project|
path_to_repo = project.repository.path_to_repo
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ namespace :gitlab do
File.write(path, banner + YAML.dump(object))
end
 
desc 'GitLab | Generate all_queues.yml based on worker definitions'
desc 'GitLab | Sidekiq | Generate all_queues.yml based on worker definitions'
task generate: :environment do
foss_workers, ee_workers = Gitlab::SidekiqConfig.workers_for_all_queues_yml
 
Loading
Loading
@@ -27,7 +27,7 @@ namespace :gitlab do
end
end
 
desc 'GitLab | Validate that all_queues.yml matches worker definitions'
desc 'GitLab | Sidekiq | Validate that all_queues.yml matches worker definitions'
task check: :environment do
if Gitlab::SidekiqConfig.all_queues_yml_outdated?
raise <<~MSG
Loading
Loading
namespace :gitlab do
namespace :two_factor do
desc "GitLab | Disable Two-factor authentication (2FA) for all users"
desc "GitLab | 2FA | Disable Two-factor authentication (2FA) for all users"
task disable_for_all_users: :gitlab_environment do
scope = User.with_two_factor
count = scope.count
Loading
Loading
@@ -25,12 +25,12 @@ namespace :gitlab do
@rotator ||= Gitlab::OtpKeyRotator.new(ENV['filename'])
end
 
desc "Encrypt user OTP secrets with a new encryption key"
desc "GitLab | 2FA | Rotate Key | Encrypt user OTP secrets with a new encryption key"
task apply: :environment do |t, args|
rotator.rotate!(old_key: ENV['old_key'], new_key: ENV['new_key'])
end
 
desc "Rollback to secrets encrypted with the old encryption key"
desc "GitLab | 2FA | Rotate Key | Rollback to secrets encrypted with the old encryption key"
task rollback: :environment do
rotator.rollback!
end
Loading
Loading
namespace :gitlab do
namespace :web_hook do
desc "GitLab | Adds a webhook to the projects"
desc "GitLab | Webhook | Adds a webhook to the projects"
task add: :environment do
web_hook_url = ENV['URL']
namespace_path = ENV['NAMESPACE']
Loading
Loading
@@ -20,7 +20,7 @@ namespace :gitlab do
end
end
 
desc "GitLab | Remove a webhook from the projects"
desc "GitLab | Webhook | Remove a webhook from the projects"
task rm: :environment do
web_hook_url = ENV['URL']
namespace_path = ENV['NAMESPACE']
Loading
Loading
@@ -44,7 +44,7 @@ namespace :gitlab do
puts "#{count} webhooks were removed."
end
 
desc "GitLab | List webhooks"
desc "GitLab | Webhook | List webhooks"
task list: :environment do
namespace_path = ENV['NAMESPACE']
 
Loading
Loading
namespace :gitlab do
namespace :workhorse do
desc "GitLab | Install or upgrade gitlab-workhorse"
desc "GitLab | Workhorse | Install or upgrade gitlab-workhorse"
task :install, [:dir, :repo] => :gitlab_environment do |t, args|
warn_user_is_not_gitlab
 
Loading
Loading
Loading
Loading
@@ -138,7 +138,7 @@ class GithubRepos
end
 
namespace :import do
desc 'Import a GitHub project - Example: import:github[ToKeN,root,root/blah,my/github_repo] (optional my/github_repo)'
desc 'GitLab | Import | Import a GitHub project - Example: import:github[ToKeN,root,root/blah,my/github_repo] (optional my/github_repo)'
task :github, [:token, :gitlab_username, :project_path] => :environment do |_t, args|
abort 'Project path must be: namespace(s)/project_name'.color(:red) unless args.project_path.include?('/')
 
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ unless Rails.env.production?
ENV['STATIC_VERIFICATION'] = 'true'
end
 
desc "GitLab | lint | Static verification"
desc "GitLab | Lint | Static verification"
task static_verification: %w[
lint:static_verification_env
dev:load
Loading
Loading
@@ -12,19 +12,19 @@ unless Rails.env.production?
Gitlab::Utils::Override.verify!
end
 
desc "GitLab | lint | Lint JavaScript files using ESLint"
desc "GitLab | Lint | Lint JavaScript files using ESLint"
task :javascript do
Rake::Task['eslint'].invoke
end
 
desc "GitLab | lint | Lint HAML files"
desc "GitLab | Lint | Lint HAML files"
task :haml do
Rake::Task['haml_lint'].invoke
rescue RuntimeError # The haml_lint tasks raise a RuntimeError
exit(1)
end
 
desc "GitLab | lint | Run several lint checks"
desc "GitLab | Lint | Run several lint checks"
task :all do
status = 0
 
Loading
Loading
namespace :gitlab do
namespace :db do
desc 'GitLab | Adds primary keys to tables that only have composite unique keys'
desc 'GitLab | DB | Adds primary keys to tables that only have composite unique keys'
task composite_primary_keys_add: :environment do
require Rails.root.join('db/optional_migrations/composite_primary_keys')
CompositePrimaryKeysMigration.new.up
end
 
desc 'GitLab | Removes previously added composite primary keys'
desc 'GitLab | DB | Removes previously added composite primary keys'
task composite_primary_keys_drop: :environment do
require Rails.root.join('db/optional_migrations/composite_primary_keys')
CompositePrimaryKeysMigration.new.down
Loading
Loading
Loading
Loading
@@ -53,7 +53,7 @@ namespace :pngquant do
end
end
 
desc 'GitLab | pngquant | Compress all documentation PNG images using pngquant'
desc 'GitLab | Pngquant | Compress all documentation PNG images using pngquant'
task :compress do
check_executable
 
Loading
Loading
@@ -69,7 +69,7 @@ namespace :pngquant do
end
end
 
desc 'GitLab | pngquant | Checks that all documentation PNG images have been compressed with pngquant'
desc 'GitLab | Pngquant | Checks that all documentation PNG images have been compressed with pngquant'
task :lint do
check_executable
 
Loading
Loading
Loading
Loading
@@ -8,28 +8,28 @@ namespace :sidekiq do
WARNING
end
 
desc "[DEPRECATED] GitLab | Stop sidekiq"
desc '[DEPRECATED] GitLab | Sidekiq | Stop sidekiq'
task :stop do
deprecation_warning!
 
system(*%w(bin/background_jobs stop))
end
 
desc "[DEPRECATED] GitLab | Start sidekiq"
desc '[DEPRECATED] GitLab | Sidekiq | Start sidekiq'
task :start do
deprecation_warning!
 
system(*%w(bin/background_jobs start))
end
 
desc '[DEPRECATED] GitLab | Restart sidekiq'
desc '[DEPRECATED] GitLab | Sidekiq | Restart sidekiq'
task :restart do
deprecation_warning!
 
system(*%w(bin/background_jobs restart))
end
 
desc "[DEPRECATED] GitLab | Start sidekiq with launchd on Mac OS X"
desc '[DEPRECATED] GitLab | Sidekiq | Start sidekiq with launchd on Mac OS X'
task :launchd do
deprecation_warning!
 
Loading
Loading
Loading
Loading
@@ -82,8 +82,8 @@ describe 'Group' do
expect(page).to have_selector('#group_create_chat_team')
end
 
it 'checks the checkbox by default' do
expect(find('#group_create_chat_team')['checked']).to eq(true)
it 'unchecks the checkbox by default' do
expect(find('#group_create_chat_team')['checked']).to eq(false)
end
 
it 'updates the team URL on graph path update', :js do
Loading
Loading
Loading
Loading
@@ -4,27 +4,33 @@ import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash';
import * as actions from '~/error_tracking/store/details/actions';
import * as types from '~/error_tracking/store/details/mutation_types';
import Poll from '~/lib/utils/poll';
let mockedAdapter;
let mockedRestart;
 
jest.mock('~/flash.js');
jest.mock('~/lib/utils/url_utility');
 
let mock;
describe('Sentry error details store actions', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
mockedAdapter = new MockAdapter(axios);
});
 
afterEach(() => {
mock.restore();
mockedAdapter.restore();
createFlash.mockClear();
if (mockedRestart) {
mockedRestart.mockRestore();
mockedRestart = null;
}
});
 
describe('startPollingDetails', () => {
const endpoint = '123/details';
it('should commit SET_ERROR with received response', done => {
const payload = { error: { id: 1 } };
mock.onGet().reply(200, payload);
mockedAdapter.onGet().reply(200, payload);
testAction(
actions.startPollingDetails,
{ endpoint },
Loading
Loading
@@ -41,7 +47,7 @@ describe('Sentry error details store actions', () => {
});
 
it('should show flash on API error', done => {
mock.onGet().reply(400);
mockedAdapter.onGet().reply(400);
 
testAction(
actions.startPollingDetails,
Loading
Loading
@@ -55,13 +61,23 @@ describe('Sentry error details store actions', () => {
},
);
});
it('should not restart polling when receiving an empty 204 response', done => {
mockedRestart = jest.spyOn(Poll.prototype, 'restart');
mockedAdapter.onGet().reply(204);
testAction(actions.startPollingDetails, { endpoint }, {}, [], [], () => {
expect(mockedRestart).toHaveBeenCalledTimes(0);
done();
});
});
});
 
describe('startPollingStacktrace', () => {
const endpoint = '123/stacktrace';
it('should commit SET_ERROR with received response', done => {
const payload = { error: [1, 2, 3] };
mock.onGet().reply(200, payload);
mockedAdapter.onGet().reply(200, payload);
testAction(
actions.startPollingStacktrace,
{ endpoint },
Loading
Loading
@@ -78,7 +94,7 @@ describe('Sentry error details store actions', () => {
});
 
it('should show flash on API error', done => {
mock.onGet().reply(400);
mockedAdapter.onGet().reply(400);
 
testAction(
actions.startPollingStacktrace,
Loading
Loading
@@ -92,5 +108,16 @@ describe('Sentry error details store actions', () => {
},
);
});
it('should not restart polling when receiving an empty 204 response', done => {
mockedRestart = jest.spyOn(Poll.prototype, 'restart');
mockedAdapter.onGet().reply(204);
testAction(actions.startPollingStacktrace, { endpoint }, {}, [], [], () => {
mockedRestart = jest.spyOn(Poll.prototype, 'restart');
expect(mockedRestart).toHaveBeenCalledTimes(0);
done();
});
});
});
});
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