Sha256: 48a17a5000d2c46c4fa0c76be8f92320d4068ebeb89b9ea214d825f574901111

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

# Locking is not implemented in etcd v3.1.X
unless $instance.version < Gem::Version.new("3.2.0")
  describe Etcdv3::Lock do
    let(:stub) { local_stub(Etcdv3::Lock, 1) }
    let(:lease_stub) { local_stub(Etcdv3::Lease, 1) }

    it_should_behave_like "a method with a GRPC timeout", described_class, :unlock, :unlock, 'foo'
    #it_should_behave_like "a method with a GRPC timeout", described_class, :lock, :lock, 'foo'

    describe '#lock' do
      it 'returns a response' do
        lease_id = lease_stub.lease_grant(10)['ID']

        expect(stub.lock('example1', lease_id)).to be_an_instance_of(V3lockpb::LockResponse)
      end

      it 'passes metadata correctly' do
        lease_id = lease_stub.lease_grant(10)['ID']
        stub = expect_metadata_passthrough(described_class, :lock, :lock)
        stub.lock('example2', lease_id)
      end
    end

    describe '#unlock' do
      it 'returns a response' do
        expect(stub.unlock('example3')).to be_an_instance_of(V3lockpb::UnlockResponse)
      end

      it 'passes metadata correctly' do
        stub = expect_metadata_passthrough(described_class, :unlock, :unlock)
        stub.unlock('example4')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/lock_spec.rb
etcdv3-0.11.6 spec/etcdv3/lock_spec.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/lock_spec.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/lock_spec.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/lock_spec.rb
etcdv3-0.11.5 spec/etcdv3/lock_spec.rb