From 03cbfd20a2f133e06e7a6d4cd94bb5fe235444f1 Mon Sep 17 00:00:00 2001 From: Alain Jobart Date: Wed, 16 Mar 2016 07:35:00 -0700 Subject: [PATCH] Using a new method in protocols_flavor for types. --- test/gorpc_protocols_flavor.py | 3 +++ test/grpc_protocols_flavor.py | 3 +++ test/protocols_flavor.py | 4 ++++ test/vtgatev3_test.py | 4 ++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/gorpc_protocols_flavor.py b/test/gorpc_protocols_flavor.py index c91259ee85..cf3e5a4973 100644 --- a/test/gorpc_protocols_flavor.py +++ b/test/gorpc_protocols_flavor.py @@ -50,6 +50,9 @@ class GoRpcProtocolsFlavor(protocols_flavor.ProtocolsFlavor): def vtgate_python_protocol(self): return 'gorpc' + def vtgate_python_types(self): + return 'mysql' + def client_error_exception_type(self): return face.AbortionError diff --git a/test/grpc_protocols_flavor.py b/test/grpc_protocols_flavor.py index 917a8b7b6e..38c8911f84 100644 --- a/test/grpc_protocols_flavor.py +++ b/test/grpc_protocols_flavor.py @@ -45,6 +45,9 @@ class GRpcProtocolsFlavor(protocols_flavor.ProtocolsFlavor): def vtgate_python_protocol(self): return 'grpc' + def vtgate_python_types(self): + return 'proto3' + def client_error_exception_type(self): return face.AbortionError diff --git a/test/protocols_flavor.py b/test/protocols_flavor.py index ed6cc83e73..578a166918 100644 --- a/test/protocols_flavor.py +++ b/test/protocols_flavor.py @@ -54,6 +54,10 @@ class ProtocolsFlavor(object): """The protocol to use to talk to vtgate with python clients.""" raise NotImplementedError('Not implemented in the base class') + def vtgate_python_types(self): + """Returns either 'proto3' or 'mysql' for the enum types.""" + raise NotImplementedError('Not implemented in the base class') + def client_error_exception_type(self): """The exception type the RPC client implementation returns for errors.""" raise NotImplementedError('Not implemented in the base class') diff --git a/test/vtgatev3_test.py b/test/vtgatev3_test.py index 5a94b6b68a..e28f7f7a15 100755 --- a/test/vtgatev3_test.py +++ b/test/vtgatev3_test.py @@ -250,7 +250,7 @@ class TestVTGateFunctions(unittest.TestCase): def setUp(self): self.master_tablet = shard_1_master - if protocols_flavor().vtgate_python_protocol() == 'grpc': + if protocols_flavor().vtgate_python_types() == 'proto3': self.int_type = 265 self.string_type = 6165 else: @@ -334,7 +334,7 @@ class TestVTGateFunctions(unittest.TestCase): # FIXME(alainjobart): the values encoded in these strings are not UTF-8, # causing the encoding to fail. Check with Sugu on what to do. # Maybe the keyrange should be HEX-encoded in the query to avoid the issue. - if protocols_flavor().vtgate_python_protocol() != 'grpc': + if protocols_flavor().vtgate_python_types() != 'proto3': result = self.execute_on_master( vtgate_conn, "select * from vt_user where keyrange('', '\x80')", {})