summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-23 22:00:19 -0500
committerLuke Kanies <luke@madstop.com>2008-08-26 22:40:40 -0700
commita0bda8532f5e1e9f5bb29eb92f389383ae0857d5 (patch)
treed72d17177926d38773c30614ba52f94ae64ea33b
parent6335b143a312481aaa200f71cd25dffd4f88c8ae (diff)
downloadpuppet-a0bda8532f5e1e9f5bb29eb92f389383ae0857d5.tar.gz
puppet-a0bda8532f5e1e9f5bb29eb92f389383ae0857d5.tar.xz
puppet-a0bda8532f5e1e9f5bb29eb92f389383ae0857d5.zip
Removing the yaml conversion code from FileContent.
Also fixing some integration tests that were failing because of the change to the terminus selection code for file serving. Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r--lib/puppet/file_serving/content.rb8
-rwxr-xr-xspec/integration/file_serving/content.rb2
-rw-r--r--spec/shared_behaviours/file_serving.rb23
-rwxr-xr-xspec/unit/file_serving/content.rb24
4 files changed, 11 insertions, 46 deletions
diff --git a/lib/puppet/file_serving/content.rb b/lib/puppet/file_serving/content.rb
index 9398513e7..1114829f1 100644
--- a/lib/puppet/file_serving/content.rb
+++ b/lib/puppet/file_serving/content.rb
@@ -23,12 +23,4 @@ class Puppet::FileServing::Content < Puppet::FileServing::FileBase
::File.read(full_path())
end
-
- # Just return the file contents as the yaml. This allows us to
- # avoid escaping or any such thing. LAK:NOTE Not really sure how
- # this will behave if the file contains yaml... I think the far
- # side needs to understand that it's a plain string.
- def to_yaml
- content
- end
end
diff --git a/spec/integration/file_serving/content.rb b/spec/integration/file_serving/content.rb
index aee2a9f2d..af0181393 100755
--- a/spec/integration/file_serving/content.rb
+++ b/spec/integration/file_serving/content.rb
@@ -15,4 +15,6 @@ describe Puppet::FileServing::Content, " when finding files" do
@test_class = Puppet::FileServing::Content
@indirection = Puppet::FileServing::Content.indirection
end
+
+ after { Puppet::Util::Cacher.invalidate }
end
diff --git a/spec/shared_behaviours/file_serving.rb b/spec/shared_behaviours/file_serving.rb
index ba01f75a1..99994b99a 100644
--- a/spec/shared_behaviours/file_serving.rb
+++ b/spec/shared_behaviours/file_serving.rb
@@ -6,12 +6,18 @@
describe "Puppet::FileServing::Files", :shared => true do
it "should use the rest terminus when the 'puppet' URI scheme is used and a host name is present" do
uri = "puppet://myhost/fakemod/my/file"
- @indirection.terminus(:rest).expects(:find)
+
+ # It appears that the mocking somehow interferes with the caching subsystem.
+ # This mock somehow causes another terminus to get generated.
+ term = @indirection.terminus(:rest)
+ @indirection.stubs(:terminus).with(:rest).returns term
+ term.expects(:find)
@test_class.find(uri)
end
it "should use the rest terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is not 'puppet'" do
uri = "puppet:///fakemod/my/file"
+ Puppet.settings.stubs(:value).returns "foo"
Puppet.settings.stubs(:value).with(:name).returns("puppetd")
Puppet.settings.stubs(:value).with(:modulepath).returns("")
@indirection.terminus(:rest).expects(:find)
@@ -21,19 +27,9 @@ describe "Puppet::FileServing::Files", :shared => true do
it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'puppet'" do
uri = "puppet:///fakemod/my/file"
Puppet::Node::Environment.stubs(:new).returns(stub("env", :name => "testing"))
+ Puppet.settings.stubs(:value).returns ""
Puppet.settings.stubs(:value).with(:name).returns("puppet")
- Puppet.settings.stubs(:value).with(:modulepath, "testing").returns("")
- Puppet.settings.stubs(:value).with(:modulepath).returns("")
- Puppet.settings.stubs(:value).with(:libdir).returns("")
Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever")
- Puppet.settings.stubs(:value).with(:environment).returns("")
- @indirection.terminus(:file_server).expects(:find)
- @indirection.terminus(:file_server).stubs(:authorized?).returns(true)
- @test_class.find(uri)
- end
-
- it "should use the file_server terminus when the 'puppetmounts' URI scheme is used" do
- uri = "puppetmounts:///fakemod/my/file"
@indirection.terminus(:file_server).expects(:find)
@indirection.terminus(:file_server).stubs(:authorized?).returns(true)
@test_class.find(uri)
@@ -52,7 +48,7 @@ describe "Puppet::FileServing::Files", :shared => true do
end
it "should use the configuration to test whether the request is allowed" do
- uri = "puppetmounts:///fakemod/my/file"
+ uri = "fakemod/my/file"
config = mock 'configuration'
@indirection.terminus(:file_server).stubs(:configuration).returns config
@@ -61,4 +57,3 @@ describe "Puppet::FileServing::Files", :shared => true do
@test_class.find(uri, :node => "foo", :ip => "bar")
end
end
-
diff --git a/spec/unit/file_serving/content.rb b/spec/unit/file_serving/content.rb
index 5444f4abd..e8de1d63e 100755
--- a/spec/unit/file_serving/content.rb
+++ b/spec/unit/file_serving/content.rb
@@ -45,27 +45,3 @@ describe Puppet::FileServing::Content, "when returning the contents" do
@content.content.should == :mycontent
end
end
-
-describe Puppet::FileServing::Content, "when converting to yaml" do
- it "should fail if no path has been set" do
- @content = Puppet::FileServing::Content.new("some/key")
- proc { @content.to_yaml }.should raise_error(ArgumentError)
- end
-
- it "should return the file contents" do
- @content = Puppet::FileServing::Content.new("some/path")
- @content.path = "/base/path"
- @content.expects(:content).returns(:content)
- @content.to_yaml.should == :content
- end
-end
-
-describe Puppet::FileServing::Content, "when converting from yaml" do
- # LAK:FIXME This isn't in the right place, but we need some kind of
- # control somewhere that requires that all REST connections only pull
- # from the file-server, thus guaranteeing they go through our authorization
- # hook.
- it "should set the URI scheme to 'puppetmounts'" do
- pending "We need to figure out where this should be"
- end
-end