blob: 4c1d2a24c774f8a9407176f0a676b8b3e68225f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
if __FILE__ == $0
$:.unshift '../../lib'
$:.unshift '..'
$puppetbase = "../.."
end
require 'puppet'
require 'puppet/server'
require 'puppet/sslcertificates'
require 'test/unit'
require 'puppettest.rb'
# add the bin directory to our search path
ENV["PATH"] += ":" + File.join($puppetbase, "bin")
# and then the library directories
libdirs = $:.find_all { |dir|
dir =~ /puppet/ or dir =~ /\.\./
}
ENV["RUBYLIB"] = libdirs.join(":")
class TestPuppetBin < Test::Unit::TestCase
include ServerTest
def test_version
output = nil
assert_nothing_raised {
output = %x{puppet --version}.chomp
}
assert(output == Puppet.version)
end
def test_execution
file = mktestmanifest()
@@tmpfiles << "/tmp/puppetbintesting"
output = nil
cmd = "puppet"
cmd += " --verbose"
#cmd += " --fqdn %s" % fqdn
cmd += " --confdir %s" % Puppet[:puppetconf]
cmd += " --vardir %s" % Puppet[:puppetvar]
cmd += " --logdest %s" % "/dev/null"
assert_nothing_raised {
system(cmd + " " + file)
}
assert($? == 0, "Puppet exited with code %s" % $?.to_i)
assert(FileTest.exists?(@createdfile), "Failed to create config'ed file")
end
end
# $Id: $
|