Sha256: eaacc11bc57a1ea10afd728e1d4323b33d4971ee8e41b9495684ddc12e98082c

Contents?: true

Size: 982 Bytes

Versions: 2

Compression:

Stored size: 982 Bytes

Contents

shared_context 'common keys' do
  let(:keys) { %w(q s j) }
  let(:node) { { host: 'localhost', port: 6378, db: 1 } }
  let(:options) { {} }

  before do
    prefill_cluster(old_cluster)
    migrator.migrate(node, keys, options)
  end

  def common_keys(cluster)
    (cluster.keys('*') & keys).sort
  end

  subject { common_keys(cluster) }
end

shared_examples 'pretested migrator' do
  include_context 'common keys'

  context do
    let(:cluster) { destination_cluster }
    it 'should copy given keys to a new cluster' do
      should == %w(j q s)
    end
  end
end

shared_examples 'safe pretested migrator' do
  include_context 'common keys'

  context do
    let(:cluster) { old_cluster }

    it 'should remove copied keys from the old redis node' do
      should == []
    end

    context 'when asked to not remove' do
      let(:options) { { do_not_remove: true } }
      it 'should keep keys on old node' do
        should == ["j", "q", "s"]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redis_migrator-0.1.2 spec/pretested_migrator.rb
redis_migrator-0.1.1 spec/pretested_migrator.rb