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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/elastomer/middleware/opaque_id.rb +4 -2
- data/lib/elastomer/version.rb +1 -1
- data/test/middleware/opaque_id_test.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 900eb1195a08a9969b4e7f4565cffecdbe708e48
|
4
|
+
data.tar.gz: a509b8be56e561d48c40e308a5c7886d9ba1ce0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
36
|
-
|
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
|
data/lib/elastomer/version.rb
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2018-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|