Sha256: fa0ada0cdf9c73462adfa2d1439d96bd306edd5297a664a26aad66ab5f480e2c
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require_relative 'shared_hosts_context' require_relative 'different_redis_type_migrator' require_relative 'pretested_migrator' describe Redis::PipeMigrator do let(:migrator) { Redis::PipeMigrator.new(old_hosts) } include_context 'shared hosts context' let(:old_cluster) { Redis::Distributed.new(old_hosts) } let(:destination_cluster) { Redis::Distributed.new(new_hosts) } let(:pipe) { PipeMock.new(destination_cluster) } before { allow(migrator).to receive(:redis).and_return(old_cluster) } describe '#migrate' do context do let(:node) { {} } before { expect(IO).to receive(:popen).and_return(pipe) } it_behaves_like 'different redis type migrator' end context do before do command = 'redis-cli -h localhost -p 6378 -n 1 --pipe' expect(IO).to receive(:popen).with(command, IO::RDWR).and_return(pipe) end it_behaves_like 'pretested migrator' it_behaves_like 'safe pretested migrator' end end describe '#copy_key' do subject { migrator.copy_key(nil, key) } context 'with unknown key' do let(:key) { 'some_key' } it { should == false } end context 'when known set key' do let(:key) { 'a' } before { old_cluster.sadd('a', 1) } it 'calls copy_set' do expect(migrator).to receive(:copy_set).with(nil, 'a') subject end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis_migrator-0.1.2 | spec/redis_pipe_migrator_spec.rb |
redis_migrator-0.1.1 | spec/redis_pipe_migrator_spec.rb |