summaryrefslogtreecommitdiffstats
path: root/test/server
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-14 03:10:20 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-14 03:10:20 +0000
commit8ff418c94b7c69ec38b4723ef0dc039554da44ef (patch)
tree0d38b1ea79afb591f8ecf5cb0ab1a31ed953a619 /test/server
parentcf5291a355dcdb92c0de4564633a30a4933f6b69 (diff)
downloadpuppet-8ff418c94b7c69ec38b4723ef0dc039554da44ef.tar.gz
puppet-8ff418c94b7c69ec38b4723ef0dc039554da44ef.tar.xz
puppet-8ff418c94b7c69ec38b4723ef0dc039554da44ef.zip
Fixing the problem with fileserver expansions, and doing a bit of refactoring to make things clearer
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1587 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/server')
-rwxr-xr-xtest/server/fileserver.rb59
1 files changed, 55 insertions, 4 deletions
diff --git a/test/server/fileserver.rb b/test/server/fileserver.rb
index a62d8da4e..3d05218a4 100755
--- a/test/server/fileserver.rb
+++ b/test/server/fileserver.rb
@@ -934,12 +934,11 @@ allow *
end
def test_mount_expand
- mclass = Puppet::Server::FileServer::Mount
-
+ mount = mkmount()
check = proc do |client, pattern, repl|
path = "/my/#{pattern}/file"
- assert_equal("/my/#{repl}/file", mclass.expand(path, client))
+ assert_equal("/my/#{repl}/file", mount.expand(path, client))
end
# Do a round of checks with a fake client
@@ -950,10 +949,11 @@ allow *
"%%" => "%", # escape
"%o" => "%o" # other
}.each do |pat, repl|
- check.call(client, pat, repl)
+ result = check.call(client, pat, repl)
end
# Now, check that they use Facter info
+ Puppet.notice "The following messages are normal"
client = nil
local = Facter["hostname"].value
domain = Facter["domain"].value
@@ -968,6 +968,57 @@ allow *
end
end
+
+ def test_fileserver_expansion
+ server = nil
+ assert_nothing_raised {
+ server = Puppet::Server::FileServer.new(
+ :Local => true,
+ :Config => false
+ )
+ }
+
+ dir = tempfile()
+ ip = Facter.value(:ipaddress)
+
+ Dir.mkdir(dir)
+ host = "host.domain.com"
+ {
+ "%H" => "host.domain.com", "%h" => "host", "%d" => "domain.com"
+ }.each do |pattern, string|
+ file = File.join(dir, string)
+ mount = File.join(dir, pattern)
+ File.open(file, "w") do |f| f.puts "yayness: %s" % string end
+ name = "name"
+ obj = nil
+ assert_nothing_raised {
+ obj = server.mount(mount, name)
+ }
+ obj.allow "*"
+
+ ret = nil
+ assert_nothing_raised do
+ ret = server.list("/name", :ignore, false, false, host, ip)
+ end
+
+ assert_equal("/\tfile", ret)
+
+ assert_nothing_raised do
+ ret = server.describe("/name", :ignore, host, ip)
+ end
+ assert(ret =~ /\tfile\t/, "Did not get valid a description")
+
+ assert_nothing_raised do
+ ret = server.retrieve("/name", :ignore, host, ip)
+ end
+
+ assert_equal(ret, File.read(file))
+
+ server.umount(name)
+
+ File.unlink(file)
+ end
+ end
end
# $Id$