[chef] Re: chefspec and yum


Chronological Thread 
  • From: John Dewey < >
  • To:
  • Subject: [chef] Re: chefspec and yum
  • Date: Sat, 28 Sep 2013 21:23:28 -0700

I don't believe there is a matcher for it. However, you should be able to assert the LWRP syntax via #find_resource.
We do similar with some keystone tests.
  https://github.com/stackforge/cookbook-openstack-compute/blob/master/spec/identity_registration_spec.rb

On Saturday, September 28, 2013 at 9:19 PM, Rilindo Foster wrote:

Is there a way to to write a chef spec assertion to see if the repo will be created? Here is my default.rb:

yum_repository "x2go" do
 repo_name "x2go"
 description "x2go (replaces NX)"
 url "http://download.opensuse.org/repositories/X11:/RemoteDesktop:/x2go/RHEL_6/"
 key "http://download.opensuse.org/repositories/X11:/RemoteDesktop:/x2go/RHEL_6/repodata/repomd.xml.key"
 action :add
end


And here is my current chef spec at this point:

require 'chefspec'

describe 'x2go::default' do
 let(:chef_run) {
   ChefSpec::ChefRunner.new(:step_into => ['yum_repository']).converge 'x2go::default'
 }

 it 'should create a repo if it does not exists' do
   chef_run.converge "x2go::default"
   expect(chef_run).to create_file("x2go")
 end
end

Doesn't work, which is probably because "create_file" is used with the "file" resource, not yum_repository LWRP.

It doesn't look like chef spec supports the yum_repository LWRP (or at least that I can see), so I am not sure what direction I should take from here. What approach should I take?

- Rilindo




Archive powered by MHonArc 2.6.16.

§