summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-08-31 11:46:36 -0700
committerPaul Berry <paul@puppetlabs.com>2010-08-31 11:46:36 -0700
commit1ba536eb533e99d0f400178184ce929f18457b03 (patch)
tree0c6ce7f8a33bc9231e979592a965f3fd8a49c8b3 /test
parentfb9034731ddae41f1009745eb8eb1ea53aa05cfb (diff)
downloadpuppet-1ba536eb533e99d0f400178184ce929f18457b03.tar.gz
puppet-1ba536eb533e99d0f400178184ce929f18457b03.tar.xz
puppet-1ba536eb533e99d0f400178184ce929f18457b03.zip
[3782] Test isolation problem in test/ral/providers/cron/crontab.rb
The test in question (test_parse_line) was nondeterministic because it was relying on the sort order of a Hash whose keys were symbols. When the sort order caused a blank line to appear at the end of the file under test, the blank line was elided by the crontab parser, causing a failure. Modified the test to execute in a deterministic order that doesn't place the blank line at the end.
Diffstat (limited to 'test')
-rwxr-xr-xtest/ral/providers/cron/crontab.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb
index 0c87a5bba..be2af1e16 100755
--- a/test/ral/providers/cron/crontab.rb
+++ b/test/ral/providers/cron/crontab.rb
@@ -97,7 +97,10 @@ class TestCronParsedProvider < Test::Unit::TestCase
# Then do them all at once.
records = []
text = ""
- sample_records.each do |name, options|
+ # Sort sample_records so that the :empty entry does not come last
+ # (if it does, the test will fail because the empty last line will
+ # be ignored)
+ sample_records.sort { |a, b| a.first.to_s <=> b.first.to_s }.each do |name, options|
records << options[:record]
text += options[:text] + "\n"
end