Initial ops-messaging Pike updates

- Switched default linter to cookstyle
- Renamed rake tasks to better conform with Chef conventions

Change-Id: I84ebeb49823b022e85dddea9fcdd358b27be50a3
This commit is contained in:
Samuel Cassiba 2017-08-23 22:37:44 -04:00
parent 7318a42ca1
commit 7ddc2b7c7f
5 changed files with 12 additions and 40 deletions

View File

@ -1,5 +1,3 @@
inherit_from: .rubocop_todo.yml
AllCops:
Include:
- metadata.rb

View File

@ -1,26 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-08-17 17:27:05 -0400 using RuboCop version 0.47.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 4
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 107
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'recipes/rabbitmq-server.rb'
# Offense count: 1
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'recipes/rabbitmq-server.rb'

View File

@ -1,20 +1,20 @@
task default: ["test"]
task :test => [:lint, :style, :unit]
task :test => [:syntax, :lint, :unit]
desc "Vendor the cookbooks in the Berksfile"
task :berks_prep do
sh %{chef exec berks vendor}
end
desc "Run FoodCritic (lint) tests"
task :lint do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
desc "Run FoodCritic (syntax) tests"
task :syntax do
sh %{chef exec foodcritic --exclude spec -f any .}
end
desc "Run RuboCop (style) tests"
task :style do
sh %{chef exec rubocop}
desc "Run RuboCop (lint) tests"
task :lint do
sh %{chef exec cookstyle}
end
desc "Run RSpec (unit) tests"

View File

@ -46,7 +46,7 @@ describe 'openstack-ops-messaging::rabbitmq-server' do
describe 'cluster' do
before do
node.set['openstack']['mq'] = {
'cluster' => true
'cluster' => true,
}
end

View File

@ -8,17 +8,17 @@ LOG_LEVEL = :fatal
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
}.freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '14.04',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
}.freeze
SUSE_OPTS = {
platform: 'suse',
version: '11.3',
log_level: ::LOG_LEVEL
log_level: ::LOG_LEVEL,
}.freeze
shared_context 'ops_messaging_stubs' do
@ -33,7 +33,7 @@ shared_context 'ops_messaging_stubs' do
.with(:node, 'recipes:openstack-ops-messaging\\:\\:rabbitmq-server AND chef_environment:_default')
.and_return [
{ 'hostname' => 'host2' },
{ 'hostname' => 'host1' }
{ 'hostname' => 'host1' },
]
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', anything)