<commit_before>shared_examples 'provider/vagrant-r10k' do |provider, options|
  # NOTE: vagrant-spec's acceptance framework (specifically IsolatedEnvironment)
  # creates an isolated environment for each 'it' block and tears it down afterwards.
  # This *only* works with the layout below. As such, quite unfortunately, we have a
  # bunch of assertions in each 'it' block; they're not isolated the way they should be.
  # The alternative is to run a complete up/provision/assert/destroy cycle for each
  # assertion we want to make, and also therefore lose the ability to make multiple
  # assertions about one provisioning run.

  if !File.file?(options[:box])
    raise ArgumentError,
      "A box file #{options[:box]} must be downloaded for provider: #{provider}. The rake task should have done this."
  end

  include_context 'acceptance'

  let(:box_ip) { '10.10.10.29' }
  let(:name)   { 'single.testbox.spec' }

  before do
    assert_execute('vagrant', 'box', 'add', "vagrantr10kspec", options[:box])
    ENV['VAGRANT_DEFAULT_PROVIDER'] = provider
  end

  describe 'configured correctly' do
    before do
      environment.skeleton('correct')
    end
    after do
      assert_execute("vagrant", "destroy", "--force", log: false)
    end

    it 'deploys Puppetfile modules' do
      status("Test: vagrant up")
      up_result = assert_execute('vagrant', 'up', "--provider=#{provider}")
      expect(up_result).to exit_with(0)
      expect(up_result.stdout).to include('vagrant-r10k: Building the r10k module path with puppet provisioner module_path "puppet/modules"')
      expect(up_result.stdout).to include("vagrant-r10k: Beginning r10k deploy of puppet modules into #{environment.workdir}/puppet/modules using #{environment.workdir}/puppet/Puppetfile")
      expect(up_result.stdout).to include('vagrant-r10k: Deploy finished')
      expect(up_result.stdout).to include('Running Puppet with default.pp')
      expect(up_result.stdout).to include('vagrant-r10k puppet run')
      expect(up_result.stderr).to match(//)
      puts up_result.stdout

      status("Test: reviewboard module")
      rb_dir = File.join(environment.workdir, 'puppet', 'modules', 'reviewboard')
      expect(File.directory?(rb_dir)).to be_truthy
      rb_result = assert_execute('bash', 'gitcheck.sh', 'puppet/modules/reviewboard')
      expect(rb_result).to exit_with(0)
      expect(rb_result.stdout).to match(/tag: v1\.0\.1 @ cdb8d7a186846b49326cec1cfb4623bd77529b04 \(origin: https:\/\/github\.com\/jantman\/puppet-reviewboard\.git\)/)
      <commit_msg>errors are back (or maybe never went away?)<commit_after>shared_examples 'provider/vagrant-r10k' do |provider, options|
  # NOTE: vagrant-spec's acceptance framework (specifically IsolatedEnvironment)
  # creates an isolated environment for each 'it' block and tears it down afterwards.
  # This *only* works with the layout below. As such, quite unfortunately, we have a
  # bunch of assertions in each 'it' block; they're not isolated the way they should be.
  # The alternative is to run a complete up/provision/assert/destroy cycle for each
  # assertion we want to make, and also therefore lose the ability to make multiple
  # assertions about one provisioning run.

  if !File.file?(options[:box])
    raise ArgumentError,
      "A box file #{options[:box]} must be downloaded for provider: #{provider}. The rake task should have done this."
  end

  include_context 'acceptance'

  let(:box_ip) { '10.10.10.29' }
  let(:name)   { 'single.testbox.spec' }

  before do
    ENV['VAGRANT_DEFAULT_PROVIDER'] = provider
  end

  describe 'configured correctly' do
    before do
      environment.skeleton('correct')
      assert_execute('vagrant', 'box', 'add', "vagrantr10kspec", options[:box])
    end
    after do
      assert_execute("vagrant", "destroy", "--force", log: false)
    end

    it 'deploys Puppetfile modules' do
      status("Test: vagrant up")
      up_result = assert_execute('vagrant', 'up', "--provider=#{provider}")
      expect(up_result).to exit_with(0)
      expect(up_result.stdout).to include('vagrant-r10k: Building the r10k module path with puppet provisioner module_path "puppet/modules"')
      expect(up_result.stdout).to include("vagrant-r10k: Beginning r10k deploy of puppet modules into #{environment.workdir}/puppet/modules using #{environment.workdir}/puppet/Puppetfile")
      expect(up_result.stdout).to include('vagrant-r10k: Deploy finished')
      expect(up_result.stdout).to include('Running Puppet with default.pp')
      expect(up_result.stdout).to include('vagrant-r10k puppet run')
      expect(up_result.stderr).to match(//)
      puts up_result.stdout

      status("Test: reviewboard module")
      rb_dir = File.join(environment.workdir, 'puppet', 'modules', 'reviewboard')
      expect(File.directory?(rb_dir)).to be_truthy
      rb_result = assert_execute('bash', 'gitcheck.sh', 'puppet/modules/reviewboard')
      expect(rb_result).to exit_with(0)
      expect(rb_result.stdout).to match(/tag: v1\.0\.1 @ cdb8d7a186846b49326cec1cfb4623bd77529b04 \(origin: https:\/\/github\.com\/jantman\/puppet-reviewboard\.git\)/)
      
{'fraction_non_alphanumeric': 0.11992979719188768, 'fraction_numerical': 0.02106084243369735, 'mean_word_length': 4.048228346456693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3219808', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1589, 'n_words': 435}