Initial integration-test Pike updates

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

Change-Id: If9ef1641600ca2d4bea1e3b538304dd2f1d3651f
This commit is contained in:
Samuel Cassiba 2017-08-23 21:14:01 -04:00
parent c889c51093
commit fa8127ae6c
7 changed files with 22 additions and 48 deletions

View File

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

View File

@ -1,19 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-08-17 14:16:14 +0200 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: 5
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 191
# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'recipes/setup.rb'

View File

@ -1,25 +1,20 @@
task default: ["test"]
task :test => [:lint, :style, :knife, :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"
desc "Run FoodCritic (syntax) tests"
task :syntax do
sh %{chef exec foodcritic --exclude spec -f any .}
end
desc "Run RuboCop (lint) tests"
task :lint do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
end
desc "Run knife tests"
task :knife => :berks_prep do
sh %{chef exec knife cookbook test openstack-integration-test -o berks-cookbooks}
end
desc "Run RuboCop (style) tests"
task :style do
sh %{chef exec rubocop}
sh %{chef exec cookstyle}
end
desc "Run RSpec (unit) tests"

View File

@ -31,27 +31,27 @@ default['openstack']['integration-test'] = {
'password' => 'tempest_user1_pass',
'project_name' => 'tempest_project1',
'role' => 'Member',
'domain_name' => 'Default'
'domain_name' => 'Default',
},
'user2' => {
'user_name' => 'tempest_user2',
'password' => 'tempest_user2_pass',
'project_name' => 'tempest_project2',
'role' => 'Member',
'domain_name' => 'Default'
'domain_name' => 'Default',
},
'image1' => {
'name' => 'cirros-test1',
'id' => '1ac790f6-903a-4833-979f-a38f1819e3b1',
'flavor' => 99,
'source' => 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img'
'source' => 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img',
},
'image2' => {
'name' => 'cirros-test2',
'id' => 'f7c2ac6d-0011-499f-a9ec-ca71348bf2e4',
'flavor' => 99,
'source' => 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img'
}
'source' => 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img',
},
}
# platform-specific settings
@ -61,13 +61,13 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
tempest_packages: %w(git libxslt-devel
libxml2-devel python-testrepository
libffi-devel python-devel python-setuptools),
package_overrides: ''
package_overrides: '',
}
when 'debian'
default['openstack']['integration-test']['platform'] = {
tempest_packages: %w(git libssl-dev libffi-dev python-dev libxml2-dev
libxslt1-dev libpq-dev libxml2-dev libxslt-dev
testrepository python-dev libffi-dev),
package_overrides: "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
package_overrides: "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'",
}
end

View File

@ -17,11 +17,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
class Chef::Recipe # rubocop:disable Documentation
class Chef::Recipe
include ::Openstack
end
class Chef::Resource::RubyBlock # rubocop:disable Documentation
class Chef::Resource::RubyBlock
include ::Openstack
end
@ -54,7 +54,7 @@ connection_params = {
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain
openstack_domain_name: admin_domain,
}
%w(user1 user2).each_with_index do |user|

View File

@ -16,7 +16,7 @@ describe 'openstack-integration-test::setup' do
openstack_username: 'admin',
openstack_api_key: 'admin',
openstack_project_name: 'admin',
openstack_domain_name: 'default'
openstack_domain_name: 'default',
}
it 'installs tempest dependencies' do

View File

@ -10,12 +10,12 @@ LOG_LEVEL = :fatal
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
}.freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '16.04',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
}.freeze
shared_context 'tempest-stubs' do
@ -28,7 +28,7 @@ shared_context 'tempest-stubs' do
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v3',
'OS_USER_DOMAIN_NAME' => 'default',
'OS_PROJECT_DOMAIN_NAME' => 'default',
'OS_IDENTITY_API_VERSION' => 3
'OS_IDENTITY_API_VERSION' => 3,
}
allow_any_instance_of(Chef::Recipe).to receive(:get_password)