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

« back to all changes in this revision

Viewing changes to acceptance/tests/resource/host/should_query_all.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 "should query all hosts from hosts file"
2
 
 
3
 
content = %q{127.0.0.1 test1 test1.local
4
 
127.0.0.2 test2 test2.local
5
 
127.0.0.3 test3 test3.local
6
 
127.0.0.4 test4 test4.local
7
 
}
8
 
 
9
 
backup = "/tmp/hosts.backup-#{Time.new.to_i}"
10
 
 
11
 
step "configure the system for testing (including file backups)"
12
 
on agents, "cp /etc/hosts #{backup}"
13
 
on agents, "cat > /etc/hosts", :stdin => content
14
 
 
15
 
step "query all host records using puppet"
16
 
on(agents, puppet_resource('host')) do
17
 
    found = stdout.scan(/host \{ '([^']+)'/).flatten.sort
18
 
    fail_test "the list of returned hosts was wrong: #{found.join(', ')}" unless
19
 
        found == %w{test1 test2 test3 test4}
20
 
 
21
 
    count = stdout.scan(/ensure\s+=>\s+'present'/).length
22
 
    fail_test "found #{count} records, wanted 4" unless count == 4
23
 
end
24
 
 
25
 
step "clean up the system afterwards"
26
 
on agents, "mv -f #{backup} /etc/hosts"