This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
212 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
test/integration | ||
|
||
*~ | ||
*# | ||
.#* | ||
\#*# | ||
.*.sw[a-z] | ||
*.un~ | ||
coverage | ||
exp.* | ||
.kitchen | ||
Gemfile.lock | ||
pkg/ | ||
shared_test_repo/ | ||
|
||
# Berkshelf | ||
.vagrant | ||
/cookbooks | ||
Berksfile.lock | ||
|
||
# Bundler | ||
Gemfile.lock | ||
bin/* | ||
.bundle/* | ||
|
||
# Test Kitchen | ||
.kitchen/ | ||
.kitchen.local.yml | ||
shared_test_repo/ | ||
test/integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
AllCops: | ||
DisplayCopNames: true | ||
Exclude: | ||
- vendor/** | ||
- metadata.rb | ||
- '**/Puppetfile' | ||
|
||
Documentation: | ||
Metrics/LineLength: | ||
Enabled: false | ||
AlignParameters: | ||
Enabled: true | ||
Encoding: | ||
Enabled: true | ||
HashSyntax: | ||
Enabled: true | ||
LineLength: | ||
Enabled: false | ||
MethodLength: | ||
Metrics/MethodLength: | ||
Max: 30 | ||
NumericLiterals: | ||
Style/Documentation: | ||
Enabled: false | ||
Style/Encoding: | ||
EnforcedStyle: always | ||
Enabled: true | ||
Style/ExtraSpacing: | ||
Exclude: | ||
- attributes/hardening.rb | ||
Style/NumericLiterals: | ||
MinDigits: 10 | ||
Style/RegexpLiteral: | ||
AllowInnerSlashes: true | ||
Style/SpaceAroundOperators: | ||
Exclude: | ||
- attributes/hardening.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
- 2.3.1 | ||
language: ruby | ||
bundler_args: --without development integration openstack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
source "https://supermarket.getchef.com" | ||
# encoding: utf-8 | ||
|
||
metadata | ||
source 'https://supermarket.chef.io' | ||
|
||
cookbook "apt" | ||
cookbook "chef-solo-search", :git => "https://github.com/edelight/chef-solo-search" | ||
metadata | ||
|
||
cookbook 'apt' | ||
cookbook 'chef-solo-search', git: 'https://github.com/edelight/chef-solo-search' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# encoding: UTF-8 | ||
# | ||
# Copyright 2016, Grant Ridder | ||
# | ||
# 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 'spec_helper' | ||
|
||
describe 'percona-hardening::default' do | ||
before do | ||
allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).and_call_original | ||
allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('percona-hardening::hardening') | ||
end | ||
|
||
cached(:chef_run) do | ||
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) | ||
end | ||
|
||
# check that the recipes are executed | ||
it 'includes hardening recipe' do | ||
expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('percona-hardening::hardening') | ||
chef_run | ||
end | ||
|
||
context 'chef-solo' do | ||
cached(:chef_run) do | ||
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) | ||
end | ||
|
||
it 'does not raise an error' do | ||
expect { chef_run }.not_to raise_error | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# encoding: UTF-8 | ||
# | ||
# Copyright 2016, Grant Ridder | ||
# | ||
# 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 'spec_helper' | ||
|
||
describe 'percona-hardening::hardening' do | ||
cached(:chef_run) do | ||
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) | ||
end | ||
|
||
it 'create /etc/mysql/my.cnf file' do | ||
expect(chef_run).to create_file('/etc/mysql/my.cnf').with( | ||
mode: '600', | ||
owner: 'mysql', | ||
group: 'root' | ||
) | ||
end | ||
|
||
it 'create /etc/mysql/conf.d/hardening.cnf template' do | ||
expect(chef_run).to create_template('/etc/mysql/conf.d/hardening.cnf').with( | ||
owner: 'mysql', | ||
mode: '750', | ||
source: 'hardening.cnf.erb' | ||
) | ||
resource = chef_run.template('/etc/mysql/conf.d/hardening.cnf') | ||
expect(resource).to notify('service[mysql]').to(:restart).immediately | ||
end | ||
|
||
it 'create /var/lib/mysql directory' do | ||
expect(chef_run).to create_directory('/var/lib/mysql').with( | ||
owner: 'mysql', | ||
mode: '755' | ||
) | ||
end | ||
|
||
it 'stubbing mysql service for chefspec' do | ||
expect(chef_run).to_not enable_service('mysql') | ||
end | ||
|
||
context 'chef-solo' do | ||
cached(:chef_run) do | ||
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) | ||
end | ||
|
||
it 'does not raise an error' do | ||
expect { chef_run }.not_to raise_error | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters