Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
157e598c44 | |||
63d9340c9d | |||
611e54f835 |
9 changed files with 123 additions and 1 deletions
25
.kitchen.yml
Normal file
25
.kitchen.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
driver:
|
||||
name: docker
|
||||
|
||||
provisioner:
|
||||
name: chef_zero
|
||||
environments_path: test/environments
|
||||
client_rb:
|
||||
environment: integration_test_env
|
||||
|
||||
platforms:
|
||||
- name: centos-7.2-chef-12
|
||||
driver_config:
|
||||
image: centos:7.2.1511
|
||||
platform: rhel
|
||||
require_chef_omnibus: 12.16.42
|
||||
use_sudo: false
|
||||
hostname: integration.test.test
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
data_bags_path: "test/integration/data_bags"
|
||||
run_list:
|
||||
- recipe[yum-rsyslog]
|
||||
|
7
Gemfile
Normal file
7
Gemfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'berkshelf'
|
||||
gem 'test-kitchen'
|
||||
gem 'chefspec'
|
||||
gem 'foodcritic'
|
||||
gem 'kitchen-docker'
|
||||
|
1
chefignore
Normal file
1
chefignore
Normal file
|
@ -0,0 +1 @@
|
|||
.kitchen
|
|
@ -4,7 +4,7 @@ maintainer_email 'psi-jack@linux-help.org'
|
|||
license 'Apache 2.0'
|
||||
description 'Installs and configures the Official Rsyslog Yum Repository'
|
||||
long_description ''
|
||||
version '0.1.1'
|
||||
version '0.1.2'
|
||||
issues_url 'http://gogs.home.ld/Linux-Help/cookbook-yum-rsyslog/issues'
|
||||
source_url 'http://gogs.home.ld/Linux-Help/cookbook-yum-rsyslog'
|
||||
|
||||
|
|
10
spec/spec_helper.rb
Normal file
10
spec/spec_helper.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
require 'chefspec'
|
||||
require 'chefspec/berkshelf'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.platform = 'centos'
|
||||
config.version = '7.2.1511'
|
||||
end
|
||||
|
||||
ChefSpec::Coverage.start!
|
||||
|
44
spec/unit/recipes/default_spec.rb
Normal file
44
spec/unit/recipes/default_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'yum-rsyslog::default' do
|
||||
context 'Creates rsyslog YUM repository and enables it.' do
|
||||
let(:chef_run) do
|
||||
ChefSpec::SoloRunner.new do |node|
|
||||
# Create a new environment (you could also use a different :let block or :before block)
|
||||
env = Chef::Environment.new
|
||||
env.name 'unit_test'
|
||||
|
||||
# Stub the node to return this environment
|
||||
allow(node).to receive(:chef_environment).and_return(env.name)
|
||||
|
||||
# Stub any calls to Environment.load to return this environment
|
||||
allow(Chef::Environment).to receive(:load).and_return(env)
|
||||
|
||||
# Stubbing out fqdn node attribute
|
||||
node.automatic['fqdn'] = 'unit.testing.stub'
|
||||
end.converge(described_recipe)
|
||||
end
|
||||
|
||||
#before(:each) do
|
||||
#stub_command("rpm -qa zabbix-release-2.4-1.el6.noarch ").and_return(false)
|
||||
#allow(Chef::EncryptedDataBagItem).to receive(:load).with('odhp_credentials', 'credentials').and_return(
|
||||
#{
|
||||
# 'zabbix' => {
|
||||
# 'users' => {
|
||||
# 'unit_test_env' => {
|
||||
# 'postgres' => {
|
||||
# 'username' => 'postgres_username',
|
||||
# 'password' => 'postgres_password'
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#})
|
||||
#end
|
||||
|
||||
it 'installs the rsyslog repository' do
|
||||
expect(chef_run).to create_yum_repository('rsyslog')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
16
test/environments/integration_test_env.json
Normal file
16
test/environments/integration_test_env.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "integration_test_env",
|
||||
"description": "placeholder for integration testing",
|
||||
"cookbook_versions": {
|
||||
|
||||
},
|
||||
"json_class": "Chef::Environment",
|
||||
"chef_type": "environment",
|
||||
"default_attributes": {
|
||||
|
||||
},
|
||||
"override_attributes": {
|
||||
|
||||
}
|
||||
}
|
||||
|
15
test/integration/default/serverspec/default_spec.rb
Normal file
15
test/integration/default/serverspec/default_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'yum-rsyslog::default' do
|
||||
describe yumrepo('rsyslog') do
|
||||
it { should be_enabled }
|
||||
end
|
||||
|
||||
describe file('/etc/yum.repos.d/rsyslog.repo') do
|
||||
it { should be_file }
|
||||
it { should be_mode 644 }
|
||||
it { should be_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
end
|
||||
end
|
||||
|
4
test/integration/helpers/serverspec/spec_helper.rb
Normal file
4
test/integration/helpers/serverspec/spec_helper.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
require 'serverspec'
|
||||
|
||||
set :backend, :exec
|
||||
|
Loading…
Reference in a new issue