From e6bcdc1b4d8d15f00af17d1c33ed57f496d951b2 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 30 Mar 2021 11:55:03 +0100 Subject: [PATCH] test: update for new platforms (inc. using `system` library) --- .../integration/v3000-py2/controls/pkgs_spec.rb | 17 +++++++++++++---- .../v3000-py2/controls/service_spec.rb | 15 +++++++++++---- .../integration/v3000-py3/controls/pkgs_spec.rb | 6 +++++- .../v3000-py3/controls/service_spec.rb | 4 +++- .../integration/v3001-py3/controls/pkgs_spec.rb | 17 +++++++++++++---- .../v3001-py3/controls/service_spec.rb | 15 +++++++++++---- .../integration/v3002-py3/controls/pkgs_spec.rb | 17 +++++++++++++---- .../v3002-py3/controls/service_spec.rb | 15 +++++++++++---- 8 files changed, 80 insertions(+), 26 deletions(-) diff --git a/test/integration/v3000-py2/controls/pkgs_spec.rb b/test/integration/v3000-py2/controls/pkgs_spec.rb index 74d48dd..818f70e 100644 --- a/test/integration/v3000-py2/controls/pkgs_spec.rb +++ b/test/integration/v3000-py2/controls/pkgs_spec.rb @@ -1,14 +1,23 @@ # frozen_string_literal: true +pkgs = + case system.platform[:name] + when 'arch' + %w[salt] + when /bsd$/ + %w[py37-salt-3002.6] + when 'windows' + %w[Salt\ Minion] + else + %w[salt-master salt-minion] + end + control 'salt packages' do title 'should be installed' version = '3000' - %w[ - salt-master - salt-minion - ].each do |p| + pkgs.each do |p| describe package(p) do it { should be_installed } its('version') { should match(/^#{version}/) } diff --git a/test/integration/v3000-py2/controls/service_spec.rb b/test/integration/v3000-py2/controls/service_spec.rb index 9d99883..be3dab7 100644 --- a/test/integration/v3000-py2/controls/service_spec.rb +++ b/test/integration/v3000-py2/controls/service_spec.rb @@ -1,12 +1,19 @@ # frozen_string_literal: true +services = + case system.platform[:family] + when 'bsd' + %w[salt_master salt_minion] + when 'windows' + %w[salt-minion] + else + %w[salt-master salt-minion] + end + control 'salt services' do title 'should be running' - %w[ - salt-master - salt-minion - ].each do |p| + services.each do |p| describe service(p) do it { should be_installed } it { should be_enabled } diff --git a/test/integration/v3000-py3/controls/pkgs_spec.rb b/test/integration/v3000-py3/controls/pkgs_spec.rb index 06a4c2a..818f70e 100644 --- a/test/integration/v3000-py3/controls/pkgs_spec.rb +++ b/test/integration/v3000-py3/controls/pkgs_spec.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true pkgs = - case platform[:family] + case system.platform[:name] + when 'arch' + %w[salt] + when /bsd$/ + %w[py37-salt-3002.6] when 'windows' %w[Salt\ Minion] else diff --git a/test/integration/v3000-py3/controls/service_spec.rb b/test/integration/v3000-py3/controls/service_spec.rb index 303b136..be3dab7 100644 --- a/test/integration/v3000-py3/controls/service_spec.rb +++ b/test/integration/v3000-py3/controls/service_spec.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true services = - case platform[:family] + case system.platform[:family] + when 'bsd' + %w[salt_master salt_minion] when 'windows' %w[salt-minion] else diff --git a/test/integration/v3001-py3/controls/pkgs_spec.rb b/test/integration/v3001-py3/controls/pkgs_spec.rb index 91d629d..4ba2b86 100644 --- a/test/integration/v3001-py3/controls/pkgs_spec.rb +++ b/test/integration/v3001-py3/controls/pkgs_spec.rb @@ -1,14 +1,23 @@ # frozen_string_literal: true +pkgs = + case system.platform[:name] + when 'arch' + %w[salt] + when /bsd$/ + %w[py37-salt-3002.6] + when 'windows' + %w[Salt\ Minion] + else + %w[salt-master salt-minion] + end + control 'salt packages' do title 'should be installed' version = '3001' - %w[ - salt-master - salt-minion - ].each do |p| + pkgs.each do |p| describe package(p) do it { should be_installed } its('version') { should match(/^#{version}/) } diff --git a/test/integration/v3001-py3/controls/service_spec.rb b/test/integration/v3001-py3/controls/service_spec.rb index 9d99883..be3dab7 100644 --- a/test/integration/v3001-py3/controls/service_spec.rb +++ b/test/integration/v3001-py3/controls/service_spec.rb @@ -1,12 +1,19 @@ # frozen_string_literal: true +services = + case system.platform[:family] + when 'bsd' + %w[salt_master salt_minion] + when 'windows' + %w[salt-minion] + else + %w[salt-master salt-minion] + end + control 'salt services' do title 'should be running' - %w[ - salt-master - salt-minion - ].each do |p| + services.each do |p| describe service(p) do it { should be_installed } it { should be_enabled } diff --git a/test/integration/v3002-py3/controls/pkgs_spec.rb b/test/integration/v3002-py3/controls/pkgs_spec.rb index b1aa8ab..73aee8a 100644 --- a/test/integration/v3002-py3/controls/pkgs_spec.rb +++ b/test/integration/v3002-py3/controls/pkgs_spec.rb @@ -1,14 +1,23 @@ # frozen_string_literal: true +pkgs = + case system.platform[:name] + when 'arch' + %w[salt] + when /bsd$/ + %w[py37-salt-3002.6] + when 'windows' + %w[Salt\ Minion] + else + %w[salt-master salt-minion] + end + control 'salt packages' do title 'should be installed' version = '3002' - %w[ - salt-master - salt-minion - ].each do |p| + pkgs.each do |p| describe package(p) do it { should be_installed } its('version') { should match(/^#{version}/) } diff --git a/test/integration/v3002-py3/controls/service_spec.rb b/test/integration/v3002-py3/controls/service_spec.rb index 9d99883..be3dab7 100644 --- a/test/integration/v3002-py3/controls/service_spec.rb +++ b/test/integration/v3002-py3/controls/service_spec.rb @@ -1,12 +1,19 @@ # frozen_string_literal: true +services = + case system.platform[:family] + when 'bsd' + %w[salt_master salt_minion] + when 'windows' + %w[salt-minion] + else + %w[salt-master salt-minion] + end + control 'salt services' do title 'should be running' - %w[ - salt-master - salt-minion - ].each do |p| + services.each do |p| describe service(p) do it { should be_installed } it { should be_enabled }