diff options
author | Paul Berry <paul@puppetlabs.com> | 2010-08-31 11:46:36 -0700 |
---|---|---|
committer | Paul Berry <paul@puppetlabs.com> | 2010-12-17 11:22:09 -0800 |
commit | d11ae78871cf9b65e15497e55c98851ca3cbfd15 (patch) | |
tree | 233cc56e417a2c3f91a8aad7155517b3e5684bc1 /test | |
parent | 13972f7b2ca37906ee351f3ffa69cf3000a4c54b (diff) | |
download | puppet-d11ae78871cf9b65e15497e55c98851ca3cbfd15.tar.gz puppet-d11ae78871cf9b65e15497e55c98851ca3cbfd15.tar.xz puppet-d11ae78871cf9b65e15497e55c98851ca3cbfd15.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-x | 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 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 |