Sha256: a301c01491d147e042aa73c3a53c7951852a1e8dd5dca5b5ee0c2f8a33a0d9e0

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

shared_examples "watch" do
  it "without index, returns the value at a particular index" do
    key = random_key(4)
    value1 = uuid.generate
    value2 = uuid.generate

    index1 = client.create(key, value1).node.modifiedIndex
    index2 = client.test_and_set(key, value2, value1).node.modifiedIndex

    expect(client.watch(key, index: index1).value).to eq(value1)
    expect(client.watch(key, index: index2).value).to eq(value2)
  end

  it "with index, waits and return when the key is updated" do
    response = nil
    key = random_key
    value = uuid.generate
    thr = Thread.new do
      response = client.watch(key)
    end
    client.set(key, value)
    thr.join
    expect(response.value).to eq(value)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
etcd-0.0.6 spec/functional/watch_spec.rb