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.

Signed-off-by: Paul Berry <[email protected]>
---
 test/ral/providers/cron/crontab.rb |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/test/ral/providers/cron/crontab.rb 
b/test/ral/providers/cron/crontab.rb
index 0c87a5b..be2af1e 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
-- 
1.7.2

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to