From cf19bd8dea141a59cdff5a7f1edc56d3620ab0e2 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 15 Dec 2008 00:22:09 -0600 Subject: Not using a temporary file when locking files for writing. The temporary file was not actually useful, because we could never really get atomic renames, for annoying, complicated reasons. This hopefully finally fixes #1812. Signed-off-by: Luke Kanies --- spec/integration/util/file_locking.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/integration') diff --git a/spec/integration/util/file_locking.rb b/spec/integration/util/file_locking.rb index f8e21ed6e..680b3d1ed 100755 --- a/spec/integration/util/file_locking.rb +++ b/spec/integration/util/file_locking.rb @@ -9,9 +9,9 @@ describe Puppet::Util::FileLocking do file = Tempfile.new("puppetspec") file.close!() file = file.path - File.open(file, "w") { |f| f.puts "starting" } - data = {:a => :b, :c => "A string", :d => "another string", :e => %w{an array of strings}} + File.open(file, "w") { |f| f.puts YAML.dump(data) } + threads = [] sync = Sync.new 9.times { |a| @@ -19,7 +19,7 @@ describe Puppet::Util::FileLocking do 9.times { |b| sync.synchronize(Sync::SH) { Puppet::Util::FileLocking.readlock(file) { |f| - YAML.load(f.read) + YAML.load(f.read).should == data } } sleep 0.01 -- cgit