Commit c97edbb7 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 3e637812 7b0f9f82
......@@ -4,7 +4,12 @@ include:
- local: /lib/gitlab/ci/templates/Code-Quality.gitlab-ci.yml
.dedicated-runner: &dedicated-runner
retry: 1
retry:
max: 1 # This is confusing but this means "2 runs at max".
when:
- unknown_failure
- api_failure
- runner_system_failure
tags:
- gitlab-org
......@@ -1339,4 +1344,3 @@ schedule:review-performance:
<<: *review-schedules-only
script:
- wait_for_job_to_be_done "schedule:review-deploy"
......@@ -22,7 +22,7 @@ class HelpController < ApplicationController
end
def show
@path = clean_path_info(path_params[:path])
@path = Rack::Utils.clean_path_info(path_params[:path])
respond_to do |format|
format.any(:markdown, :md, :html) do
......@@ -75,35 +75,4 @@ class HelpController < ApplicationController
params
end
PATH_SEPS = Regexp.union(*[::File::SEPARATOR, ::File::ALT_SEPARATOR].compact)
# Taken from ActionDispatch::FileHandler
# Cleans up the path, to prevent directory traversal outside the doc folder.
def clean_path_info(path_info)
parts = path_info.split(PATH_SEPS)
clean = []
# Walk over each part of the path
parts.each do |part|
# Turn `one//two` or `one/./two` into `one/two`.
next if part.empty? || part == '.'
if part == '..'
# Turn `one/two/../` into `one`
clean.pop
else
# Add simple folder names to the clean path.
clean << part
end
end
# If the path was an absolute path (i.e. `/` or `/one/two`),
# add `/` to the front of the clean path.
clean.unshift '/' if parts.empty? || parts.first.empty?
# Join all the clean path parts by the path separator.
::File.join(*clean)
end
end
......@@ -58,11 +58,31 @@ module Gitlab
migration_class_for(class_name).new.perform(*arguments)
end
def self.exists?(migration_class)
def self.exists?(migration_class, additional_queues = [])
enqueued = Sidekiq::Queue.new(self.queue)
scheduled = Sidekiq::ScheduledSet.new
[enqueued, scheduled].each do |queue|
enqueued_job?([enqueued, scheduled], migration_class)
end
def self.dead_jobs?(migration_class)
dead_set = Sidekiq::DeadSet.new
enqueued_job?([dead_set], migration_class)
end
def self.retrying_jobs?(migration_class)
retry_set = Sidekiq::RetrySet.new
enqueued_job?([retry_set], migration_class)
end
def self.migration_class_for(class_name)
const_get(class_name)
end
def self.enqueued_job?(queues, migration_class)
queues.each do |queue|
queue.each do |job|
return true if job.queue == self.queue && job.args.first == migration_class
end
......@@ -70,9 +90,5 @@ module Gitlab
false
end
def self.migration_class_for(class_name)
const_get(class_name)
end
end
end
......@@ -34,7 +34,7 @@ RSpec.configure do |config|
config.display_try_failure_messages = true
config.around do |example|
retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 3
retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 2
example.run_with_retry retry: retry_times
end
end
......@@ -13,7 +13,7 @@ describe 'Blob shortcuts', :js do
end
shared_examples "quotes the selected text" do
it "quotes the selected text" do
it "quotes the selected text", :quarantine do
select_element('.note-text')
find('body').native.send_key('r')
......
......@@ -63,7 +63,7 @@ describe 'User visits the profile preferences page' do
end
describe 'User changes their language', :js do
it 'creates a flash message' do
it 'creates a flash message', :quarantine do
select2('en', from: '#user_preferred_language')
click_button 'Save'
......
......@@ -195,4 +195,44 @@ describe Gitlab::BackgroundMigration do
end
end
end
describe '.dead_jobs?' do
let(:queue) do
[double(args: ['Foo', [10, 20]], queue: described_class.queue)]
end
context 'when there are dead jobs present' do
before do
allow(Sidekiq::DeadSet).to receive(:new).and_return(queue)
end
it 'returns true if specific job exists' do
expect(described_class.dead_jobs?('Foo')).to eq(true)
end
it 'returns false if specific job does not exist' do
expect(described_class.dead_jobs?('Bar')).to eq(false)
end
end
end
describe '.retrying_jobs?' do
let(:queue) do
[double(args: ['Foo', [10, 20]], queue: described_class.queue)]
end
context 'when there are dead jobs present' do
before do
allow(Sidekiq::RetrySet).to receive(:new).and_return(queue)
end
it 'returns true if specific job exists' do
expect(described_class.retrying_jobs?('Foo')).to eq(true)
end
it 'returns false if specific job does not exist' do
expect(described_class.retrying_jobs?('Bar')).to eq(false)
end
end
end
end
......@@ -615,7 +615,7 @@ module Gitlab
subject { Gitlab::Ci::YamlProcessor.new(YAML.dump(config), opts) }
context "when validating a ci config file with no project context" do
context "when a single string is provided" do
context "when a single string is provided", :quarantine do
let(:include_content) { "/local.gitlab-ci.yml" }
it "does not return any error" do
......
......@@ -102,8 +102,8 @@ RSpec.configure do |config|
config.include PolicyHelpers, type: :policy
if ENV['CI']
# This includes the first try, i.e. tests will be run 4 times before failing.
config.default_retry_count = 4
# This includes the first try, i.e. tests will be run 2 times before failing.
config.default_retry_count = 2
config.reporter.register_listener(
RspecFlaky::Listener.new,
:example_passed,
......
......@@ -42,7 +42,7 @@ shared_examples 'wiki file attachments' do
end
end
context 'uploading is complete' do
context 'uploading is complete', :quarantine do
it 'shows "Attach a file" button on uploading complete' do
attach_with_dropzone
wait_for_requests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment