Sha256: 4b3070a18d320fa4b249f9487d8b769ebd6ebc5b850d15717a99c9c124fbd3f9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

# Encoding: utf-8

require 'spec_helper'

describe 'lock' do

  let(:client) do
    Etcd.client
  end

  it 'should be able to acquire a lock' do
    expect do
      client.acquire_lock('/my_lock',10)
    end.to_not raise_error
  end

  it 'should be able to renew a lock based on value' do
    client.acquire_lock('/my_lock1', 10, value: 123)
    expect do
      client.renew_lock('/my_lock1', 10, value: 123)
    end.to_not raise_error
  end

  it 'should be able to renew a lock based on index' do
    client.acquire_lock('/my_lock2', 10)
    index = client.get_lock('/my_lock2', field:'index')
    expect do
      client.renew_lock('/my_lock2', 10, index: index)
    end.to_not raise_error
  end

  it 'should be able to delete a lock based on value' do
    client.acquire_lock('/my_lock3', 10, value: 123)
    expect do
      client.delete_lock('/my_lock3', value: 123)
    end.to_not raise_error
  end

  it 'should be able to delete a lock based on index' do
    client.acquire_lock('/my_lock4', 10)
    index = client.get_lock('/my_lock4', field:'index')
    expect do
      client.delete_lock('/my_lock4', index: index)
    end.to_not raise_error
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
etcd-0.2.0.alpha spec/etcd/lock_spec.rb