<commit_before># encoding: utf-8

require 'spec_helper'

describe 'mesos::slave' do
  include_context 'setup context'

  shared_examples_for 'a slave recipe' do
    describe 'deploy env file' do
      it 'creates it' do
        expect(chef_run).to create_template '/usr/local/var/mesos/deploy/mesos-deploy-env.sh'
      end

      it 'contains SSH_OPTS variable' do
        expect(chef_run).to render_file('/usr/local/var/mesos/deploy/mesos-deploy-env.sh')
          .with_content(/^export SSH_OPTS="#{Regexp.escape('-o StrictHostKeyChecking=no -o ConnectTimeout=2')}"$/)
      end

      it 'contains DEPLOY_WITH_SUDO variable' do
        expect(chef_run).to render_file('/usr/local/var/mesos/deploy/mesos-deploy-env.sh')
          .with_content(/^export DEPLOY_WITH_SUDO="1"$/)
      end
    end

    describe 'slave env file' do
      it 'creates it' do
        expect(chef_run).to create_template '/usr/local/var/mesos/deploy/mesos-slave-env.sh'
      end

      it 'contains each key-value pair from node[:mesos][:master]' do
        expect(chef_run).to render_file('/usr/local/var/mesos/deploy/mesos-slave-env.sh')
          .with_content(/^export MESOS_slave_key=slave_value$/)
      end
    end
  end

  context 'when installed from mesosphere' do
    let :chef_run do
      ChefSpec::Runner.new do |node|
        node.set[:mesos][:type] = 'mesosphere'
        node.set[:mesos][:slave][:master] = 'test-master'
        node.set[:mesos][:mesosphere][:with_zookeeper] = true
        node.set[:mesos][:slave][:slave_key] = 'slave_value'
      end.converge(described_recipe)
    end

    it_behaves_like 'an installation from mesosphere'
    it_behaves_like 'a slave recipe'

    context '/etc/mesos/zk' do
      it 'creates it' do<commit_msg>Update incorrect test case description<commit_after># encoding: utf-8

require 'spec_helper'

describe 'mesos::slave' do
  include_context 'setup context'

  shared_examples_for 'a slave recipe' do
    describe 'deploy env file' do
      it 'creates it' do
        expect(chef_run).to create_template '/usr/local/var/mesos/deploy/mesos-deploy-env.sh'
      end

      it 'contains SSH_OPTS variable' do
        expect(chef_run).to render_file('/usr/local/var/mesos/deploy/mesos-deploy-env.sh')
          .with_content(/^export SSH_OPTS="#{Regexp.escape('-o StrictHostKeyChecking=no -o ConnectTimeout=2')}"$/)
      end

      it 'contains DEPLOY_WITH_SUDO variable' do
        expect(chef_run).to render_file('/usr/local/var/mesos/deploy/mesos-deploy-env.sh')
          .with_content(/^export DEPLOY_WITH_SUDO="1"$/)
      end
    end

    describe 'slave env file' do
      it 'creates it' do
        expect(chef_run).to create_template '/usr/local/var/mesos/deploy/mesos-slave-env.sh'
      end

      it 'contains each key-value pair from node[:mesos][:slave]' do
        expect(chef_run).to render_file('/usr/local/var/mesos/deploy/mesos-slave-env.sh')
          .with_content(/^export MESOS_slave_key=slave_value$/)
      end
    end
  end

  context 'when installed from mesosphere' do
    let :chef_run do
      ChefSpec::Runner.new do |node|
        node.set[:mesos][:type] = 'mesosphere'
        node.set[:mesos][:slave][:master] = 'test-master'
        node.set[:mesos][:mesosphere][:with_zookeeper] = true
        node.set[:mesos][:slave][:slave_key] = 'slave_value'
      end.converge(described_recipe)
    end

    it_behaves_like 'an installation from mesosphere'
    it_behaves_like 'a slave recipe'

    context '/etc/mesos/zk' do
      it 'creates it' do
{'fraction_non_alphanumeric': 0.1267765776009096, 'fraction_numerical': 0.0017055144968732233, 'mean_word_length': 3.0682080924855493, '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': '7629096', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1200, 'n_words': 241}