Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(maint) update cron whitespace strip acceptance test
Since f5d2367 leading and trailing whitespace was stripped from the
cron command to ensure writing cron entries is idempotent. This made the
cron `should_not_rewrite_with_trailing_whitespace.rb` acceptance test
meaningless. This commit updates the acceptance test to confirm the fix
for #656 and updates the test name to reflect the expected behavior.
  • Loading branch information
adrienthebo committed Mar 28, 2013
1 parent 91fa7f1 commit 8ccb4fa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.

This file was deleted.

@@ -0,0 +1,34 @@
test_name "(#656) leading and trailing whitespace in cron entries should should be stripped"
confine :except, :platform => 'windows'

require 'puppet/acceptance/common_utils'
extend Puppet::Acceptance::CronUtils

agents.each do |host|
step "create user account for testing cron entries"
setup host
teardown do
step "tear down user account for cron entries"
clean host
end

step "apply the resource on the host using puppet resource"
on(host, puppet_resource("cron", "crontest", "user=tstuser", "command=' date > /dev/null '", "ensure=present")) do
assert_match(/created/, stdout, "Did not create crontab for tstuser on #{host}")
end

step "verify the added crontab entry has stripped whitespace"
run_cron_on(host, :list, 'tstuser') do
assert_match(/\* \* \* \* \* date > .dev.null/, stdout, "Incorrect crontab for tstuser on #{host}")
end

step "apply the resource with trailing whitespace and check nothing happened"
on(host, puppet_resource("cron", "crontest", "user=tstuser", "command='date > /dev/null '", "ensure=present")) do
assert_no_match(/ensure: created/, stdout, "Rewrote the line with trailing space in crontab for tstuser on #{host}")
end

step "apply the resource with leading whitespace and check nothing happened"
on(host, puppet_resource("cron", "crontest", "user=tstuser", "command=' date > /dev/null'", "ensure=present")) do
assert_no_match(/ensure: created/, stdout, "Rewrote the line with trailing space in crontab for tstuser on #{host}")
end
end

0 comments on commit 8ccb4fa

Please sign in to comment.