Sha256: be6979fcbf11ef6290dc11bbe641c2ae95f0503272680ba37e8751726d7463c2

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 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::Namespace::Lock do
    let(:stub) { local_namespace_stub(Etcdv3::Namespace::Lock, 1, '/namespace/') }
    let(:lease_stub) { local_stub(Etcdv3::Lease, 1) }

    # NOTE: this was running duplicate tests against Etcdv3::Lock before, but it
    # doesn't work with Etcdv3::Namespace::Lock
    #
    # 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_namespace(described_class, :lock, :lock, '/namespace/')
        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_namespace(described_class, :unlock, :unlock, '/namespace/')
        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/namespace/lock_spec.rb
etcdv3-0.11.6 spec/etcdv3/namespace/lock_spec.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/namespace/lock_spec.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/namespace/lock_spec.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/etcdv3/namespace/lock_spec.rb
etcdv3-0.11.5 spec/etcdv3/namespace/lock_spec.rb