avro_turf 0.7.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +36 -0
- data/.github/workflows/ruby.yml +20 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +0 -3
- data/README.md +54 -16
- data/avro_turf.gemspec +13 -2
- data/lib/avro_turf.rb +14 -3
- data/lib/avro_turf/cached_confluent_schema_registry.rb +39 -0
- data/lib/avro_turf/cached_schema_registry.rb +4 -24
- data/lib/avro_turf/confluent_schema_registry.rb +106 -0
- data/lib/avro_turf/disk_cache.rb +83 -0
- data/lib/avro_turf/in_memory_cache.rb +38 -0
- data/lib/avro_turf/messaging.rb +77 -9
- data/lib/avro_turf/mutable_schema_store.rb +18 -0
- data/lib/avro_turf/schema_registry.rb +4 -77
- data/lib/avro_turf/schema_store.rb +36 -19
- data/lib/avro_turf/schema_to_avro_patch.rb +11 -0
- data/lib/avro_turf/test/fake_confluent_schema_registry_server.rb +141 -0
- data/lib/avro_turf/test/fake_schema_registry_server.rb +4 -82
- data/lib/avro_turf/version.rb +1 -1
- data/spec/cached_confluent_schema_registry_spec.rb +63 -0
- data/spec/confluent_schema_registry_spec.rb +9 -0
- data/spec/disk_cached_confluent_schema_registry_spec.rb +159 -0
- data/spec/messaging_spec.rb +208 -19
- data/spec/schema_store_spec.rb +36 -0
- data/spec/schema_to_avro_patch_spec.rb +42 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/{schema_registry_context.rb → confluent_schema_registry_context.rb} +72 -8
- data/spec/test/fake_confluent_schema_registry_server_spec.rb +40 -0
- metadata +49 -16
- data/circle.yml +0 -4
- data/spec/cached_schema_registry_spec.rb +0 -41
- data/spec/schema_registry_spec.rb +0 -9
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rack/test'
|
2
|
+
require 'avro_turf/test/fake_confluent_schema_registry_server'
|
3
|
+
|
4
|
+
describe FakeConfluentSchemaRegistryServer do
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
def app; described_class; end
|
8
|
+
|
9
|
+
let(:schema) do
|
10
|
+
{
|
11
|
+
type: "record",
|
12
|
+
name: "person",
|
13
|
+
fields: [
|
14
|
+
{ name: "name", type: "string" }
|
15
|
+
]
|
16
|
+
}.to_json
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'POST /subjects/:subject/versions' do
|
20
|
+
it 'returns the same schema ID when invoked with same schema and same subject' do
|
21
|
+
post '/subjects/person/versions', { schema: schema }.to_json, 'CONTENT_TYPE' => 'application/vnd.schemaregistry+json'
|
22
|
+
|
23
|
+
expected_id = JSON.parse(last_response.body).fetch('id')
|
24
|
+
|
25
|
+
post '/subjects/person/versions', { schema: schema }.to_json, 'CONTENT_TYPE' => 'application/vnd.schemaregistry+json'
|
26
|
+
|
27
|
+
expect(JSON.parse(last_response.body).fetch('id')).to eq expected_id
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns a different schema ID when invoked with same schema and different subject' do
|
31
|
+
post '/subjects/person/versions', { schema: schema }.to_json, 'CONTENT_TYPE' => 'application/vnd.schemaregistry+json'
|
32
|
+
|
33
|
+
original_id = JSON.parse(last_response.body).fetch('id')
|
34
|
+
|
35
|
+
post '/subjects/happy-person/versions', { schema: schema }.to_json, 'CONTENT_TYPE' => 'application/vnd.schemaregistry+json'
|
36
|
+
|
37
|
+
expect(JSON.parse(last_response.body).fetch('id')).not_to eq original_id
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro_turf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 1.7.7
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '1.
|
22
|
+
version: '1.10'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 1.7.7
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '1.
|
32
|
+
version: '1.10'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: excon
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '2.0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,20 @@ dependencies:
|
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rack-test
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
145
159
|
description:
|
146
160
|
email:
|
147
161
|
- dasch@zendesk.com
|
@@ -149,16 +163,20 @@ executables: []
|
|
149
163
|
extensions: []
|
150
164
|
extra_rdoc_files: []
|
151
165
|
files:
|
166
|
+
- ".circleci/config.yml"
|
167
|
+
- ".github/workflows/ruby.yml"
|
152
168
|
- ".gitignore"
|
153
169
|
- ".rspec"
|
170
|
+
- CHANGELOG.md
|
154
171
|
- Gemfile
|
155
172
|
- LICENSE.txt
|
156
173
|
- README.md
|
157
174
|
- Rakefile
|
158
175
|
- avro_turf.gemspec
|
159
|
-
- circle.yml
|
160
176
|
- lib/avro_turf.rb
|
177
|
+
- lib/avro_turf/cached_confluent_schema_registry.rb
|
161
178
|
- lib/avro_turf/cached_schema_registry.rb
|
179
|
+
- lib/avro_turf/confluent_schema_registry.rb
|
162
180
|
- lib/avro_turf/core_ext.rb
|
163
181
|
- lib/avro_turf/core_ext/date.rb
|
164
182
|
- lib/avro_turf/core_ext/enumerable.rb
|
@@ -170,10 +188,14 @@ files:
|
|
170
188
|
- lib/avro_turf/core_ext/symbol.rb
|
171
189
|
- lib/avro_turf/core_ext/time.rb
|
172
190
|
- lib/avro_turf/core_ext/true_class.rb
|
191
|
+
- lib/avro_turf/disk_cache.rb
|
192
|
+
- lib/avro_turf/in_memory_cache.rb
|
173
193
|
- lib/avro_turf/messaging.rb
|
194
|
+
- lib/avro_turf/mutable_schema_store.rb
|
174
195
|
- lib/avro_turf/schema_registry.rb
|
175
196
|
- lib/avro_turf/schema_store.rb
|
176
197
|
- lib/avro_turf/schema_to_avro_patch.rb
|
198
|
+
- lib/avro_turf/test/fake_confluent_schema_registry_server.rb
|
177
199
|
- lib/avro_turf/test/fake_schema_registry_server.rb
|
178
200
|
- lib/avro_turf/version.rb
|
179
201
|
- perf/address.avsc
|
@@ -181,7 +203,8 @@ files:
|
|
181
203
|
- perf/encoding_speed.rb
|
182
204
|
- perf/person.avsc
|
183
205
|
- spec/avro_turf_spec.rb
|
184
|
-
- spec/
|
206
|
+
- spec/cached_confluent_schema_registry_spec.rb
|
207
|
+
- spec/confluent_schema_registry_spec.rb
|
185
208
|
- spec/core_ext/date_spec.rb
|
186
209
|
- spec/core_ext/enumerable_spec.rb
|
187
210
|
- spec/core_ext/false_class_spec.rb
|
@@ -192,17 +215,26 @@ files:
|
|
192
215
|
- spec/core_ext/symbol_spec.rb
|
193
216
|
- spec/core_ext/time_spec.rb
|
194
217
|
- spec/core_ext/true_class_spec.rb
|
218
|
+
- spec/disk_cached_confluent_schema_registry_spec.rb
|
195
219
|
- spec/messaging_spec.rb
|
196
|
-
- spec/schema_registry_spec.rb
|
197
220
|
- spec/schema_store_spec.rb
|
198
221
|
- spec/schema_to_avro_patch_spec.rb
|
199
222
|
- spec/spec_helper.rb
|
200
|
-
- spec/support/
|
223
|
+
- spec/support/confluent_schema_registry_context.rb
|
224
|
+
- spec/test/fake_confluent_schema_registry_server_spec.rb
|
201
225
|
homepage: https://github.com/dasch/avro_turf
|
202
226
|
licenses:
|
203
227
|
- MIT
|
204
228
|
metadata: {}
|
205
|
-
post_install_message:
|
229
|
+
post_install_message: |2
|
230
|
+
|
231
|
+
avro_turf v0.8.0 deprecates the names AvroTurf::SchemaRegistry,
|
232
|
+
AvroTurf::CachedSchemaRegistry, and FakeSchemaRegistryServer.
|
233
|
+
|
234
|
+
Use AvroTurf::ConfluentSchemaRegistry, AvroTurf::CachedConfluentSchemaRegistry,
|
235
|
+
and FakeConfluentSchemaRegistryServer instead.
|
236
|
+
|
237
|
+
See https://github.com/dasch/avro_turf#deprecation-notice
|
206
238
|
rdoc_options: []
|
207
239
|
require_paths:
|
208
240
|
- lib
|
@@ -218,14 +250,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
250
|
version: '0'
|
219
251
|
requirements: []
|
220
252
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.
|
253
|
+
rubygems_version: 2.7.6
|
222
254
|
signing_key:
|
223
255
|
specification_version: 4
|
224
256
|
summary: A library that makes it easier to use the Avro serialization format from
|
225
257
|
Ruby
|
226
258
|
test_files:
|
227
259
|
- spec/avro_turf_spec.rb
|
228
|
-
- spec/
|
260
|
+
- spec/cached_confluent_schema_registry_spec.rb
|
261
|
+
- spec/confluent_schema_registry_spec.rb
|
229
262
|
- spec/core_ext/date_spec.rb
|
230
263
|
- spec/core_ext/enumerable_spec.rb
|
231
264
|
- spec/core_ext/false_class_spec.rb
|
@@ -236,10 +269,10 @@ test_files:
|
|
236
269
|
- spec/core_ext/symbol_spec.rb
|
237
270
|
- spec/core_ext/time_spec.rb
|
238
271
|
- spec/core_ext/true_class_spec.rb
|
272
|
+
- spec/disk_cached_confluent_schema_registry_spec.rb
|
239
273
|
- spec/messaging_spec.rb
|
240
|
-
- spec/schema_registry_spec.rb
|
241
274
|
- spec/schema_store_spec.rb
|
242
275
|
- spec/schema_to_avro_patch_spec.rb
|
243
276
|
- spec/spec_helper.rb
|
244
|
-
- spec/support/
|
245
|
-
|
277
|
+
- spec/support/confluent_schema_registry_context.rb
|
278
|
+
- spec/test/fake_confluent_schema_registry_server_spec.rb
|
data/circle.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'webmock/rspec'
|
2
|
-
require 'avro_turf/cached_schema_registry'
|
3
|
-
require 'avro_turf/test/fake_schema_registry_server'
|
4
|
-
|
5
|
-
describe AvroTurf::CachedSchemaRegistry do
|
6
|
-
let(:upstream) { instance_double(AvroTurf::SchemaRegistry) }
|
7
|
-
let(:registry) { described_class.new(upstream) }
|
8
|
-
let(:id) { rand(999) }
|
9
|
-
let(:schema) do
|
10
|
-
{
|
11
|
-
type: "record",
|
12
|
-
name: "person",
|
13
|
-
fields: [{ name: "name", type: "string" }]
|
14
|
-
}.to_json
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "#fetch" do
|
18
|
-
it "caches the result of fetch" do
|
19
|
-
allow(upstream).to receive(:fetch).with(id).and_return(schema)
|
20
|
-
registry.fetch(id)
|
21
|
-
expect(registry.fetch(id)).to eq(schema)
|
22
|
-
expect(upstream).to have_received(:fetch).exactly(1).times
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#register" do
|
27
|
-
let(:subject_name) { "a_subject" }
|
28
|
-
|
29
|
-
it "caches the result of register" do
|
30
|
-
allow(upstream).to receive(:register).with(subject_name, schema).and_return(id)
|
31
|
-
registry.register(subject_name, schema)
|
32
|
-
expect(registry.register(subject_name, schema)).to eq(id)
|
33
|
-
expect(upstream).to have_received(:register).exactly(1).times
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
it_behaves_like "a schema registry client" do
|
38
|
-
let(:upstream) { AvroTurf::SchemaRegistry.new(registry_url, logger: logger) }
|
39
|
-
let(:registry) { described_class.new(upstream) }
|
40
|
-
end
|
41
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'webmock/rspec'
|
2
|
-
require 'avro_turf/schema_registry'
|
3
|
-
require 'avro_turf/test/fake_schema_registry_server'
|
4
|
-
|
5
|
-
describe AvroTurf::SchemaRegistry do
|
6
|
-
it_behaves_like "a schema registry client" do
|
7
|
-
let(:registry) { described_class.new(registry_url, logger: logger) }
|
8
|
-
end
|
9
|
-
end
|