<commit_before>require 'spec_helper_acceptance'

['2.4', '3.2', '3.4'].each do |version|
  if version == '2.4' && default[:platform] =~ %r{(ubuntu-16.04-amd64|debian-8-amd64)}
    next
  end
  describe 'zabbix::agent class' do
    context "default parameters and zabbix version #{version}" do
      # Using puppet_apply as a helper
      it 'works idempotently with no errors' do
        pp = <<-EOS
        class { 'zabbix::agent':
          server               => '192.168.20.11',
          zabbix_package_state => 'latest',
          zabbix_version       => '#{version}'
        }
        EOS

        # Run it twice and test for idempotency
        apply_manifest(pp, catch_failures: true)
        apply_manifest(pp, catch_changes: true)
      end

      # do some basic checks
      describe package('zabbix-agent') do
        it { is_expected.to be_installed }
      end

      describe service('zabbix-agent') do<commit_msg>Add tests for 4.0 version<commit_after>require 'spec_helper_acceptance'

['2.4', '3.2', '3.4', '4.0'].each do |version|
  if version == '2.4' && default[:platform] =~ %r{(ubuntu-16.04-amd64|debian-8-amd64)}
    next
  end
  describe 'zabbix::agent class' do
    context "default parameters and zabbix version #{version}" do
      # Using puppet_apply as a helper
      it 'works idempotently with no errors' do
        pp = <<-EOS
        class { 'zabbix::agent':
          server               => '192.168.20.11',
          zabbix_package_state => 'latest',
          zabbix_version       => '#{version}'
        }
        EOS

        # Run it twice and test for idempotency
        apply_manifest(pp, catch_failures: true)
        apply_manifest(pp, catch_changes: true)
      end

      # do some basic checks
      describe package('zabbix-agent') do
        it { is_expected.to be_installed }
      end

      describe service('zabbix-agent') do
{'fraction_non_alphanumeric': 0.11949017525225704, 'fraction_numerical': 0.030801911842804036, 'mean_word_length': 2.305263157894737, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1980702', 'n_tokens_mistral': 633, 'n_tokens_neox': 591, 'n_words': 158}