From 06097e9a34383a6dd29bde529adb1ee02462bbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20=E2=80=9Csaz=E2=80=9D=20Zieger?= Date: Fri, 1 Nov 2024 16:40:20 +0100 Subject: [PATCH] replace legacy facts in tests --- spec/classes/proxysql_spec.rb | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/spec/classes/proxysql_spec.rb b/spec/classes/proxysql_spec.rb index ed0ef0e..9a27eae 100644 --- a/spec/classes/proxysql_spec.rb +++ b/spec/classes/proxysql_spec.rb @@ -32,8 +32,8 @@ it { is_expected.to contain_class('mysql::client').with(bindings_enable: false) } - if facts[:osfamily] == 'RedHat' - it { is_expected.to contain_yumrepo('proxysql_2_7').with_baseurl("http://repo.proxysql.com/ProxySQL/proxysql-2.7.x/centos/#{facts[:operatingsystemmajrelease]}") } + if facts[:os]['family'] == 'RedHat' + it { is_expected.to contain_yumrepo('proxysql_2_7').with_baseurl("http://repo.proxysql.com/ProxySQL/proxysql-2.7.x/centos/#{facts[:os]['release']['major']}") } it { is_expected.to contain_yumrepo('proxysql_repo').with_ensure('absent') } it { is_expected.to contain_yumrepo('proxysql_2_6').with_ensure('absent') } it { is_expected.to contain_yumrepo('proxysql_2_5').with_ensure('absent') } @@ -50,11 +50,7 @@ sys_user = 'proxysql' sys_group = 'proxysql' - admin_socket = if ['18.04', '20.04'].include?(facts[:operatingsystemrelease]) - '/var/lib/proxysql/proxysql_admin.sock' - else - '/tmp/proxysql_admin.sock' - end + admin_socket = '/tmp/proxysql_admin.sock' it do is_expected.to contain_file('proxysql-config-file').with(ensure: 'file', @@ -85,22 +81,8 @@ enable: true) end - if facts[:osfamily] == 'RedHat' - context 'with restart = true' do - context 'and proxysql 2.7.1' do - let(:params) { { 'restart' => true, 'version' => '2.7.1' } } - - it { is_expected.to contain_service('proxysql').with_start('/etc/init.d/proxysql reload') } - end - end - end - - unless (facts[:osfamily] == 'RedHat' && facts[:operatingsystemmajrelease] == '7') || - (facts[:operatingsystem] == 'Ubuntu' && ['18.04', '20.04'].include?(facts[:operatingsystemmajrelease])) || - (facts[:operatingsystem] == 'Debian' && facts[:operatingsystemmajrelease] =~ %r{^(9|10)$}) - it { is_expected.to contain_service('proxysql').with_hasstatus(true) } - it { is_expected.to contain_service('proxysql').with_hasrestart(true) } - end + it { is_expected.to contain_service('proxysql').with_hasstatus(true) } + it { is_expected.to contain_service('proxysql').with_hasrestart(true) } it do is_expected.to contain_exec('wait_for_admin_socket_to_open').with( @@ -120,7 +102,7 @@ it { is_expected.to contain_file('proxysql-datadir').with_mode('0644') } end - if facts[:osfamily] == 'RedHat' + if facts[:os]['family'] == 'RedHat' describe 'manage_selinux' do context 'on systems with selinux enabled' do let(:facts) do