elastomer-client 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d22300f2c0a799c8b2253f60928f24d7da61e39
4
- data.tar.gz: 19e135b931dece3946b68469ad52f56dcb9b8271
3
+ metadata.gz: 900eb1195a08a9969b4e7f4565cffecdbe708e48
4
+ data.tar.gz: a509b8be56e561d48c40e308a5c7886d9ba1ce0e
5
5
  SHA512:
6
- metadata.gz: cebdfe02683dee2502e7beb39040dc876884d44656b2f0f5a0aa071621cd6c89be23a39c88b2b0185bc1035c76f01dd42748e1b5cdd14a13ecf5fa1c93696b7f
7
- data.tar.gz: 06bbcedac35ee8a1a947b3fcb87c6e451d05d03f390971f5de678c3298b1924414e22cc062459ef378d872134a8d36b5f92cbb903d9c35b7aa923f8055b1d977
6
+ metadata.gz: 03f8c87cf315cd325bebe44e1fc01ed4d887cbbff374be50a6610f79aaffd8ffcbf0c2e7039f00d1c4f9abd6c58ecb0550414c014e3ab0a48e8f773f4d705738
7
+ data.tar.gz: 46e183c77bb89b5c9dd040f5f3766fd5a8c8a534c31ccb828ed3aa5bab0c984649a3876bde35b3ba1f1f0129d2e336793a6abd6444e570a370dbddcb6c6741c8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.1.1 (2018-02-24)
2
+ - Output opaque ID information when a conflict is detected
3
+ - Updating the `semantic` gem
4
+
1
5
  ## 3.1.0 (2018-01-19)
2
6
  - Added the `strict_params` flag for enforcing params passed to the REST API
3
7
  - Added the `RestApiSpec` module and classes for enforcing strict params
@@ -32,8 +32,10 @@ module Elastomer
32
32
  env[:request_headers][X_OPAQUE_ID] = uuid
33
33
 
34
34
  @app.call(env).on_complete do |renv|
35
- if uuid != renv[:response_headers][X_OPAQUE_ID]
36
- raise ::Elastomer::Client::OpaqueIdError, "conflicting 'X-Opaque-Id' headers"
35
+ response_uuid = renv[:response_headers][X_OPAQUE_ID]
36
+ if uuid != response_uuid
37
+ raise ::Elastomer::Client::OpaqueIdError,
38
+ "Conflicting 'X-Opaque-Id' headers: request #{uuid.inspect}, response #{response_uuid.inspect}"
37
39
  end
38
40
  end
39
41
  end
@@ -1,5 +1,5 @@
1
1
  module Elastomer
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.1"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -37,4 +37,31 @@ describe Elastomer::Middleware::OpaqueId do
37
37
  assert_raises(Elastomer::Client::OpaqueIdError) { @client.cluster.state }
38
38
  end
39
39
 
40
+ it 'generates a UUID per call' do
41
+ opaque_id = Elastomer::Middleware::OpaqueId.new
42
+
43
+ uuid1 = opaque_id.generate_uuid
44
+ uuid2 = opaque_id.generate_uuid
45
+
46
+ assert uuid1 != uuid2, "UUIDs should be unique"
47
+ end
48
+
49
+ it 'generates a UUID per thread' do
50
+ opaque_id = Elastomer::Middleware::OpaqueId.new
51
+ uuids = []
52
+ threads = []
53
+
54
+ 3.times do
55
+ threads << Thread.new { uuids << opaque_id.generate_uuid }
56
+ end
57
+ threads.each { |t| t.join }
58
+
59
+ assert_equal 3, uuids.length, "expecting 3 UUIDs to be generated"
60
+
61
+ # each UUID has 16 random characters as the base ID
62
+ uuids.each { |uuid| assert_match(%r/\A[a-zA-Z0-9_-]{16}0{8}\z/, uuid) }
63
+
64
+ bases = uuids.map { |uuid| uuid[0,16] }
65
+ assert_equal 3, bases.uniq.length, "each thread did not get a unique base ID"
66
+ end
40
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastomer-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-20 00:00:00.000000000 Z
12
+ date: 2018-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable