~nvalcarcel/ubuntu/lucid/puppet/fix-546677

« back to all changes in this revision

Viewing changes to test/executables/puppetd.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-12-23 00:48:10 UTC
  • mfrom: (1.1.10 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091223004810-3i4oryds922g5n59
Tags: 0.25.1-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - debian/rules:
    + Don't start puppet when first installing puppet.
  - debian/puppet.conf, lib/puppet/defaults.rb:
    + Move templates to /etc/puppet
  - lib/puppet/defaults.rb:
    + Fix /var/lib/puppet/state ownership.
  - man/man8/puppet.conf.8: 
    + Fix broken URL in manpage.
  - debian/control:
    + Update maintainer accordint to spec.
    + Puppetmaster Recommends -> Suggests
    + Created puppet-testsuite as a seperate. Allow the users to run puppet's 
      testsuite.
  - tests/Rakefile: Fix rakefile so that the testsuite can acutally be ran.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env ruby
2
 
 
3
 
require File.dirname(__FILE__) + '/../lib/puppettest'
4
 
 
5
 
require 'puppet'
6
 
require 'puppet/network/client'
7
 
require 'puppettest'
8
 
require 'socket'
9
 
require 'facter'
10
 
 
11
 
class TestPuppetDExe < Test::Unit::TestCase
12
 
    include PuppetTest::ExeTest
13
 
    def setup
14
 
        super
15
 
        Puppet[:certdnsnames] = "localhost"
16
 
        # start the master
17
 
        @manifest = startmasterd
18
 
 
19
 
 
20
 
        @cmd = "puppetd"
21
 
        @cmd += " --verbose"
22
 
        @cmd += " --test"
23
 
        @cmd += " --masterport %s" % @@port
24
 
        @cmd += " --confdir %s" % Puppet[:confdir]
25
 
        @cmd += " --rundir %s" % File.join(Puppet[:vardir], "run")
26
 
        @cmd += " --vardir %s" % Puppet[:vardir]
27
 
        @cmd += " --server localhost"
28
 
    end
29
 
 
30
 
    def test_normalstart
31
 
        # and verify our daemon runs
32
 
        output = nil
33
 
        assert_nothing_raised {
34
 
            output = %x{#{@cmd} 2>&1}
35
 
        }
36
 
        sleep 1
37
 
        assert($? == 0, "Puppetd exited with code %s" % $?)
38
 
 
39
 
        assert(FileTest.exists?(@createdfile), "Failed to create file %s" % @createdfile)
40
 
    end
41
 
 
42
 
    # now verify that --noop works
43
 
    def test_noop_start
44
 
        @cmd += " --noop"
45
 
        assert_nothing_raised {
46
 
            output = %x{#{@cmd}}.chomp
47
 
        }
48
 
        sleep 1
49
 
        assert($? == 0, "Puppetd exited with code %s" % $?)
50
 
 
51
 
        assert(! FileTest.exists?(@createdfile),
52
 
            "Noop created config'ed file")
53
 
    end
54
 
end
55