From b13bed2a48c571a99b51e9ee486174aaaf9da771 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 02:58:06 +0200 Subject: [PATCH] test(ubuntu): fix tests on Ubuntu distro --- php/map.jinja | 3 ++- test/integration/default/controls/config_spec.rb | 10 +--------- test/integration/default/controls/package_spec.rb | 13 +------------ test/integration/default/controls/service_spec.rb | 14 +------------- test/salt/pillar/debian.sls | 9 +++++++++ 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/php/map.jinja b/php/map.jinja index 9fc102c..14ed704 100644 --- a/php/map.jinja +++ b/php/map.jinja @@ -67,7 +67,8 @@ 'php': 'php' + php_version, 'phpenmod_command': 'phpenmod -v' + php_version, 'pspell': 'php' + php_version + '-pspell', - 'redis': 'php' + php_version + '-redis', + 'readline': 'php' + php_version + '-readline', + 'redis': 'php-redis', 'seclib': ['php-phpseclib', 'php-seclib'], 'snmp': 'php' + php_version + '-snmp', 'soap': 'php' + php_version + '-soap', diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb index 17e26ed..fee1f2d 100644 --- a/test/integration/default/controls/config_spec.rb +++ b/test/integration/default/controls/config_spec.rb @@ -21,9 +21,6 @@ control 'Php configuration' do end end - def test_ubuntu - end - def test_redhat end @@ -32,12 +29,7 @@ control 'Php configuration' do case os[:family] when 'debian' - case os[:name] - when 'ubuntu' - test_ubuntu - when 'debian' - test_debian - end + test_debian when 'redhat', 'fedora' test_redhat when 'suse' diff --git a/test/integration/default/controls/package_spec.rb b/test/integration/default/controls/package_spec.rb index 6fdeb6e..ce385f7 100644 --- a/test/integration/default/controls/package_spec.rb +++ b/test/integration/default/controls/package_spec.rb @@ -25,12 +25,6 @@ control 'Php package' do end end - def test_ubuntu - describe package(pkg_name) do - it { should be_installed } - end - end - def test_redhat describe package('php') do it { should be_installed } @@ -45,12 +39,7 @@ control 'Php package' do case os[:family] when 'debian' - case os[:name] - when 'ubuntu' - test_ubuntu - when 'debian' - test_debian - end + test_debian when 'redhat', 'fedora' test_redhat when 'suse' diff --git a/test/integration/default/controls/service_spec.rb b/test/integration/default/controls/service_spec.rb index 15db1eb..d1932ab 100644 --- a/test/integration/default/controls/service_spec.rb +++ b/test/integration/default/controls/service_spec.rb @@ -13,13 +13,6 @@ control 'Php service' do end end - def test_ubuntu - describe service(pkg_name) do - it { should be_enabled } - it { should be_running } - end - end - def test_redhat end @@ -28,12 +21,7 @@ control 'Php service' do case os[:family] when 'debian' - case os[:name] - when 'ubuntu' - test_ubuntu - when 'debian' - test_debian - end + test_debian when 'redhat', 'fedora' test_redhat when 'suse' diff --git a/test/salt/pillar/debian.sls b/test/salt/pillar/debian.sls index 87b53e9..64cddd0 100644 --- a/test/salt/pillar/debian.sls +++ b/test/salt/pillar/debian.sls @@ -2,11 +2,20 @@ # vim: ft=yaml --- php: +{% if salt['grains.get']('os') == 'Ubuntu' %} + use_external_repo: true + repo: + humanname: php-sury ppa + name: "deb http://ppa.launchpad.net/ondrej/php/ubuntu {{ salt['grains.get']('oscodename') }} main" + file: /etc/apt/sources.list.d/php-sury.list + key_url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c +{% else %} repo: humanname: php-sury repo name: "deb https://packages.sury.org/php/ {{ salt['grains.get']('oscodename') }} main" file: /etc/apt/sources.list.d/php-sury.list key_url: https://packages.sury.org/php/apt.gpg +{% endif %} version: - '5.6'