<commit_before>require "spec_helper"

describe "percona::cluster" do
  let(:cluster_package) do
    "percona-xtradb-cluster-55"
  end

  let(:chef_run) do
    ChefSpec::SoloRunner.new.converge(described_recipe)
  end

  before do
    stub_command("test -f /var/lib/mysql/mysql/user.frm").and_return(true)
    stub_command("test -f /etc/mysql/grants.sql").and_return(true)
  end

  it { expect(chef_run).to include_recipe("percona::package_repo") }
  it { expect(chef_run).to include_recipe("percona::configure_server") }
  it { expect(chef_run).to include_recipe("percona::access_grants") }

  describe "Ubuntu" do
    it { expect(chef_run).to install_package(cluster_package) }

    it "stops the `mysql` service" do
      resource = chef_run.package(cluster_package)
      expect(resource).to notify("service[mysql]").to(:stop).immediately
    end
  end

  describe "CentOS" do
    let(:chef_run) do
      env_options = { platform: "centos", version: "6.5" }
      ChefSpec::SoloRunner.new(env_options).converge(described_recipe)
    end

    it { expect(chef_run).to remove_package("mysql-libs") }
    it { expect(chef_run).to install_package(cluster_package) }
  end
end<commit_msg>update `cluster_spec` to match centos package name<commit_after>require "spec_helper"

describe "percona::cluster" do
  let(:centos_cluster_package) do
    "Percona-XtraDB-Cluster-55"
  end

  let(:ubuntu_cluster_package) do
    "percona-xtradb-cluster-55"
  end

  let(:chef_run) do
    ChefSpec::SoloRunner.new.converge(described_recipe)
  end

  before do
    stub_command("test -f /var/lib/mysql/mysql/user.frm").and_return(true)
    stub_command("test -f /etc/mysql/grants.sql").and_return(true)
  end

  specify do
    expect(chef_run).to include_recipe("percona::package_repo")
    expect(chef_run).to include_recipe("percona::configure_server")
    expect(chef_run).to include_recipe("percona::access_grants")
  end

  describe "Ubuntu" do
    specify do
      expect(chef_run).to install_package(ubuntu_cluster_package)

      expect(chef_run.package(ubuntu_cluster_package)).to(
        notify("service[mysql]").to(:stop).immediately
      )
    end
  end

  describe "CentOS" do
    let(:chef_run) do
      env_options = { platform: "centos", version: "6.5" }
      ChefSpec::SoloRunner.new(env_options).converge(described_recipe)
    end

    specify do
      expect(chef_run).to remove_package("mysql-libs")
      expect(chef_run).to install_package(centos_cluster_package)
    end
  end
end
{'fraction_non_alphanumeric': 0.12409638554216867, 'fraction_numerical': 0.004016064257028112, 'mean_word_length': 4.24421052631579, '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': '6470995', 'n_tokens_mistral': 923, 'n_tokens_neox': 887, 'n_words': 141}