Question on Chef 12 Issue


#1

I’m not entirely sure which side of the fence the issue lies on and hoping
someone might know
We use minitest-chef-handler for testing and we have a common pattern of
doing something like this:

require_relative “support/test_helper.rb”

describe_recipe ‘cookbook::default’ do
include MyCokbook::Test::Helper
MiniTest::Chef::Resources.register_resource(:chef_gem)
describe “gems” do
it “ensures the netaddr gem is installed” do
chef_gem(“netaddr”).must_be_installed
end
end
end

The key line appears to be
MiniTest::Chef::Resources.register_resource(:chef_gem).

This worked on Chef 11, however is failing on Chef 12 with this error

ArgumentError: Cannot find a provider for chef_gem[netaddr] on centos
version 6.5
from
/opt/chef/embedded/apps/chef/lib/chef/platform/provider_mapping.rb:552:in
`find_provider’

Given the changes for the Dynamic Provider Resolver, does this appear to be
more of a Chef bug, or a breaking change that minitest-chef-handler will
need to updated to accomodate?

Thanks


#2

If its just that one resource that is broken, it might be core-chef
(chef_gem is kind of simple, yet weird). If its all broken then its
likely that chef-minitest-handler needs to be updated to hook properly
into the provider_resolver stuff, or changed to call the correct API.
Offhand its kind of hard to say. Either way could use an issue cut
against chef on github for more investigation.

On Fri Dec 5 15:56:01 2014, David Petzel wrote:

I’m not entirely sure which side of the fence the issue lies on and
hoping someone might know
We use minitest-chef-handler for testing and we have a common pattern
of doing something like this:

require_relative “support/test_helper.rb”

describe_recipe ‘cookbook::default’ do
include MyCokbook::Test::Helper
MiniTest::Chef::Resources.register_resource(:chef_gem)
describe “gems” do
it “ensures the netaddr gem is installed” do
chef_gem(“netaddr”).must_be_installed
end
end
end

The key line appears to be
MiniTest::Chef::Resources.register_resource(:chef_gem).

This worked on Chef 11, however is failing on Chef 12 with this error

ArgumentError: Cannot find a provider for chef_gem[netaddr] on centos
version 6.5
from
/opt/chef/embedded/apps/chef/lib/chef/platform/provider_mapping.rb:552:in
`find_provider’

Given the changes for the Dynamic Provider Resolver, does this appear
to be more of a Chef bug, or a breaking change that
minitest-chef-handler will need to updated to accomodate?

Thanks


#3

Thanks Lamont,
It doesn’t appear to happen for all resources, but it is broken for
gem_package as well. Ticket created here:

On Fri, Dec 5, 2014 at 7:08 PM, Lamont Granquist lamont@chef.io wrote:

If its just that one resource that is broken, it might be core-chef
(chef_gem is kind of simple, yet weird). If its all broken then its likely
that chef-minitest-handler needs to be updated to hook properly into the
provider_resolver stuff, or changed to call the correct API. Offhand its
kind of hard to say. Either way could use an issue cut against chef on
github for more investigation.