This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new fe6a2fc AVRO-2239: Fix RPC interop tests for Ruby (#381)
fe6a2fc is described below
commit fe6a2fc4c4178633d85d84657520967893f18aec
Author: Tim Perkins <[email protected]>
AuthorDate: Sun Nov 18 12:05:41 2018 -0500
AVRO-2239: Fix RPC interop tests for Ruby (#381)
---
lang/ruby/lib/avro/schema_validator.rb | 1 +
lang/ruby/test/test_schema_validator.rb | 4 ++++
share/test/interop/bin/test_rpc_interop.sh | 10 ++++------
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lang/ruby/lib/avro/schema_validator.rb
b/lang/ruby/lib/avro/schema_validator.rb
index 67464fb..2117e92 100644
--- a/lang/ruby/lib/avro/schema_validator.rb
+++ b/lang/ruby/lib/avro/schema_validator.rb
@@ -130,6 +130,7 @@ module Avro
end
def validate_map(expected_schema, datum, path, result)
+ fail TypeMismatchError unless datum.is_a?(Hash)
datum.keys.each do |k|
result.add_error(path, "unexpected key type
'#{ruby_to_avro_type(k.class)}' in map") unless k.is_a?(String)
end
diff --git a/lang/ruby/test/test_schema_validator.rb
b/lang/ruby/test/test_schema_validator.rb
index 93f2ca8..e77569a 100644
--- a/lang/ruby/test/test_schema_validator.rb
+++ b/lang/ruby/test/test_schema_validator.rb
@@ -301,6 +301,10 @@ class TestSchema < Test::Unit::TestCase
assert_failed_validation("at . unexpected key type 'Symbol' in map") do
validate!(schema, some: 1)
end
+
+ assert_failed_validation('at . expected type map, got null') do
+ validate!(schema, nil)
+ end
end
def test_validate_deep_record
diff --git a/share/test/interop/bin/test_rpc_interop.sh
b/share/test/interop/bin/test_rpc_interop.sh
index f8ef7f5..3c9321b 100755
--- a/share/test/interop/bin/test_rpc_interop.sh
+++ b/share/test/interop/bin/test_rpc_interop.sh
@@ -29,15 +29,13 @@ java_server="java -jar
lang/java/tools/target/avro-tools-$VERSION.jar rpcreceive
py_client="python lang/py/build/src/avro/tool.py rpcsend"
py_server="python lang/py/build/src/avro/tool.py rpcreceive"
-#ruby_client="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcsend"
-#ruby_server="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcreceive"
+ruby_client="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcsend"
+ruby_server="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcreceive"
export PYTHONPATH=lang/py/build/src # path to avro Python module
-#clients=("$java_client" "$py_client" "$ruby_client")
-#servers=("$java_server" "$py_server" "$ruby_server")
-clients=("$java_client" "$py_client")
-servers=("$java_server" "$py_server")
+clients=("$java_client" "$py_client" "$ruby_client")
+servers=("$java_server" "$py_server" "$ruby_server")
proto=share/test/schemas/simple.avpr