<commit_before>require 'spec_helper'

describe 'gocd_test::single_agent_lwrp' do
  let(:chef_run) do
    run = ChefSpec::SoloRunner.new(step_into: 'gocd_agent') do |node|
      node.automatic['lsb']['id'] = 'Debian'
      node.automatic['platform_family'] = 'debian'
      node.automatic['platform'] = 'debian'
      node.automatic['os'] = 'linux'
    end
    run.converge(described_recipe)
  end
  it_behaves_like :agent_linux_install

  it 'creates my-go-agent chef resource' do
    expect(chef_run).to  create_gocd_agent('my-go-agent')
  end
  it 'does not create default go-agent chef resource' do
    expect(chef_run).to_not create_gocd_agent('go-agent')
  end

  it 'creates my-go-agent service' do
    expect(chef_run).to enable_service('my-go-agent')
    expect(chef_run).to start_service('my-go-agent')
  end

  it 'creates go agent configuration in /etc/default/my-go-agent' do
    expect(chef_run).to render_file('/etc/default/my-go-agent').with_content { |content|
      expect(content).to_not include('java-6')
      expect(content).to     include('java-7')
      expect(content).to     include('GO_SERVER=go.example.com')
      expect(content).to     include('GO_SERVER_PORT=80')
      expect(content).to     include('AGENT_WORK_DIR=/mnt/big_drive')
      expect(content).to     include('DAEMON=Y')
      expect(content).to     include('VNC=Y')
    }
  end

  it 'creates autoregister properties file' do
    expect(chef_run).to render_file('/var/lib/my-go-agent/config/autoregister.properties').with_content { |content|
      expect(content).to     include('bla-key')
      expect(content).to     include('production')
      expect(content).to     include('my-lwrp-agent')
      expect(content).to     include('java-8, ruby-2.2')
    }
  end

end<commit_msg>expect autoregister files in workspace directory<commit_after>require 'spec_helper'

describe 'gocd_test::single_agent_lwrp' do
  let(:chef_run) do
    run = ChefSpec::SoloRunner.new(step_into: 'gocd_agent') do |node|
      node.automatic['lsb']['id'] = 'Debian'
      node.automatic['platform_family'] = 'debian'
      node.automatic['platform'] = 'debian'
      node.automatic['os'] = 'linux'
    end
    run.converge(described_recipe)
  end
  it_behaves_like :agent_linux_install

  it 'creates my-go-agent chef resource' do
    expect(chef_run).to  create_gocd_agent('my-go-agent')
  end
  it 'does not create default go-agent chef resource' do
    expect(chef_run).to_not create_gocd_agent('go-agent')
  end

  it 'creates my-go-agent service' do
    expect(chef_run).to enable_service('my-go-agent')
    expect(chef_run).to start_service('my-go-agent')
  end

  it 'creates go agent configuration in /etc/default/my-go-agent' do
    expect(chef_run).to render_file('/etc/default/my-go-agent').with_content { |content|
      expect(content).to_not include('java-6')
      expect(content).to     include('java-7')
      expect(content).to     include('GO_SERVER=go.example.com')
      expect(content).to     include('GO_SERVER_PORT=80')
      expect(content).to     include('AGENT_WORK_DIR=/mnt/big_drive')
      expect(content).to     include('DAEMON=Y')
      expect(content).to     include('VNC=Y')
    }
  end

  it 'creates autoregister properties file' do
    expect(chef_run).to render_file('/mnt/big_drive/config/autoregister.properties').with_content { |content|
      expect(content).to     include('bla-key')
      expect(content).to     include('production')
      expect(content).to     include('my-lwrp-agent')
      expect(content).to     include('java-8, ruby-2.2')
    }
  end

end
{'fraction_non_alphanumeric': 0.139020979020979, 'fraction_numerical': 0.003916083916083916, 'mean_word_length': 3.6381322957198443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5079264', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1218, 'n_words': 208}