~ubuntu-branches/ubuntu/quantal/puppet/quantal

« back to all changes in this revision

Viewing changes to acceptance/tests/resource/cron/should_update_existing.rb

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-07-14 01:56:30 UTC
  • mfrom: (1.1.29) (3.1.43 sid)
  • Revision ID: package-import@ubuntu.com-20120714015630-ntj41rkvkq4zph4y
Tags: 2.7.18-1ubuntu1
* Resynchronise with Debian. (LP: #1023931) Remaining changes:
  - debian/puppetmaster-passenger.postinst: Make sure we error if puppet
    config print doesn't work
  - debian/puppetmaster-passenger.postinst: Ensure upgrades from
    <= 2.7.11-1 fixup passenger apache configuration.
* Dropped upstreamed patches:
  - debian/patches/CVE-2012-1906_CVE-2012-1986_to_CVE-2012-1989.patch
  - debian/patches/puppet-12844
  - debian/patches/2.7.17-Puppet-July-2012-CVE-fixes.patch
* Drop Build-Depends on ruby-rspec (in universe):
  - debian/control: remove ruby-rspec from Build-Depends
  - debian/patches/no-rspec.patch: make Rakefile work anyway if rspec
    isn't installed so we can use it in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
test_name "puppet should update existing crontab entry"
2
 
 
3
 
tmpuser = "pl#{rand(999999).to_i}"
4
 
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
5
 
 
6
 
create_user = "user { '#{tmpuser}': ensure => present, managehome => false }"
7
 
delete_user = "user { '#{tmpuser}': ensure => absent,  managehome => false }"
8
 
 
9
 
agents.each do |host|
10
 
    step "ensure the user exist via puppet"
11
 
    apply_manifest_on host, create_user
12
 
 
13
 
    step "create the existing job by hand..."
14
 
    run_cron_on(host,:add,tmpuser,"* * * * * /bin/true")
15
 
 
16
 
    step "verify that crontab -l contains what you expected"
17
 
    run_cron_on(host,:list,tmpuser) do
18
 
      assert_match(/\* \* \* \* \* \/bin\/true/, stdout, "Didn't find correct crobtab entry for #{tmpuser} on #{host}")
19
 
    end
20
 
 
21
 
    step "apply the resource change on the host"
22
 
    on(host, puppet_resource("cron", "crontest", "user=#{tmpuser}",
23
 
      "command=/bin/true", "ensure=present", "hour='0-6'")) do
24
 
        assert_match(/hour\s+=>\s+\['0-6'\]/, stdout, "Modifying cron entry failed for #{tmpuser} on #{host}")
25
 
    end
26
 
 
27
 
    step "verify that crontab -l contains what you expected"
28
 
    run_cron_on(host,:list,tmpuser) do
29
 
      assert_match(/\* 0-6 \* \* \* \/bin\/true/, stdout, "Didn't find correctly modified time entry in crobtab entry for #{tmpuser} on #{host}")
30
 
    end
31
 
 
32
 
    step "remove the crontab file for that user"
33
 
    run_cron_on(host,:remove,tmpuser)
34
 
 
35
 
    step "remove the user from the system"
36
 
    apply_manifest_on host, delete_user
37
 
end