Sha256: 1632a3ebc48566a084e8afb6d41191bcab5d841631d10a826ddb6ded154935ff

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

require 'spec_helper'

describe CephStorage::Cluster do
  let(:config) { cluster_config }
  let(:cluster) { CephStorage::ClusterFactory.build config }
  subject { cluster }

  it 'should respond to rados_cluster' do
    expect(subject).to respond_to :rados_cluster
  end

  it 'should respond to pool' do
    expect(subject).to respond_to :pool
  end

  it 'should respond to open?' do
    expect(subject).to respond_to :open?
  end

  it 'should respond to open' do
    expect(subject).to respond_to :open
  end

  it 'should respond to shutdown' do
    expect(subject).to respond_to :shutdown
  end

  it 'should respond to ensure open' do
    expect(subject).to respond_to :ensure_open
  end

  it 'should be a ::CephRuby::Cluster' do
    expect(subject).to be_a ::CephRuby::Cluster
  end

  describe 'calling build with the same attributes' do
    let(:second_cluster) { CephStorage::ClusterFactory.build config }
    it 'should be the same object as subject' do
      expect(subject).to be(second_cluster)
    end

    let(:third_config) { config.clone }
    before { third_config.delete(:flags) }
    let(:third_cluster) { CephStorage::ClusterFactory.build third_config }

    it 'should be the same when changing attribute to equivilent default' do
      expect(subject).to be(third_cluster)
    end
  end

  describe 'Calling pool' do
    let(:pool_name) { spec_config[:pool][:name] }
    let(:pool) { cluster.pool(pool_name) }
    subject { pool }

    it 'should be a pool factory' do
      expect(subject).to be_a CephStorage::Pool
    end
  end

  describe 'Calling inherited functions' do
    describe 'status' do
      it 'should not raise exception' do
        expect { cluster.status }.not_to raise_exception
      end

      it 'should return a hash' do
        expect(cluster.status).to be_a Hash
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ceph_storage-0.1.1 spec/ceph_storage_cluster_spec.rb