Stein fixes

- Cookstyle fixes
- Refactor Berksfile to use groups so we can exclude integration testing
  cookbooks
- Update documentation
- Update delivery configuration to exclude integration cookbooks
- Fix ChefSpec output
- Update Berksfile for cookbook-bind to point to upstream since the PR
  was merged, but not released (yet).
- Ensure systemd-resolved is stopped and disabled

Depends-On: https://review.opendev.org/701027
Depends-On: https://review.opendev.org/706158
Depends-On: https://review.opendev.org/706101
Depends-On: https://review.opendev.org/713762
Depends-On: https://review.opendev.org/706157
Depends-On: https://review.opendev.org/713285
Change-Id: I38d8707be687fee53e6f066e6e9bc80587e1e878
This commit is contained in:
Lance Albertson 2020-03-19 13:14:58 -07:00
parent 3b3e8721fe
commit 87b4f83273
17 changed files with 149 additions and 105 deletions

View File

@ -1 +1,9 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml" [local_phases]
unit = 'rspec spec/'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "berks install -e integration"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

View File

@ -14,17 +14,3 @@ AllCops:
- .cookbooks/**/* - .cookbooks/**/*
- berks-cookbooks/**/* - berks-cookbooks/**/*
- .bundle/**/* - .bundle/**/*
Encoding:
Exclude:
- metadata.rb
- Gemfile
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3

View File

@ -2,25 +2,26 @@ source 'https://supermarket.chef.io'
solver :ruby, :required solver :ruby, :required
%w( [
client %w(client dep),
-common %w(-common dep),
-dns %w(-compute integration),
-identity %w(-dns dep),
-image %w(-identity dep),
-network %w(-image dep),
-ops-database %w(-network dep),
-ops-messaging %w(-ops-database integration),
).each do |cookbook| %w(-ops-messaging integration),
].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}") if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}" cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
else else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}" cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
end end
end end
# TODO(ramereth): Remove after this PR is merged # TODO(ramereth): Remove after this PR is released
# https://github.com/joyofhex/cookbook-bind/pull/60 # https://github.com/joyofhex/cookbook-bind/pull/60
cookbook 'bind', github: 'ramereth/cookbook-bind', branch: 'fix-notifies-with-delayed-actions' cookbook 'bind', github: 'joyofhex/cookbook-bind'
metadata metadata

View File

@ -20,9 +20,9 @@ https://docs.openstack.org/tempest/latest/
Requirements Requirements
============ ============
- Chef 14 or higher - Chef 15 or higher
- ChefDK 3.2.30 for testing (also includes Berkshelf for cookbook - Chef Workstation 0.15.18 for testing (also includes Berkshelf for
dependency resolution) cookbook dependency resolution)
Cookbooks Cookbooks
--------- ---------
@ -31,8 +31,8 @@ The following cookbooks are dependencies:
- 'bind', '~> 2.3.1' - 'bind', '~> 2.3.1'
- 'openstackclient' - 'openstackclient'
- 'openstack-common', '>= 18.0.0' - 'openstack-common', '>= 19.0.0'
- 'openstack-image', '>= 18.0.0' - 'openstack-image', '>= 19.0.0'
- 'resolver' - 'resolver'
Recipes Recipes
@ -88,7 +88,7 @@ License and Author
+-----------------+--------------------------------------------------+ +-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2014, Rackspace US, Inc. | | **Copyright** | Copyright (c) 2014, Rackspace US, Inc. |
+-----------------+--------------------------------------------------+ +-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2017-2019, Oregon State University | | **Copyright** | Copyright (c) 2017-2020, Oregon State University |
+-----------------+--------------------------------------------------+ +-----------------+--------------------------------------------------+
Licensed under the Apache License, Version 2.0 (the "License"); you may Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,9 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-integration-test # Cookbook:: openstack-integration-test
# Attributes:: default # Attributes:: default
# #
# Copyright 2014, Rackspace US, Inc. # Copyright:: 2014, Rackspace US, Inc.
# Copyright:: 2017-2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -65,20 +66,42 @@ default['openstack']['integration-test'] = {
case node['platform_family'] case node['platform_family']
when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['integration-test']['platform'] = { default['openstack']['integration-test']['platform'] = {
tempest_packages: %w(git curl libxslt-devel tempest_packages:
libxml2-devel python-testrepository %w(
libffi-devel python-devel git
python-gabbi python-testscenarios curl
python-ddt), libxslt-devel
libxml2-devel
python-testrepository
libffi-devel
python-devel
python-gabbi
python-testscenarios
python-ddt
),
package_overrides: '', package_overrides: '',
} }
when 'debian' when 'debian'
default['openstack']['integration-test']['platform'] = { default['openstack']['integration-test']['platform'] = {
'tempest_packages' => %w(git curl libssl-dev libffi-dev python-dev libxml2-dev 'tempest_packages' =>
libxslt1-dev libpq-dev libxml2-dev libxslt-dev %w(
testrepository python-dev libffi-dev git
python-gabbi python-testscenarios curl
python-ddt), libssl-dev
libffi-dev
python-dev
libxml2-dev
libxslt1-dev
libpq-dev
libxml2-dev
libxslt-dev
testrepository
python-dev
libffi-dev
python-gabbi
python-testscenarios
python-ddt
),
'package_overrides' => '', 'package_overrides' => '',
} }
end end

View File

@ -6,7 +6,8 @@ default['openstack']['integration-test']['conf'].tap do |conf|
conf['auth']['default_credentials_domain_name'] = 'Default' conf['auth']['default_credentials_domain_name'] = 'Default'
conf['auth']['admin_domain_name'] = 'Default' conf['auth']['admin_domain_name'] = 'Default'
conf['identity']['catalog_type'] = 'identity' conf['identity']['catalog_type'] = 'identity'
conf['identity']['disable_ssl_certificate_validation'] = node['openstack']['integration-test']['disable_ssl_validation'] conf['identity']['disable_ssl_certificate_validation'] =
node['openstack']['integration-test']['disable_ssl_validation']
conf['identity']['v3_endpoint_type'] = 'publicURL' conf['identity']['v3_endpoint_type'] = 'publicURL'
conf['identity']['strategy'] = 'keystone' conf['identity']['strategy'] = 'keystone'
conf['identity']['region'] = 'RegionOne' conf['identity']['region'] = 'RegionOne'

View File

@ -3,13 +3,7 @@ maintainer 'openstack-chef'
maintainer_email 'openstack-discuss@lists.openstack.org' maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0' license 'Apache-2.0'
description 'Installs and configures the Tempest Integration Test Suite' description 'Installs and configures the Tempest Integration Test Suite'
version '18.0.0' version '19.0.0'
recipe 'openstack-integration-test::create_network', 'Create a test network and subnet for use in kitchen tests'
recipe 'openstack-integration-test::dns', 'Setup environment for testing designate'
recipe 'openstack-integration-test::orchestration', 'Setup environment for testing heat'
recipe 'openstack-integration-test::run_tempest', 'Run tempest for use in kitchen tests'
recipe 'openstack-integration-test::setup', 'Installs and configures Tempest'
%w(ubuntu redhat centos).each do |os| %w(ubuntu redhat centos).each do |os|
supports os supports os
@ -17,11 +11,11 @@ end
depends 'bind', '~> 2.3.1' depends 'bind', '~> 2.3.1'
depends 'openstackclient' depends 'openstackclient'
depends 'openstack-common', '>= 18.0.0' depends 'openstack-common', '>= 19.0.0'
depends 'openstack-dns', '>= 18.0.0' depends 'openstack-dns', '>= 19.0.0'
depends 'openstack-image', '>= 18.0.0' depends 'openstack-image', '>= 19.0.0'
depends 'resolver' depends 'resolver'
issues_url 'https://launchpad.net/openstack-chef' issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-integration-test' source_url 'https://opendev.org/openstack/cookbook-openstack-integration-test'
chef_version '>= 14.0' chef_version '>= 15.0'

View File

@ -1,8 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-integration-test # Cookbook:: openstack-integration-test
# Recipe:: create_network # Recipe:: create_network
# #
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the 'License'); # Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,3 +1,23 @@
# encoding: UTF-8
#
# Cookbook:: openstack-integration-test
# Recipe:: dns
#
# Copyright:: 2020, Oregon State University
#
# 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.
#
class ::Chef::Recipe class ::Chef::Recipe
include ::Openstack include ::Openstack
include BindCookbook::Helpers include BindCookbook::Helpers
@ -7,6 +27,10 @@ class ::Chef::Resource
include BindCookbook::Helpers include BindCookbook::Helpers
end end
service 'systemd-resolved' do
action [:stop, :disable]
end
# Match what opendev/base-jobs uses for unbound: # Match what opendev/base-jobs uses for unbound:
# https://opendev.org/opendev/base-jobs/src/branch/master/roles/configure-unbound/defaults/main.yaml#L1-L7 # https://opendev.org/opendev/base-jobs/src/branch/master/roles/configure-unbound/defaults/main.yaml#L1-L7
node.default['resolver']['search'] = [] node.default['resolver']['search'] = []
@ -30,7 +54,7 @@ template "#{default_property_for(:sysconfdir, false)}/rndc.key" do
cookbook 'openstack-dns' cookbook 'openstack-dns'
owner default_property_for(:run_user, false) owner default_property_for(:run_user, false)
group default_property_for(:run_group, false) group default_property_for(:run_group, false)
mode 00440 mode '440'
sensitive true sensitive true
variables( variables(
secret: rndc_secret secret: rndc_secret

View File

@ -1,3 +1,21 @@
# encoding: UTF-8
#
# Cookbook:: openstack-integration-test
# Recipe:: orchestration
#
# Copyright:: 2020, Oregon State University
#
# 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.
#
execute 'bash -c "source /root/openrc && openstack keypair create heat_key > /tmp/heat_key.priv"' do execute 'bash -c "source /root/openrc && openstack keypair create heat_key > /tmp/heat_key.priv"' do
creates '/tmp/heat_key.priv' creates '/tmp/heat_key.priv'
end end

View File

@ -1,8 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-integration-test # Cookbook:: openstack-integration-test
# Recipe:: run_tempest # Recipe:: run_tempest
# #
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the 'License'); # Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,9 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-integration-test # Cookbook:: openstack-integration-test
# Recipe:: setup # Recipe:: setup
# #
# Copyright 2014, Rackspace US, Inc. # Copyright:: 2014, Rackspace US, Inc.
# Copyright:: 2017-2020, Oregon State university
# #
# Licensed under the Apache License, Version 2.0 (the 'License'); # Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -30,12 +31,9 @@ end
platform_options = node['openstack']['integration-test']['platform'] platform_options = node['openstack']['integration-test']['platform']
service_available = node['openstack']['integration-test']['conf']['service_available'] service_available = node['openstack']['integration-test']['conf']['service_available']
platform_options['tempest_packages'].each do |pkg| package platform_options['tempest_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
identity_endpoint = internal_endpoint 'identity' identity_endpoint = internal_endpoint 'identity'
@ -49,11 +47,11 @@ admin_project_domain_name = node['openstack']['identity']['admin_project_domain'
endpoint_type = node['openstack']['identity']['endpoint_type'] endpoint_type = node['openstack']['identity']['endpoint_type']
connection_params = { connection_params = {
openstack_auth_url: auth_url, openstack_auth_url: auth_url,
openstack_username: admin_user, openstack_username: admin_user,
openstack_api_key: admin_pass, openstack_api_key: admin_pass,
openstack_project_name: admin_project, openstack_project_name: admin_project,
openstack_domain_name: admin_domain, openstack_domain_name: admin_domain,
openstack_endpoint_type: endpoint_type, openstack_endpoint_type: endpoint_type,
} }
@ -84,6 +82,7 @@ openstack_role node['openstack']['integration-test']['heat_stack_user_role'] do
end end
include_recipe 'openstack-common' include_recipe 'openstack-common'
build_essential 'tempest'
tempest_path = '/opt/tempest' tempest_path = '/opt/tempest'
venv_path = '/opt/tempest-venv' venv_path = '/opt/tempest-venv'
@ -103,8 +102,7 @@ end
# Note(jh): Make sure to keep the constraint definition in sync with # Note(jh): Make sure to keep the constraint definition in sync with
# the tempest version # the tempest version
tempest_ver = '22.1.0' tempest_ver = '22.1.0'
constraint = '-c https://opendev.org/openstack/requirements/raw/'\ constraint = '-c https://opendev.org/openstack/requirements/raw/branch/stable/train/upper-constraints.txt'
'branch/stable/train/upper-constraints.txt'
execute 'install tempest' do execute 'install tempest' do
action :nothing action :nothing
@ -124,7 +122,7 @@ template "#{venv_path}/tempest.sh" do
source 'tempest.sh.erb' source 'tempest.sh.erb'
user 'root' user 'root'
group 'root' group 'root'
mode 0o755 mode '755'
variables( variables(
venv_path: venv_path venv_path: venv_path
) )
@ -188,7 +186,7 @@ template '/opt/tempest/etc/tempest.conf' do
cookbook 'openstack-common' cookbook 'openstack-common'
owner 'root' owner 'root'
group 'root' group 'root'
mode 0o0600 mode '600'
variables( variables(
service_config: integration_test_conf_options service_config: integration_test_conf_options
) )
@ -197,7 +195,7 @@ end
directory '/opt/tempest/logs' do directory '/opt/tempest/logs' do
owner 'root' owner 'root'
group 'root' group 'root'
mode 0755 mode '755'
action :create action :create
end end

View File

@ -38,7 +38,7 @@ describe 'openstack-integration-test::dns' do
source: 'rndc.key.erb', source: 'rndc.key.erb',
owner: 'named', owner: 'named',
group: 'named', group: 'named',
mode: 00440, mode: '440',
sensitive: true, sensitive: true,
variables: { variables: {
secret: 'rndc-key', secret: 'rndc-key',

View File

@ -11,6 +11,11 @@ describe 'openstack-integration-test::dns' do
include_context 'tempest-stubs' include_context 'tempest-stubs'
it do
expect(chef_run).to stop_service('systemd-resolved')
expect(chef_run).to disable_service('systemd-resolved')
end
[ [
/^nameserver 1.0.0.1$/, /^nameserver 1.0.0.1$/,
/^nameserver 8.8.8.8$/, /^nameserver 8.8.8.8$/,
@ -38,7 +43,7 @@ describe 'openstack-integration-test::dns' do
source: 'rndc.key.erb', source: 'rndc.key.erb',
owner: 'bind', owner: 'bind',
group: 'bind', group: 'bind',
mode: 00440, mode: '440',
sensitive: true, sensitive: true,
variables: { variables: {
secret: 'rndc-key', secret: 'rndc-key',

View File

@ -12,20 +12,7 @@ describe 'openstack-integration-test::setup' do
include_context 'tempest-stubs' include_context 'tempest-stubs'
it 'installs tempest dependencies' do it 'installs tempest dependencies' do
%w( expect(chef_run).to upgrade_package %w(git curl libxslt-devel libxml2-devel python-testrepository libffi-devel python-devel python-gabbi python-testscenarios python-ddt)
curl
git
libffi-devel
libxml2-devel
libxslt-devel
python-ddt
python-devel
python-gabbi
python-testrepository
python-testscenarios
).each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
end end
end end
end end

View File

@ -21,12 +21,7 @@ describe 'openstack-integration-test::setup' do
} }
it 'installs tempest dependencies' do it 'installs tempest dependencies' do
packages = %w(git libxml2-dev libxslt-dev testrepository python-dev expect(chef_run).to upgrade_package %w(git curl libssl-dev libffi-dev python-dev libxml2-dev libxslt1-dev libpq-dev libxml2-dev libxslt-dev testrepository python-dev libffi-dev python-gabbi python-testscenarios python-ddt)
libffi-dev)
packages.each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
end end
it 'registers tempest_project1 Project' do it 'registers tempest_project1 Project' do
@ -164,7 +159,7 @@ describe 'openstack-integration-test::setup' do
expect(chef_run).to create_template(file.name).with( expect(chef_run).to create_template(file.name).with(
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o0600 mode: '600'
) )
end end

View File

@ -22,8 +22,8 @@ shared_context 'tempest-stubs' do
before do before do
env = env =
{ {
'OS_USERNAME' => 'admin', 'OS_USERNAME' => 'admin',
'OS_PASSWORD' => 'admin', 'OS_PASSWORD' => 'admin',
'OS_PROJECT_NAME' => 'admin', 'OS_PROJECT_NAME' => 'admin',
'OS_AUTH_URL' => 'http://127.0.0.1:5000/v3', 'OS_AUTH_URL' => 'http://127.0.0.1:5000/v3',
'OS_USER_DOMAIN_NAME' => 'default', 'OS_USER_DOMAIN_NAME' => 'default',