diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-02 22:04:31 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-02 22:04:31 +0000 |
| commit | 3c14db187d68bcfebbd5cd017f1b38326645b07d (patch) | |
| tree | 7389271aa90a853faae9aadc0ca7d5fda7bfc1bb /test | |
| parent | 5ce5b95af489685f64dbaa6189f7569e976e9dc5 (diff) | |
| download | puppet-3c14db187d68bcfebbd5cd017f1b38326645b07d.tar.gz puppet-3c14db187d68bcfebbd5cd017f1b38326645b07d.tar.xz puppet-3c14db187d68bcfebbd5cd017f1b38326645b07d.zip | |
adding Util.lock, and switching storage to using it
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@758 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/storage.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/other/storage.rb b/test/other/storage.rb index aa010b7f3..787fe9cdd 100755 --- a/test/other/storage.rb +++ b/test/other/storage.rb @@ -34,6 +34,27 @@ class TestParsedFile < Test::Unit::TestCase assert_equal(state["name"], hash) end + + # we're getting corrupt files, probably because multiple processes + # are reading or writing the file at once + # so we need to test that + def test_multiwrite + value = {:a => :b, :c => :d} + threads = [] + 9.times { |a| + threads << Thread.new { + 9.times { |b| + assert_nothing_raised { + Puppet::Storage.load + state = Puppet::Storage.state(value) + state[:e] = rand(100) + Puppet::Storage.store + } + } + } + } + threads.each { |th| th.join } + end end # $Id$ |
