[ 
https://issues.apache.org/jira/browse/AVRO-2239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16690960#comment-16690960
 ] 

ASF GitHub Bot commented on AVRO-2239:
--------------------------------------

Fokko closed pull request #381: AVRO-2239: Fix RPC interop tests for Ruby
URL: https://github.com/apache/avro/pull/381
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lang/ruby/lib/avro/schema_validator.rb 
b/lang/ruby/lib/avro/schema_validator.rb
index 67464fbfe..2117e92d4 100644
--- a/lang/ruby/lib/avro/schema_validator.rb
+++ b/lang/ruby/lib/avro/schema_validator.rb
@@ -130,6 +130,7 @@ def validate_array(expected_schema, datum, path, result)
       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 93f2ca85b..e77569a31 100644
--- a/lang/ruby/test/test_schema_validator.rb
+++ b/lang/ruby/test/test_schema_validator.rb
@@ -301,6 +301,10 @@ def test_validate_map
     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 f8ef7f5e8..3c9321bf8 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
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Fix interop tests
> -----------------
>
>                 Key: AVRO-2239
>                 URL: https://issues.apache.org/jira/browse/AVRO-2239
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: interop
>            Reporter: Fokko Driesprong
>            Assignee: Tim Perkins
>            Priority: Major
>
> Currently the interop tests are failing:
> /avro/lang/ruby/lib/avro/schema_validator.rb:127:in `validate_map': undefined 
> method `keys' for nil:NilClass (NoMethodError)
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:103:in 
> `validate_recursive'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:156:in `block in 
> validate_possible_types'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:154:in `map'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:154:in 
> `validate_possible_types'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:141:in 
> `validate_union'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:105:in 
> `validate_recursive'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:110:in `block in 
> validate_recursive'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:108:in `each'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:108:in 
> `validate_recursive'
>       from /avro/lang/ruby/lib/avro/schema_validator.rb:67:in `validate!'
>       from /avro/lang/ruby/lib/avro/schema.rb:97:in `validate'
>       from /avro/lang/ruby/lib/avro/io.rb:503:in `write_data'
>       from /avro/lang/ruby/lib/avro/io.rb:499:in `write'
>       from /avro/lang/ruby/lib/avro/ipc.rb:136:in `write_handshake_request'
>       from /avro/lang/ruby/lib/avro/ipc.rb:105:in `request'
>       from lang/ruby/test/tool.rb:69:in `send_message'
>       from lang/ruby/test/tool.rb:137:in `main'
>       from lang/ruby/test/tool.rb:143:in `<main>'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to