Sha256: 16553dd6b03d612f5f6ecdace0ce650475d247465ab6e649b995a4da298c1ab9

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require_relative 'shared_hosts_context'

describe Redis::Migrator do
  include_context 'shared hosts context'
  let(:migrator) { Redis::Migrator.new(old_hosts, new_hosts) }

  describe '#changed_keys' do
    before { prefill_cluster(migrator.old_cluster) }

    it 'should show keys which need migration' do
      migrator.changed_keys.should == {'redis://localhost:6377/0' => %w(h q s y j m n o)}
    end
  end

  describe '#migrator' do
    subject { migrator.send(:migrator, keep_original) }
    let(:keep_original) { false }

    before do
      allow_any_instance_of(MockRedis).to(
          receive(:info).and_return({ 'redis_version' => version })
      )
    end

    context 'when all instances are old' do
      let(:version) { '2.4.1' }
      it { should == Redis::PipeMigrator}
    end

    context 'when all instances are new' do
      let(:version) { '2.6.14' }
      it { should == Redis::NativeMigrator }

      context 'when asking to preserve data on source' do
        let(:keep_original) { true }

        it { should == Redis::PipeMigrator }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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