Skip to content
Snippets Groups Projects
Unverified Commit c7abc46f authored by Mayra Cabrera's avatar Mayra Cabrera Committed by GitLab
Browse files

Merge branch 'sh-fix-more-flaky-specs-16-3' into '16-3-stable-ee'

Fix flaky specs in 16-3-stable-ee

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154623



Merged-by: default avatarMayra Cabrera <mcabrera@gitlab.com>
Approved-by: default avatarNao Hashizume <nhashizume@gitlab.com>
Approved-by: default avatarMayra Cabrera <mcabrera@gitlab.com>
Co-authored-by: default avatarLin Jen-Shin <jen-shin@gitlab.com>
Co-authored-by: default avatarStan Hu <stanhu@gmail.com>
parents b7068635 0b0c4e51
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -68,11 +68,8 @@ def stop_working
if server
# we close sockets if thread is not longer running
# this happens, when the process forks
if thread.alive?
server.shutdown
else
server.listeners.each(&:close)
end
server.listeners.each(&:close) unless thread.alive?
server.shutdown
end
 
@server = nil
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
require 'spec_helper'
 
RSpec.describe Gitlab::Database::MigrationHelpers::RestrictGitlabSchema, query_analyzers: false,
stub_feature_flags: false, feature_category: :cell do
stub_feature_flags: false, use_clean_rails_redis_caching: true, feature_category: :cell do
let(:schema_class) { Class.new(Gitlab::Database::Migration[1.0]).include(described_class) }
 
# We keep only the GitlabSchemasValidateConnection analyzer running
Loading
Loading
Loading
Loading
@@ -216,7 +216,7 @@ def call(env)
# in separate thread
allow_any_instance_of(::WEBrick::HTTPServer)
.to receive(:start).and_wrap_original do |m, *args|
Thread.new do
@server_thread = Thread.new do # rubocop:disable RSpec/InstanceVariable -- let does not work for this case
m.call(*args)
rescue IOError
# is raised as we close listeners
Loading
Loading
@@ -224,8 +224,17 @@ def call(env)
end
end
 
attr_reader :server_thread
after do
exporter.stop
next unless server_thread
server_thread.join(0.05)
raise '`exporter.stop` should terminate `server_thread`' if server_thread.alive?
ensure
server_thread.kill.join if server_thread
end
 
with_them do
Loading
Loading
Loading
Loading
@@ -22,6 +22,7 @@ def stub_all_feature_flags
 
def unstub_all_feature_flags
Feature.stub = false
Feature.reset_flipper
end
 
# Stub Feature flags with `flag_name: true/false`
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