~ubuntu-branches/ubuntu/trusty/puppet/trusty

« back to all changes in this revision

Viewing changes to .pc/2.7.18-CVE-Rollup.patch/spec/integration/indirector/catalog/compiler_spec.rb

  • Committer: Package Import Robot
  • Author(s): Robie Basak
  • Date: 2013-04-08 15:03:25 UTC
  • mfrom: (3.1.46 sid)
  • Revision ID: package-import@ubuntu.com-20130408150325-4o91hljzz2zca5fi
Tags: 2.7.18-4ubuntu1
* Merge from Debian unstable. This merges the vim addon fix in 2.7.18-2
  (LP: #1163927). Remaining changes:
  - debian/puppetmaster-passenger.postinst: Make sure we error if puppet
    config print doesn't work
  - debian/puppetmaster-passenger.postinst: Ensure upgrades from
    <= 2.7.11-1 fixup passenger apache configuration.
  - Drop Build-Depends on ruby-rspec (in universe):
    + debian/control: remove ruby-rspec from Build-Depends
    + debian/patches/no-rspec.patch: make Rakefile work anyway if rspec
      isn't installed so we can use it in debian/rules.
* Drop upstreamed patches:
  - debian/patches/security-mar-2013.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env rspec
 
2
require 'spec_helper'
 
3
 
 
4
require 'puppet/resource/catalog'
 
5
 
 
6
Puppet::Resource::Catalog.indirection.terminus(:compiler)
 
7
 
 
8
describe Puppet::Resource::Catalog::Compiler do
 
9
  before do
 
10
    Facter.stubs(:value).returns "something"
 
11
    @catalog = Puppet::Resource::Catalog.new
 
12
    @catalog.add_resource(@one = Puppet::Resource.new(:file, "/one"))
 
13
    @catalog.add_resource(@two = Puppet::Resource.new(:file, "/two"))
 
14
  end
 
15
 
 
16
  after { Puppet.settings.clear }
 
17
 
 
18
  it "should remove virtual resources when filtering" do
 
19
    @one.virtual = true
 
20
    Puppet::Resource::Catalog.indirection.terminus.filter(@catalog).resource_refs.should == [ @two.ref ]
 
21
  end
 
22
 
 
23
  it "should not remove exported resources when filtering" do
 
24
    @one.exported = true
 
25
    Puppet::Resource::Catalog.indirection.terminus.filter(@catalog).resource_refs.sort.should == [ @one.ref, @two.ref ]
 
26
  end
 
27
 
 
28
  it "should remove virtual exported resources when filtering" do
 
29
    @one.exported = true
 
30
    @one.virtual = true
 
31
    Puppet::Resource::Catalog.indirection.terminus.filter(@catalog).resource_refs.should == [ @two.ref ]
 
32
  end
 
33
 
 
34
  it "should filter out virtual resources when finding a catalog" do
 
35
    @one.virtual = true
 
36
    request = stub 'request', :name => "mynode"
 
37
    Puppet::Resource::Catalog.indirection.terminus.stubs(:extract_facts_from_request)
 
38
    Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request)
 
39
    Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog)
 
40
 
 
41
    Puppet::Resource::Catalog.indirection.find(request).resource_refs.should == [ @two.ref ]
 
42
  end
 
43
 
 
44
  it "should not filter out exported resources when finding a catalog" do
 
45
    @one.exported = true
 
46
    request = stub 'request', :name => "mynode"
 
47
    Puppet::Resource::Catalog.indirection.terminus.stubs(:extract_facts_from_request)
 
48
    Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request)
 
49
    Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog)
 
50
 
 
51
    Puppet::Resource::Catalog.indirection.find(request).resource_refs.sort.should == [ @one.ref, @two.ref ]
 
52
  end
 
53
 
 
54
  it "should filter out virtual exported resources when finding a catalog" do
 
55
    @one.exported = true
 
56
    @one.virtual = true
 
57
    request = stub 'request', :name => "mynode"
 
58
    Puppet::Resource::Catalog.indirection.terminus.stubs(:extract_facts_from_request)
 
59
    Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request)
 
60
    Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog)
 
61
 
 
62
    Puppet::Resource::Catalog.indirection.find(request).resource_refs.should == [ @two.ref ]
 
63
  end
 
64
end