summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/handler
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-08-15 10:36:03 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-08-15 10:36:03 -0700
commite7d5c7c1cd4109d7bb061a503f5da8777a1be66d (patch)
tree6aace815f8c3fe30d4ad7eefbda8af141b78482f /spec/unit/network/handler
parenta71573cb32f01e5bf5f1a5030c6a291ce5b63370 (diff)
parentfa1ec4dd93f015c2943271c9ae107991c6d3c90e (diff)
Merge branch '2.7.x'
* 2.7.x: (25 commits) (#4411) Explain that runinterval = 0 does not mean "never run" Maint: Fix missing option text in puppet agent and arrange options alphabetically (#8302) Improve documentation of exec providers (#7853) Clarify and complete docs for the tagmail report processor Maint: Mention that audit metaparameter will accept "all" Maint: Adjust wording for file type's content parameter Maint: Fix poor documentation for versioncmp function. maint: Fix case sensitive require maint: Add inspect app options to help maint: Fix inspect help Increment lib/puppet.rb VERSION string Updated CHANGELOG for 2.7.3rc1 (#4762) Ensure that clients on the moon can successfully connect. Add document outlining preferred contribution methods Add document outlining preferred contribution methods Add document outlining preferred contribution methods Revert "Merge branch 'vcsrepo'" Revert "Merge branch 'vcsrepo'" Updating CHANGELOG for 2.7.2rc3 (#8704) Give better errors for invalid fileserver.conf ... Manually Resolved Conflicts: lib/puppet/parser/functions/versioncmp.rb spec/integration/node/facts_spec.rb
Diffstat (limited to 'spec/unit/network/handler')
-rwxr-xr-xspec/unit/network/handler/fileserver_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb
index 93f124882..2b8094b8b 100755
--- a/spec/unit/network/handler/fileserver_spec.rb
+++ b/spec/unit/network/handler/fileserver_spec.rb
@@ -25,6 +25,38 @@ describe Puppet::Network::Handler::FileServer do
@mount = Puppet::Network::Handler::FileServer::Mount.new("some_path", @basedir)
end
+ describe "when parsing the fileserver.conf" do
+ it "should create a valid mount when a valid conf is read" do
+ config_file = tmpfile('fileserver.conf')
+ mountdir = tmpdir('mountdir')
+
+ conf_text = <<-HEREDOC
+ [mymount]
+ path #{mountdir}
+ allow anyone.com
+ deny nobody.com
+ HEREDOC
+ File.open(config_file, 'w') { |f| f.write conf_text }
+
+ fs = Puppet::Network::Handler::FileServer.new(:Config => config_file)
+ mounts = fs.instance_variable_get(:@mounts)
+ mount = mounts["mymount"]
+ mount.path == mountdir
+ mount.instance_variable_get(:@declarations).map {|d| d.pattern}.should =~ [["com", "nobody"], ["com", "anyone"]]
+ end
+
+ ['path', 'allow', 'deny'].each do |arg|
+ it "should error if config file doesn't specify a mount for #{arg} argument" do
+ config_file = tmpfile('fileserver.conf')
+ File.open(config_file, 'w') { |f| f.puts "#{arg} 127.0.0.1/24" }
+
+ expect {
+ Puppet::Network::Handler::FileServer.new(:Config => config_file)
+ }.should raise_error(Puppet::Network::Handler::FileServerError, "No mount specified for argument #{arg} 127.0.0.1/24")
+ end
+ end
+ end
+
it "should list a single directory" do
@mount.list("/", false, false).should == [["/", "directory"]]
end