Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spicyprogramming committed Jul 26, 2024
1 parent 0f2e897 commit ba71736
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 13 deletions.
13 changes: 11 additions & 2 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spec_helper'
include Puppet::Util

Check failure on line 4 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/MixinUsage: `include` is used at the top level. Use inside `class` or `module`.

describe 'zabbix::agent' do
let :node do
Expand Down Expand Up @@ -68,8 +69,16 @@
it { is_expected.to contain_selinux__module('zabbix-agent') } if facts[:os]['family'] == 'RedHat'
it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0

Check failure on line 74 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0

Check failure on line 75 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '12') >= 0

Check failure on line 76 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
when 'Ubuntu'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0

Check failure on line 78 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0

Check failure on line 79 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') >= 0

Check failure on line 80 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
end
it { is_expected.to contain_file(include_dir).with_ensure('directory') }

# Make sure package will be installed, service running and ensure of directory.
Expand Down
13 changes: 11 additions & 2 deletions spec/classes/javagateway_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spec_helper'
include Puppet::Util

Check failure on line 4 in spec/classes/javagateway_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/MixinUsage: `include` is used at the top level. Use inside `class` or `module`.

describe 'zabbix::javagateway' do
let :node do
Expand Down Expand Up @@ -29,8 +30,16 @@

it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0

Check failure on line 35 in spec/classes/javagateway_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0

Check failure on line 36 in spec/classes/javagateway_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '12') >= 0
when 'Ubuntu'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') >= 0
end
end

context 'when declaring manage_repo is true' do
Expand Down
14 changes: 11 additions & 3 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'deep_merge'
require 'spec_helper'
include Puppet::Util

describe 'zabbix::repo' do
on_supported_os.each do |os, facts|
Expand All @@ -19,9 +20,16 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('zabbix::params') }
it { is_expected.to contain_class('zabbix::repo') }

it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '12') >= 0
when 'Ubuntu'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') >= 0
end

context 'when repo_location is "https://example.com/foo"' do
let :params do
Expand Down
13 changes: 11 additions & 2 deletions spec/classes/sender_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spec_helper'
include Puppet::Util

describe 'zabbix::sender' do
let :node do
Expand Down Expand Up @@ -53,8 +54,16 @@
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
when 'Debian'
it { is_expected.to contain_apt__source('zabbix') }
it { is_expected.to contain_apt__key('zabbix-A1848F5') }
it { is_expected.to contain_apt__key('zabbix-FBABD5F') }
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '12') >= 0
when 'Ubuntu'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') >= 0
end
end
end
end
Expand Down
13 changes: 11 additions & 2 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'spec_helper'
require 'deep_merge'
include Puppet::Util

describe 'zabbix::server' do
let :node do
Expand All @@ -28,8 +29,16 @@
it { is_expected.not_to contain_zabbix__startup('zabbix-server') }

it { is_expected.to contain_apt__source('zabbix') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '12') >= 0
when 'Ubuntu'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') >= 0
end
end

if facts[:os]['family'] == 'RedHat'
Expand Down
13 changes: 11 additions & 2 deletions spec/classes/web_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'spec_helper'
require 'deep_merge'
include Puppet::Util

describe 'zabbix::web' do
let :node do
Expand Down Expand Up @@ -40,8 +41,16 @@ class { 'apache':
it { is_expected.to contain_class('Zabbix::Repo') }
it { is_expected.to contain_file('/etc/zabbix/web').with_ensure('directory') }

it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
case facts[:os]['name']
when 'Debian'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '12') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '12') >= 0
when 'Ubuntu'
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') < 0
it { is_expected.to contain_apt__keyring('zabbix-official-repo.asc') } if Package.versioncmp(facts[:os]['release']['major'], '22.04') >= 0
end
it { is_expected.to contain_apt__source('zabbix') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_yumrepo('zabbix') } if facts[:os]['family'] == 'RedHat'
it { is_expected.to contain_yumrepo('zabbix-nonsupported') } if facts[:os]['family'] == 'RedHat'
Expand Down

0 comments on commit ba71736

Please sign in to comment.