Skip to content
代码片段 群组 项目
提交 c8c260ed 编辑于 作者: Javiera Tapia's avatar Javiera Tapia 提交者: Gabriel Mazetto
浏览文件

Minor improvements in specs and documentation

上级 343c6b19
No related branches found
No related tags found
无相关合并请求
......@@ -8,7 +8,7 @@ class Pipeline
# Result data structure from running a pipeline
#
# @attr [String] stderr
# @attr [Array<Process::Status>] status
# @attr [Array<Process::Status>] status_list
# @attr [Float] duration
Result = Struct.new(:stderr, :status_list, :duration, keyword_init: true)
......
......@@ -44,11 +44,7 @@ def pack_cmd(archive_file:, target_directory:, target:, excludes: [])
# Ensure single target or multiple targets are converted to string before adding to args,
# to avoid type conversion errors with Pathname
if target.respond_to?(:map)
tar_args += target.map(&:to_s)
else
tar_args << target.to_s
end
tar_args += Array(target).map(&:to_s)
Shell::Command.new(cmd, *tar_args)
end
......
......@@ -12,7 +12,7 @@
it { respond_to :shell_commands }
describe '#initialize' do
it 'accept single argument' do
it 'accepts a single argument' do
expect { pipeline.new(printf_command) }.not_to raise_exception
end
......
......@@ -12,18 +12,17 @@
let(:status_1) { instance_double(Process::Status, success?: false, exitstatus: 1) }
let(:pipeline_status_success) { Gitlab::Backup::Cli::Shell::Pipeline::Result.new(status_list: [status_0, status_0]) }
let(:pipeline_status_failed) { Gitlab::Backup::Cli::Shell::Pipeline::Result.new(status_list: [status_1, status_1]) }
let(:restore_target) { File.realpath(Dir.mktmpdir('files-target-restore')) }
let(:tmp_backup_restore_dir) { Dir.mktmpdir('files-target-restore') }
let(:restore_target) { File.realpath(tmp_backup_restore_dir) }
let(:backup_target) do
tmpdir = Dir.mktmpdir('files-target-backup')
%w[@pages.tmp lost+found @hashed].each do |folder|
path = Pathname(tmpdir).join(folder, 'something', 'else')
path = Pathname(tmp_backup_restore_dir).join(folder, 'something', 'else')
FileUtils.mkdir_p(path)
FileUtils.touch(path.join('artifacts.zip'))
end
File.realpath(tmpdir)
File.realpath(tmp_backup_restore_dir)
end
before do
......@@ -36,8 +35,7 @@
end
after do
FileUtils.rm_rf(restore_target)
FileUtils.rm_rf(backup_target)
FileUtils.rm_rf([restore_target, backup_target], secure: true)
end
describe '#restore' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册