Browse Source

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
changes/71/713971/5
Lance Albertson 11 months ago
parent
commit
87b4f83273
17 changed files with 149 additions and 105 deletions
  1. +9
    -1
      .delivery/project.toml
  2. +0
    -14
      .rubocop.yml
  3. +15
    -14
      Berksfile
  4. +6
    -6
      README.rst
  5. +35
    -12
      attributes/default.rb
  6. +2
    -1
      attributes/tempest_conf.rb
  7. +5
    -11
      metadata.rb
  8. +3
    -1
      recipes/create_network.rb
  9. +25
    -1
      recipes/dns.rb
  10. +18
    -0
      recipes/orchestration.rb
  11. +3
    -1
      recipes/run_tempest.rb
  12. +16
    -18
      recipes/setup.rb
  13. +1
    -1
      spec/dns-rhel_spec.rb
  14. +6
    -1
      spec/dns_spec.rb
  15. +1
    -14
      spec/setup-redhat_spec.rb
  16. +2
    -7
      spec/setup_spec.rb
  17. +2
    -2
      spec/spec_helper.rb

+ 9
- 1
.delivery/project.toml 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"

+ 0
- 14
.rubocop.yml View File

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

+ 15
- 14
Berksfile View File

@ -2,25 +2,26 @@ source 'https://supermarket.chef.io'
solver :ruby, :required
%w(
client
-common
-dns
-identity
-image
-network
-ops-database
-ops-messaging
).each do |cookbook|
[
%w(client dep),
%w(-common dep),
%w(-compute integration),
%w(-dns dep),
%w(-identity dep),
%w(-image dep),
%w(-network dep),
%w(-ops-database integration),
%w(-ops-messaging integration),
].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}"
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
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
# TODO(ramereth): Remove after this PR is merged
# TODO(ramereth): Remove after this PR is released
# 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

+ 6
- 6
README.rst View File

@ -20,9 +20,9 @@ https://docs.openstack.org/tempest/latest/
Requirements
============
- Chef 14 or higher
- ChefDK 3.2.30 for testing (also includes Berkshelf for cookbook
dependency resolution)
- Chef 15 or higher
- Chef Workstation 0.15.18 for testing (also includes Berkshelf for
cookbook dependency resolution)
Cookbooks
---------
@ -31,8 +31,8 @@ The following cookbooks are dependencies:
- 'bind', '~> 2.3.1'
- 'openstackclient'
- 'openstack-common', '>= 18.0.0'
- 'openstack-image', '>= 18.0.0'
- 'openstack-common', '>= 19.0.0'
- 'openstack-image', '>= 19.0.0'
- 'resolver'
Recipes
@ -88,7 +88,7 @@ License and Author
+-----------------+--------------------------------------------------+
| **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


+ 35
- 12
attributes/default.rb View File

@ -1,9 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-integration-test
# Cookbook:: openstack-integration-test
# 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");
# you may not use this file except in compliance with the License.
@ -65,20 +66,42 @@ default['openstack']['integration-test'] = {
case node['platform_family']
when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['integration-test']['platform'] = {
tempest_packages: %w(git curl libxslt-devel
libxml2-devel python-testrepository
libffi-devel python-devel
python-gabbi python-testscenarios
python-ddt),
tempest_packages:
%w(
git
curl
libxslt-devel
libxml2-devel
python-testrepository
libffi-devel
python-devel
python-gabbi
python-testscenarios
python-ddt
),
package_overrides: '',
}
when 'debian'
default['openstack']['integration-test']['platform'] = {
'tempest_packages' => %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),
'tempest_packages' =>
%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
),
'package_overrides' => '',
}
end

+ 2
- 1
attributes/tempest_conf.rb View File

@ -6,7 +6,8 @@ default['openstack']['integration-test']['conf'].tap do |conf|
conf['auth']['default_credentials_domain_name'] = 'Default'
conf['auth']['admin_domain_name'] = 'Default'
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']['strategy'] = 'keystone'
conf['identity']['region'] = 'RegionOne'


+ 5
- 11
metadata.rb View File

@ -3,13 +3,7 @@ maintainer 'openstack-chef'
maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0'
description 'Installs and configures the Tempest Integration Test Suite'
version '18.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'
version '19.0.0'
%w(ubuntu redhat centos).each do |os|
supports os
@ -17,11 +11,11 @@ end
depends 'bind', '~> 2.3.1'
depends 'openstackclient'
depends 'openstack-common', '>= 18.0.0'
depends 'openstack-dns', '>= 18.0.0'
depends 'openstack-image', '>= 18.0.0'
depends 'openstack-common', '>= 19.0.0'
depends 'openstack-dns', '>= 19.0.0'
depends 'openstack-image', '>= 19.0.0'
depends 'resolver'
issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-integration-test'
chef_version '>= 14.0'
chef_version '>= 15.0'

+ 3
- 1
recipes/create_network.rb View File

@ -1,8 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-integration-test
# Cookbook:: openstack-integration-test
# Recipe:: create_network
#
# 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


+ 25
- 1
recipes/dns.rb 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
include ::Openstack
include BindCookbook::Helpers
@ -7,6 +27,10 @@ class ::Chef::Resource
include BindCookbook::Helpers
end
service 'systemd-resolved' do
action [:stop, :disable]
end
# 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
node.default['resolver']['search'] = []
@ -30,7 +54,7 @@ template "#{default_property_for(:sysconfdir, false)}/rndc.key" do
cookbook 'openstack-dns'
owner default_property_for(:run_user, false)
group default_property_for(:run_group, false)
mode 00440
mode '440'
sensitive true
variables(
secret: rndc_secret


+ 18
- 0
recipes/orchestration.rb 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
creates '/tmp/heat_key.priv'
end


+ 3
- 1
recipes/run_tempest.rb View File

@ -1,8 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-integration-test
# Cookbook:: openstack-integration-test
# Recipe:: run_tempest
#
# 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


+ 16
- 18
recipes/setup.rb View File

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


+ 1
- 1
spec/dns-rhel_spec.rb View File

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


+ 6
- 1
spec/dns_spec.rb View File

@ -11,6 +11,11 @@ describe 'openstack-integration-test::dns' do
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 8.8.8.8$/,
@ -38,7 +43,7 @@ describe 'openstack-integration-test::dns' do
source: 'rndc.key.erb',
owner: 'bind',
group: 'bind',
mode: 00440,
mode: '440',
sensitive: true,
variables: {
secret: 'rndc-key',


+ 1
- 14
spec/setup-redhat_spec.rb View File

@ -12,20 +12,7 @@ describe 'openstack-integration-test::setup' do
include_context 'tempest-stubs'
it 'installs tempest dependencies' do
%w(
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
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)
end
end
end

+ 2
- 7
spec/setup_spec.rb View File

@ -21,12 +21,7 @@ describe 'openstack-integration-test::setup' do
}
it 'installs tempest dependencies' do
packages = %w(git libxml2-dev libxslt-dev testrepository python-dev
libffi-dev)
packages.each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
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)
end
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(
user: 'root',
group: 'root',
mode: 0o0600
mode: '600'
)
end


+ 2
- 2
spec/spec_helper.rb View File

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


Loading…
Cancel
Save