summaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-12 04:12:48 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-12 04:12:48 +0000
commitbd169b44a0ce58413fb5b031c3f12cd4ca6f4cbe (patch)
tree0411a38b49c5a311819c878c475672376c0f2578 /test/lib
parent138150d1f240d3c249b2985540af1a7e327802e1 (diff)
downloadpuppet-bd169b44a0ce58413fb5b031c3f12cd4ca6f4cbe.tar.gz
puppet-bd169b44a0ce58413fb5b031c3f12cd4ca6f4cbe.tar.xz
puppet-bd169b44a0ce58413fb5b031c3f12cd4ca6f4cbe.zip
Mounts work again, at least with the parsedfile provider. I still need to create a netinfo provider, but it should be short and easy. And, painfully, I still need to port the other six or so subclasses to this new provider.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1859 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/puppettest/fileparsing.rb30
1 files changed, 14 insertions, 16 deletions
diff --git a/test/lib/puppettest/fileparsing.rb b/test/lib/puppettest/fileparsing.rb
index 004a0c3b5..9f8124df5 100644
--- a/test/lib/puppettest/fileparsing.rb
+++ b/test/lib/puppettest/fileparsing.rb
@@ -1,28 +1,26 @@
module PuppetTest::FileParsing
# Run an isomorphism test on our parsing process.
def fakedataparse(file)
- @provider.path = file
- instances = nil
+ oldtarget = @provider.default_target
+ cleanup do
+ @provider.default_target = oldtarget
+ end
+ @provider.default_target = file
+
assert_nothing_raised {
- instances = @provider.retrieve
+ @provider.prefetch
}
- text = @provider.fileobj.read
+ text = @provider.to_file(@provider.target_records(file))
yield if block_given?
- dest = tempfile()
- @provider.path = dest
-
- # Now write it back out
- assert_nothing_raised {
- @provider.store(instances)
- }
-
- newtext = @provider.fileobj.read
-
- # Don't worry about difference in whitespace
- assert_equal(text.gsub(/\s+/, ' '), newtext.gsub(/\s+/, ' '))
+ oldlines = File.readlines(file)
+ newlines = text.chomp.split "\n"
+ oldlines.zip(newlines).each do |old, new|
+ assert_equal(old.chomp.gsub(/\s+/, ''), new.gsub(/\s+/, ''),
+ "Lines are not equal")
+ end
end
end