<commit_before>require_relative '../spec_helper'

describe 'zabbix_part::setup' do
  let(:chef_run) do
    ChefSpec::Runner.new(
      cookbook_path: %w(site-cookbooks cookbooks),
      platform:      'centos',
      version:       '6.5'
    ) do |node|
      node.automatic['fqdn'] = 'server01.example.com'
    end.converge(described_recipe)
  end

  before do
    stub_command('/usr/sbin/httpd -t').and_return(0)
    stub_command('which php').and_return(0)
  end

  it 'install mysql-devel' do
    expect(chef_run).to install_package('mysql-devel')
  end

  it 'include database::mysql' do
    expect(chef_run).to include_recipe 'database::mysql'
  end

  it 'include mysql::server' do
    expect(chef_run).to include_recipe 'mysql::server'
  end

  it 'include zabbix::default' do
    expect(chef_run).to include_recipe 'zabbix'
  end

  it 'include zabbix::database' do
    expect(chef_run).to include_recipe 'zabbix::database'
  end

  it 'include zabbix::server' do
    expect(chef_run).to include_recipe 'zabbix::server'
  end

  it 'include zabbix::web' do
    expect(chef_run).to include_recipe 'zabbix::web'
  end

  it 'include apache2::mod_php5' do
    expect(chef_run).to include_recipe 'apache2::mod_php5'
  end

  it 'import zabbix template' do
    expect(chef_run).to ChefSpec::Matchers::ResourceMatcher.new(
      :zabbix_part_import_template,
      :import,
      'zbx_template.xml'
    ).with(
      zabbix_fqdn: 'server01.example.com',
      login: 'admin',
      password: '<PASSWORD>',
      source: 'zbx_template.xml'
    )
  end

  it 'create augo_registration action' do
    expect(chef_run).to ChefSpec::Matchers::ResourceMatcher.new(
      :zabbix_part_auto_registration,
      :create,
      'create auto_registration action'
    ).with(
      zabbix_fqdn: 'server01.example.com',
      login: 'admin',
      password: '<PASSWORD>',
      template: 'Template OS Linux'
    )
  end
end<commit_msg>Fix the FQDN as to refer to the default attributes.<commit_after>require_relative '../spec_helper'

describe 'zabbix_part::setup' do
  let(:chef_run) do
    ChefSpec::Runner.new(
      cookbook_path: %w(site-cookbooks cookbooks),
      platform:      'centos',
      version:       '6.5'
    ).converge(described_recipe)
  end

  before do
    stub_command('/usr/sbin/httpd -t').and_return(0)
    stub_command('which php').and_return(0)
  end

  it 'install mysql-devel' do
    expect(chef_run).to install_package('mysql-devel')
  end

  it 'include database::mysql' do
    expect(chef_run).to include_recipe 'database::mysql'
  end

  it 'include mysql::server' do
    expect(chef_run).to include_recipe 'mysql::server'
  end

  it 'include zabbix::default' do
    expect(chef_run).to include_recipe 'zabbix'
  end

  it 'include zabbix::database' do
    expect(chef_run).to include_recipe 'zabbix::database'
  end

  it 'include zabbix::server' do
    expect(chef_run).to include_recipe 'zabbix::server'
  end

  it 'include zabbix::web' do
    expect(chef_run).to include_recipe 'zabbix::web'
  end

  it 'include apache2::mod_php5' do
    expect(chef_run).to include_recipe 'apache2::mod_php5'
  end

  it 'import zabbix template' do
    expect(chef_run).to ChefSpec::Matchers::ResourceMatcher.new(
      :zabbix_part_import_template,
      :import,
      'zbx_template.xml'
    ).with(
      zabbix_fqdn: 'localhost',
      login: 'admin',
      password: '<PASSWORD>',
      source: 'zbx_template.xml'
    )
  end

  it 'create augo_registration action' do
    expect(chef_run).to ChefSpec::Matchers::ResourceMatcher.new(
      :zabbix_part_auto_registration,
      :create,
      'create auto_registration action'
    ).with(
      zabbix_fqdn: 'localhost',
      login: 'admin',
      password: '<PASSWORD>',
      template: 'Template OS Linux'
    )
  end
end
{'fraction_non_alphanumeric': 0.11998945147679325, 'fraction_numerical': 0.0058016877637130804, 'mean_word_length': 3.4518779342723005, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, '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': '2270620', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1340, 'n_words': 276}