From 5e26af7d046e484dc3729d6a8d9173b304992b87 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Fri, 22 Oct 2021 09:59:04 -0700 Subject: [PATCH] CentOS 8 support - Update ChefSpec Depends-On: https://review.opendev.org/c/openstack/openstack-chef/+/814234 Depends-On: https://review.opendev.org/c/openstack/cookbook-openstack-common/+/814235 Change-Id: I832a910d9054c2ddfde28ed2522efe7c0f414588 Signed-off-by: Lance Albertson --- spec/mariadb-client-redhat_spec.rb | 31 +++++++++++++++++++----------- spec/spec_helper.rb | 12 +++++++++++- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/spec/mariadb-client-redhat_spec.rb b/spec/mariadb-client-redhat_spec.rb index de85b95..2000733 100644 --- a/spec/mariadb-client-redhat_spec.rb +++ b/spec/mariadb-client-redhat_spec.rb @@ -1,18 +1,27 @@ require_relative 'spec_helper' describe 'openstack-ops-database::mariadb-client' do - describe 'redhat' do - let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) } - let(:node) do - runner.node - end - cached(:chef_run) do - runner.node.override['openstack']['db']['service_type'] = 'mariadb' - runner.converge(described_recipe) - end + ALL_RHEL.each do |p| + context "redhat #{p[:version]}" do + let(:runner) { ChefSpec::SoloRunner.new(p) } + let(:node) do + runner.node + end + cached(:chef_run) do + runner.node.override['openstack']['db']['service_type'] = 'mariadb' + runner.converge(described_recipe) + end - it 'installs mariadb python client packages' do - expect(chef_run).to install_package('MySQL-python') + case p + when REDHAT_7 + it do + expect(chef_run).to install_package('MySQL-python') + end + when REDHAT_8 + it do + expect(chef_run).to install_package('python3-PyMySQL') + end + end end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6d0e06a..629c73a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,11 +7,21 @@ RSpec.configure do |config| config.log_level = :warn end -REDHAT_OPTS = { +REDHAT_7 = { platform: 'redhat', version: '7', }.freeze +REDHAT_8 = { + platform: 'redhat', + version: '8', +}.freeze + +ALL_RHEL = [ + REDHAT_7, + REDHAT_8, +].freeze + UBUNTU_OPTS = { platform: 'ubuntu', version: '18.04',