Sha256: c42442a0439e99391e9e1fbeb94d09981a5b0981823a55982cafcd16533ff4d9

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'
require 'logger'
describe CephStorage::StorageObject::Xattr do
  let(:config) { cluster_config }
  let(:spconfig) { spec_config }
  let(:cluster) { CephStorage::ClusterFactory.build config }
  let(:rule_id) { spconfig[:pool][:rule_id] }
  let(:pool_name) { spconfig[:pool][:name] }
  let(:pool) { cluster.pool(pool_name) }

  describe 'pool creation' do
    subject { pool }
    it 'should be able to create pool' do
      expect { subject.create(rule_id: rule_id) }.to_not raise_exception
    end

    it 'should be writable' do
      expect { pool.stat }.not_to raise_exception
      expect(pool.stat).to be_a Hash
    end
  end

  let(:object_name) { spconfig[:pool][:object_name] }
  let(:storage_object) { pool.storage_object(object_name) }

  describe 'Storage Object' do
    subject { storage_object }

    it 'should be writeable' do
      expect { subject.overwrite('some content') }.not_to raise_exception
    end
  end

  describe 'xattr' do
    let(:xattr_name) { spconfig[:pool][:xattr_name] }
    let(:xattr_value) { spconfig[:pool][:xattr_value] }
    let(:xattr) { storage_object.xattr(xattr_name) }
    subject { xattr }

    it 'should be a StorageObject::Xattr' do
      expect(subject).to be_a ::CephStorage::StorageObject::Xattr
    end

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

    describe 'before creation' do
      it 'should not throw an exception on read' do
        expect { subject.value }.to raise_exception Errno::ENODATA
      end

      it 'should be writable' do
        expect { subject.value = xattr_value }.not_to raise_exception
      end

      it 'should match the new value' do
        expect(subject.value).to eq(xattr_value)
      end
    end
  end

  describe 'pool deletion' do
    subject { pool }
    it 'should be able to delete pool' do
      expect { subject.destroy }.not_to raise_exception
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceph_storage-0.1.1 spec/ceph_storage_xattr_spec.rb
ceph_storage-0.1.0 spec/ceph_storage_xattr_spec.rb