summaryrefslogtreecommitdiffstats
path: root/spec/integration/util
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-15 00:22:09 -0600
committerJames Turnbull <james@lovedthanlost.net>2008-12-15 19:27:45 +1100
commitcf19bd8dea141a59cdff5a7f1edc56d3620ab0e2 (patch)
treed921ad9b313ed11efbf6d301af478e61efccd155 /spec/integration/util
parentb966ea02a9deeb947bd6153c4cd7c53b1ddff3d8 (diff)
downloadpuppet-cf19bd8dea141a59cdff5a7f1edc56d3620ab0e2.tar.gz
puppet-cf19bd8dea141a59cdff5a7f1edc56d3620ab0e2.tar.xz
puppet-cf19bd8dea141a59cdff5a7f1edc56d3620ab0e2.zip
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 <luke@madstop.com>
Diffstat (limited to 'spec/integration/util')
-rwxr-xr-xspec/integration/util/file_locking.rb6
1 files changed, 3 insertions, 3 deletions
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