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',