~ubuntu-branches/ubuntu/quantal/puppet/quantal

« back to all changes in this revision

Viewing changes to spec/unit/parser/resource_spec.rb

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-07-14 01:56:30 UTC
  • mfrom: (1.1.29) (3.1.43 sid)
  • Revision ID: package-import@ubuntu.com-20120714015630-ntj41rkvkq4zph4y
Tags: 2.7.18-1ubuntu1
* Resynchronise with Debian. (LP: #1023931) 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.
* Dropped upstreamed patches:
  - debian/patches/CVE-2012-1906_CVE-2012-1986_to_CVE-2012-1989.patch
  - debian/patches/puppet-12844
  - debian/patches/2.7.17-Puppet-July-2012-CVE-fixes.patch
* 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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
      @compiler.catalog.should be_edge(foo_stage, resource)
201
201
    end
202
202
 
 
203
    it "should allow edges to propagate multiple levels down the scope hierarchy" do
 
204
      Puppet[:code] = <<-MANIFEST
 
205
        stage { before: before => Stage[main] }
 
206
 
 
207
        class alpha {
 
208
          include beta
 
209
        }
 
210
        class beta {
 
211
          include gamma
 
212
        }
 
213
        class gamma { }
 
214
        class { alpha: stage => before }
 
215
      MANIFEST
 
216
 
 
217
      catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new 'anyone')
 
218
 
 
219
      # Stringify them to make for easier lookup
 
220
      edges = catalog.edges.map {|e| [e.source.ref, e.target.ref]}
 
221
 
 
222
      edges.should include(["Stage[before]", "Class[Alpha]"])
 
223
      edges.should include(["Stage[before]", "Class[Beta]"])
 
224
      edges.should include(["Stage[before]", "Class[Gamma]"])
 
225
    end
 
226
 
 
227
    it "should use the specified stage even if the parent scope specifies one" do
 
228
      Puppet[:code] = <<-MANIFEST
 
229
        stage { before: before => Stage[main], }
 
230
        stage { after: require => Stage[main], }
 
231
 
 
232
        class alpha {
 
233
          class { beta: stage => after }
 
234
        }
 
235
        class beta { }
 
236
        class { alpha: stage => before }
 
237
      MANIFEST
 
238
 
 
239
      catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new 'anyone')
 
240
 
 
241
      edges = catalog.edges.map {|e| [e.source.ref, e.target.ref]}
 
242
 
 
243
      edges.should include(["Stage[before]", "Class[Alpha]"])
 
244
      edges.should include(["Stage[after]", "Class[Beta]"])
 
245
    end
 
246
 
203
247
    it "should add edges from top-level class resources to the main stage if no stage is specified", :'fails_on_ruby_1.9.2' => true do
204
248
      main = @compiler.catalog.resource(:stage, :main)
205
249
      @compiler.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "foo", '')