schema_registry 0.1.0 → 0.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
- SHA1:
3
- metadata.gz: 2899eb9d0ac483c1f750a4e0abd8254fcd276696
4
- data.tar.gz: f67cd142dbf9e9454115e8381de05645a60b5dae
2
+ SHA256:
3
+ metadata.gz: 134eaf08f3cabf0b4da0cf67af43cb035ac307b2b4a39ee38999a0b0f25cbe0c
4
+ data.tar.gz: 69d2282526c7a1460f1ca2daac0b74129c7b72d0b7a438aad9301f5500841feb
5
5
  SHA512:
6
- metadata.gz: 37e0bb51c00b9b0d6600f3176a187fef49652368a6b60d8e7ffc554526f356e86b949bdbdad2aeb2942a6648a40b847835225105da77b2ee62f5f5c781be30d3
7
- data.tar.gz: 6af7faeb40307bd2b547f503b42654fc51fa61e5fc2ace719a91007be23a8afb082229042dd21b25c4d94029057302ab5c8b96e23ac99ce516a0dee32db3ed50
6
+ metadata.gz: 290a7056abc60a3eec77aeff98cd89dea809ac8aaebb6bf92599b3221927516418f6cdef92b1c065f5a1d77bf63c700d20bae5b2b602348d1dd009e471e61917
7
+ data.tar.gz: d6fb09c8bf09821345d229151611a7f00e297228c91c23513f763764d8fb35e20af2eefb40bac59b166cf595d2c8030438ac66868a75fb585a5216c3ed4d98dc
@@ -1,24 +1,26 @@
1
1
  language: ruby
2
- sudo: false
3
2
 
4
- rvm:
5
- - "2.0"
6
- - "2.1"
7
- - "2.2"
8
-
9
- env:
10
- global:
11
- SCHEMA_REGISTRY_URL: "http://localhost:8081"
12
-
13
- before_script:
14
- - make confluent/start
3
+ services:
4
+ - docker
15
5
 
16
- after_script:
17
- - make confluent/stop
18
-
19
- before_cache:
20
- - rm -rf confluent/logs
6
+ rvm:
7
+ - "2.3"
8
+ - "2.4"
9
+ - "2.5"
10
+ - "2.6"
11
+ - "2.7"
21
12
 
22
- cache:
23
- directories:
24
- - confluent
13
+ before_install:
14
+ - docker run -d --name zookeeper -p 2181:2181 confluent/zookeeper
15
+ - while ! nc localhost 2181 </dev/null; do echo "Waiting for zookeeper..."; sleep 1; done
16
+ - docker run -d --name kafka -p 9092:9092 --link zookeeper:zookeeper confluent/kafka
17
+ - while ! nc localhost 9092 </dev/null; do echo "Waiting for Kafka..."; sleep 1; done
18
+ - docker run -d --name schema-registry -p 8081:8081 --link zookeeper:zookeeper --link kafka:kafka confluent/schema-registry
19
+ - while ! nc localhost 8081 </dev/null; do echo "Waiting for schema registry..."; sleep 1; done
20
+ - docker run -d --name rest-proxy -p 8082:8082 --link zookeeper:zookeeper --link kafka:kafka --link schema-registry:schema-registry confluent/rest-proxy
21
+ - while ! nc localhost 8082 </dev/null; do echo "Waiting for rest proxy..."; sleep 1; done
22
+ - docker run -d --name nginx -v $(pwd)/test/schema-registry.conf:/etc/nginx/conf.d/default.conf:ro -p 1081:1081 -p 1082:1082 --link schema-registry:schema-registry --link rest-proxy:rest-proxy nginx
23
+ - while ! nc localhost 1081 </dev/null; do echo "Waiting for nginx reverse proxy..."; sleep 1; done
24
+ - while ! nc localhost 1082 </dev/null; do echo "Waiting for nginx reverse proxy..."; sleep 1; done
25
+ - yes | gem update --system --force
26
+ - gem install bundler
@@ -107,7 +107,7 @@ module SchemaRegistry
107
107
  else raise ArgumentError, "Unsupported request method"
108
108
  end
109
109
 
110
- request = request_class.new(path)
110
+ request = request_class.new(@endpoint.path + path)
111
111
  request.basic_auth(username, password) if username && password
112
112
  request['Accept'] = "application/vnd.schemaregistry.v1+json"
113
113
  if body
@@ -124,7 +124,7 @@ module SchemaRegistry
124
124
  end
125
125
 
126
126
  when Net::HTTPInternalServerError
127
- raise SchemaRegistry::ServerError, "Schema registy responded with a server error: #{esponse.code.to_i}"
127
+ raise SchemaRegistry::ServerError, "Schema registy responded with a server error: #{response.code.to_i}"
128
128
 
129
129
  when Net::HTTPForbidden
130
130
  message = username.nil? ? "Unauthorized" : "User `#{username}` failed to authenticate"
@@ -1,3 +1,3 @@
1
1
  module SchemaRegistry
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency "bundler", "~> 2.0"
22
+ spec.add_development_dependency "rake",' ~> 13'
23
23
  spec.add_development_dependency "minitest", "~> 5.0"
24
24
  spec.add_development_dependency "avro", "~> 1.7"
25
25
  end
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  class SchemaRegistryTest < Minitest::Test
4
4
 
5
5
  def setup
6
- registry_url = ENV['SCHEMA_REGISTRY_URL'] || "http://localhost:8081"
6
+ registry_url = "http://localhost:8081"
7
7
  @client = SchemaRegistry::Client.new(registry_url)
8
8
  end
9
9
 
@@ -0,0 +1,39 @@
1
+ require 'test_helper'
2
+
3
+ class SchemaRegistryTestReverseProxied < Minitest::Test
4
+
5
+ def setup
6
+ registry_url = "http://localhost:1081/registry"
7
+ @client = SchemaRegistry::Client.new(registry_url)
8
+ end
9
+
10
+ def test_global_compatibility_level
11
+ old_level = @client.default_compatibility_level
12
+
13
+ @client.default_compatibility_level = SchemaRegistry::Compatibility::FULL
14
+ current_level = @client.default_compatibility_level
15
+ assert_equal current_level, SchemaRegistry::Compatibility::FULL
16
+ ensure
17
+ @client.default_compatibility_level = old_level
18
+ end
19
+
20
+ def test_register_schema_for_subject
21
+ schema = schema_fixture('test', 1)
22
+
23
+ subject = @client.subject('test.schema_registry')
24
+ schema_id = subject.register_schema(schema)
25
+ assert schema_id > 0
26
+
27
+ assert_equal ['test.schema_registry'], @client.subjects.map(&:name)
28
+
29
+ registered_schema = @client.schema(schema_id)
30
+ schema_info = subject.verify_schema(schema)
31
+ assert_equal schema_id, schema_info.id
32
+
33
+ assert_equal Avro::Schema.parse(schema), Avro::Schema.parse(registered_schema)
34
+
35
+ parsed_schema = JSON.parse(registered_schema)
36
+ assert_equal 'Only used for testing', parsed_schema['doc']
37
+ assert_equal 'present', parsed_schema['metafata_field']
38
+ end
39
+ end
@@ -0,0 +1,24 @@
1
+ server {
2
+ listen 1081;
3
+
4
+ server_name localhost;
5
+
6
+ location /registry {
7
+ proxy_pass http://schema-registry:8081/;
8
+ }
9
+ location /registry/ {
10
+ proxy_pass http://schema-registry:8081/;
11
+ }
12
+ }
13
+ server {
14
+ listen 1082;
15
+
16
+ server_name localhost;
17
+
18
+ location /registry {
19
+ proxy_pass http://rest-proxy:8082/;
20
+ }
21
+ location /registry/ {
22
+ proxy_pass http://rest-proxy:8082/;
23
+ }
24
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2020-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,6 @@ files:
79
79
  - ".travis.yml"
80
80
  - Gemfile
81
81
  - LICENSE.txt
82
- - Makefile
83
82
  - README.md
84
83
  - Rakefile
85
84
  - lib/schema_registry.rb
@@ -90,6 +89,8 @@ files:
90
89
  - schema_registry.gemspec
91
90
  - test/fixtures/schemas/test-v1.avsc
92
91
  - test/functional/schema_registry_test.rb
92
+ - test/functional/schema_registry_test_reverse_proxied.rb
93
+ - test/schema-registry.conf
93
94
  - test/test_helper.rb
94
95
  homepage: http://confluent.io/docs/current/schema-registry/docs/index.html
95
96
  licenses:
@@ -110,12 +111,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  - !ruby/object:Gem::Version
111
112
  version: '0'
112
113
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.5.2
114
+ rubygems_version: 3.0.3
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Ruby client for Confluent Inc.'s schema-registry
118
118
  test_files:
119
119
  - test/fixtures/schemas/test-v1.avsc
120
120
  - test/functional/schema_registry_test.rb
121
+ - test/functional/schema_registry_test_reverse_proxied.rb
122
+ - test/schema-registry.conf
121
123
  - test/test_helper.rb
data/Makefile DELETED
@@ -1,51 +0,0 @@
1
- .PHONY: confluent/kafka/* confluent/zookeeper/* confluent/registry/* confluent/start confluent/stop
2
-
3
- # Confluent platform tasks
4
-
5
- confluent/start: confluent/rest/start
6
-
7
- confluent/stop: confluent/rest/stop confluent/registry/stop confluent/kafka/stop confluent/zookeeper/stop
8
-
9
- # Download & extract tasks
10
-
11
- confluent/confluent.tgz:
12
- mkdir -p confluent && wget http://packages.confluent.io/archive/1.0/confluent-1.0-2.10.4.tar.gz -O confluent/confluent.tgz
13
-
14
- confluent/EXTRACTED: confluent/confluent.tgz
15
- tar xzf confluent/confluent.tgz -C confluent --strip-components 1 && touch confluent/EXTRACTED
16
-
17
- # Zookeeper tasks
18
-
19
- confluent/zookeeper/start: confluent/EXTRACTED
20
- nohup confluent/bin/zookeeper-server-start confluent/etc/kafka/zookeeper.properties 2> log/zookeeper.err > log/zookeeper.out < /dev/null &
21
- while ! nc localhost 2181 </dev/null; do echo "Waiting for zookeeper..."; sleep 1; done
22
-
23
- confluent/zookeeper/stop: confluent/EXTRACTED
24
- confluent/bin/zookeeper-server-stop
25
-
26
- # Kafka tasks
27
-
28
- confluent/kafka/start: confluent/zookeeper/start confluent/EXTRACTED
29
- nohup confluent/bin/kafka-server-start confluent/etc/kafka/server.properties 2> log/kafka.err > log/kafka.out < /dev/null &
30
- while ! nc localhost 9092 </dev/null; do echo "Waiting for Kafka..."; sleep 1; done
31
-
32
- confluent/kafka/stop: confluent/EXTRACTED
33
- confluent/bin/kafka-server-stop
34
-
35
- # schema-registry tasks
36
-
37
- confluent/registry/start: confluent/kafka/start confluent/EXTRACTED
38
- nohup confluent/bin/schema-registry-start confluent/etc/schema-registry/schema-registry.properties 2> log/schema-registry.err > log/schema-registry.out < /dev/null &
39
- while ! nc localhost 8081 </dev/null; do echo "Waiting for schema registry..."; sleep 1; done
40
-
41
- confluent/registry/stop: confluent/EXTRACTED
42
- confluent/bin/kafka-server-stop
43
-
44
- # REST proxy tasks
45
-
46
- confluent/rest/start: confluent/registry/start confluent/EXTRACTED
47
- nohup confluent/bin/kafka-rest-start confluent/etc/kafka-rest/kafka-rest.properties 2> log/kafka-rest.err > log/kafka-rest.out < /dev/null &
48
- while ! nc localhost 8082 </dev/null; do echo "Waiting for REST proxy..."; sleep 1; done
49
-
50
- confluent/rest/stop: confluent/EXTRACTED
51
- confluent/bin/kafka-rest-stop