Commit e4eae4ab authored by Stan Hu's avatar Stan Hu

Merge branch '213843-fix-flaky-ndjson-reader-spec' into 'master'

Fix flaky ndjson reader spec

Closes #213843

See merge request gitlab-org/gitlab!29465
parents 97173f98 7f113da3
......@@ -21,7 +21,7 @@ describe Gitlab::ImportExport::JSON::NdjsonReader do
describe '#exist?' do
subject { ndjson_reader.exist? }
context 'given valid dir_path', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/213843' do
context 'given valid dir_path' do
let(:dir_path) { fixture }
it { is_expected.to be true }
......
......@@ -15,15 +15,17 @@ module ImportExport
export_path = [prefix, 'spec', 'fixtures', 'lib', 'gitlab', 'import_export', name].compact
export_path = File.join(*export_path)
if File.exist?(File.join(export_path, 'tree.tar.gz'))
extract_archive(export_path, 'tree.tar.gz')
end
allow_any_instance_of(Gitlab::ImportExport).to receive(:export_path) { export_path }
end
def extract_archive(path, archive)
if File.exist?(File.join(path, archive))
system("cd #{path}; tar xzvf #{archive} &> /dev/null")
end
output, exit_status = Gitlab::Popen.popen(["cd #{path}; tar xzf #{archive}"])
raise "Failed to extract archive. Output: #{output}" unless exit_status.zero?
end
def cleanup_artifacts_from_extract_archive(name, prefix = nil)
......@@ -31,7 +33,7 @@ module ImportExport
export_path = File.join(*export_path)
if File.exist?(File.join(export_path, 'tree.tar.gz'))
system("cd #{export_path}; rm -fr tree &> /dev/null")
system("cd #{export_path}; rm -fr tree")
end
end
......
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