Betriebssicherheit: Sperre gegen parallele Läufe, Upsert, Batch-Schreiben für Postgres, Zeichensatz für CSV
This commit is contained in:
@@ -86,4 +86,30 @@ class EtlCliTest < PipelineTest
|
||||
assert_includes err, 'Usage: etl [run] PIPELINE.rb'
|
||||
end
|
||||
end
|
||||
|
||||
def test_lock_exit_code_3
|
||||
with_tmpdir do |dir|
|
||||
path = script(dir, 'locked.rb', <<~RUBY)
|
||||
DataPipeline.new do
|
||||
lock '.pipeline.lock'
|
||||
read container(:csv, file: 'in.csv')
|
||||
write container(:csv, file: 'out.csv')
|
||||
end.run
|
||||
RUBY
|
||||
holder = DataPipeline::Lock.new("#{dir}/.script.lock").acquire
|
||||
_out, err, status = etl(dir, 'run', path, '--lock=.script.lock')
|
||||
assert_equal 3, status.exitstatus, err
|
||||
assert_includes err, 'another run is still active'
|
||||
refute File.exist?("#{dir}/out.csv")
|
||||
holder.release
|
||||
|
||||
holder = DataPipeline::Lock.new("#{dir}/.pipeline.lock").acquire
|
||||
_out, err, status = etl(dir, 'run', path, '--lock=.script.lock')
|
||||
assert_equal 3, status.exitstatus, err
|
||||
holder.release
|
||||
|
||||
_out, err, status = etl(dir, 'run', path, '--lock=.script.lock')
|
||||
assert_equal 0, status.exitstatus, err
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user