Skip to content

Commit

Permalink
Add tests for COOK-2045, COOK-2121
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman committed Jan 8, 2013
1 parent 8d5fd67 commit 04dd8ee
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/kitchen/Kitchenfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ cookbook "yum" do
configuration "ius"
configuration "repoforge"
configuration "yum"
configuration "remi"
configuration "cook-2121"
end
1 change: 1 addition & 0 deletions test/kitchen/cookbooks/yum_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This cookbook is used with test-kitchen to test the parent, yum cookbok
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Cookbook Name:: yum_test
#
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require File.expand_path('../support/helpers', __FILE__)

describe "yum_test::default" do
include Helpers::YumTest

it 'doesnt update the zenos-add.repo file if it exists' do
assert File.zero?('/etc/yum.repos.d/zenoss-add.repo')
end

it 'updates the zenoss-create file' do
file('/etc/yum.repos.d/zenoss-create.repo').must_match %r[baseurl=http://dev.zenoss.com/yum/stable/]
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Cookbook Name:: yum_test
# Recipe:: default
#
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require File.expand_path('../support/helpers', __FILE__)

describe "yum_test::default" do
include Helpers::YumTest

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Cookbook Name:: yum_test
# Recipe:: default
#
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

module Helpers
module YumTest
include MiniTest::Chef::Assertions
include MiniTest::Chef::Context
include MiniTest::Chef::Resources

end
end
6 changes: 6 additions & 0 deletions test/kitchen/cookbooks/yum_test/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name "yum"
maintainer "Opscode, Inc."
maintainer_email "[email protected]"
license "Apache 2.0"
description "This cookbook is used with test-kitchen to test the parent, yum cookbok"
version "1.0.0"
31 changes: 31 additions & 0 deletions test/kitchen/cookbooks/yum_test/recipes/cook-2121.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Cookbook Name:: yum_test
# Recipe:: cook-2121
#
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

%w{add create}.each do |act|
file "/etc/yum.repos.d/zenoss-#{act}.repo" do
action :create
end

yum_repository "zenoss-#{act}" do
description "Zenoss Stable repo"
url "http://dev.zenoss.com/yum/stable/"
key "RPM-GPG-KEY-zenoss"
action act.to_sym
end
end
20 changes: 20 additions & 0 deletions test/kitchen/cookbooks/yum_test/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Cookbook Name:: yum_test
# Recipe:: default
#
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include_recipe "yum::default"

0 comments on commit 04dd8ee

Please sign in to comment.