Minitest dependencies in test-kitchen


#1

I am in the process of adding configuration support to the openssh community cookbook.
I created a config.rb recipe that handles the templating. However, I am running into problems testing it.

The config.rb writes out a template and notifies the ssh service. The ssh service is defined in default.rb (by default),
and I encounter the following error. Is there a way around this?

[Sun, 02 Sep 2012 18:28:27 +0000] DEBUG: Found recipe config in cookbook openssh [80/987]
[Sun, 02 Sep 2012 18:28:27 +0000] ERROR: Running exception handlers
[Sun, 02 Sep 2012 18:28:27 +0000] ERROR: Exception handlers complete
[Sun, 02 Sep 2012 18:28:27 +0000] DEBUG: Re-raising exception: Chef::Exceptions::ResourceNotFound - Cannot find a resource matching service[ssh] (did you define it first?)
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:115:in `lookup’

My Kitchenfile looks like this.

cookbook “openssh” do
configuration(“config”) { runtimes [] }
runtimes []
end


#2

Ohai,

On Sep 2, 2012, at 12:36 PM, John Dewey john@dewey.ws wrote:

I am in the process of adding configuration support to the openssh community cookbook.

Awesome :-).

Have you seen this ticket?

http://tickets.opscode.com/browse/COOK-1014

Discussion has stalled as we haven’t caught up in the resolved ticket backlog for code review, though.

The config.rb writes out a template and notifies the ssh service. The ssh service is defined in default.rb (by default),
and I encounter the following error. Is there a way around this?

[Sun, 02 Sep 2012 18:28:27 +0000] DEBUG: Found recipe config in cookbook openssh [80/987]
[Sun, 02 Sep 2012 18:28:27 +0000] ERROR: Running exception handlers
[Sun, 02 Sep 2012 18:28:27 +0000] ERROR: Exception handlers complete
[Sun, 02 Sep 2012 18:28:27 +0000] DEBUG: Re-raising exception: Chef::Exceptions::ResourceNotFound - Cannot find a resource matching service[ssh] (did you define it first?)
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:115:in `lookup’

My Kitchenfile looks like this.

cookbook “openssh” do
configuration(“config”) { runtimes [] }
runtimes []
end

You’ll need to add a configuration for “default”, too. The way the Kitchenfile works here is if there aren’t any configurations defined, then “default” is used. Otherwise, it only tests the listed configurations.

I believe this is because the “default” recipe might do “include_recipe”, so you could add the included recipe as a configuration along with others.

cookbook “openssh” do
configuration(“default”) { runtimes [] }
configuration(“config”) { runtimes [] }
runtimes []
end


Opscode, Inc
Joshua Timberman, Technical Community Manager
IRC, Skype, Twitter, Github: jtimberman


#3

I need to go ticket hunting first :P… Well i’ll push up what I have, since I have some tests that may be useful.

Thanks for the tips on the configuration block. Looks like it’s working now, although it’s a bit moot now (at least I learned something :)).

John

On Sunday, September 2, 2012 at 9:24 PM, Joshua Timberman wrote:

Ohai,

On Sep 2, 2012, at 12:36 PM, John Dewey <john@dewey.ws (mailto:john@dewey.ws)> wrote:

I am in the process of adding configuration support to the openssh community cookbook.

Awesome :-).

Have you seen this ticket?

http://tickets.opscode.com/browse/COOK-1014

Discussion has stalled as we haven’t caught up in the resolved ticket backlog for code review, though.

The config.rb writes out a template and notifies the ssh service. The ssh service is defined in default.rb (by default),
and I encounter the following error. Is there a way around this?

[Sun, 02 Sep 2012 18:28:27 +0000] DEBUG: Found recipe config in cookbook openssh [80/987]
[Sun, 02 Sep 2012 18:28:27 +0000] ERROR: Running exception handlers
[Sun, 02 Sep 2012 18:28:27 +0000] ERROR: Exception handlers complete
[Sun, 02 Sep 2012 18:28:27 +0000] DEBUG: Re-raising exception: Chef::Exceptions::ResourceNotFound - Cannot find a resource matching service[ssh] (did you define it first?)
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:115:in `lookup’

My Kitchenfile looks like this.

cookbook “openssh” do
configuration(“config”) { runtimes [] }
runtimes []
end

You’ll need to add a configuration for “default”, too. The way the Kitchenfile works here is if there aren’t any configurations defined, then “default” is used. Otherwise, it only tests the listed configurations.

I believe this is because the “default” recipe might do “include_recipe”, so you could add the included recipe as a configuration along with others.

cookbook “openssh” do
configuration(“default”) { runtimes [] }
configuration(“config”) { runtimes [] }
runtimes []
end


Opscode, Inc
Joshua Timberman, Technical Community Manager
IRC, Skype, Twitter, Github: jtimberman