[Pkg-puppet-devel] [facter] 53/180: (maint) Don't evaluate ec2_metadata fact when loading for tests

Stig Sandbeck Mathisen ssm at debian.org
Mon Jun 30 15:06:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit b9e5e6d062db52c6b9e5d715cee858e41b151fa0
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Wed Apr 16 15:23:40 2014 -0700

    (maint) Don't evaluate ec2_metadata fact when loading for tests
---
 spec/unit/ec2_spec.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/spec/unit/ec2_spec.rb b/spec/unit/ec2_spec.rb
index bf2aa2f..109c970 100755
--- a/spec/unit/ec2_spec.rb
+++ b/spec/unit/ec2_spec.rb
@@ -7,11 +7,14 @@ describe "ec2_metadata" do
   before do
     Facter::EC2::Metadata.stubs(:new).returns querier
     Facter.collection.internal_loader.load(:ec2)
+    # Prevent flattened facts from forcing evaluation of the ec2 metadata fact
+    Facter.stubs(:value).with(:ec2_metadata)
   end
 
   subject { Facter.fact(:ec2_metadata).resolution(:rest) }
 
   it "is unsuitable if the virtual fact is not xen" do
+    querier.stubs(:reachable?).returns false
     Facter.fact(:virtual).stubs(:value).returns "kvm"
     expect(subject).to_not be_suitable
   end
@@ -57,6 +60,7 @@ describe "ec2_userdata" do
   subject { Facter.fact(:ec2_userdata).resolution(:rest) }
 
   it "is unsuitable if the virtual fact is not xen" do
+    querier.stubs(:reachable?).returns(true)
     Facter.fact(:virtual).stubs(:value).returns "kvm"
     expect(subject).to_not be_suitable
   end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list