@@ -89,6 +89,7 @@ def test_ctor(self):
8989
9090 def test_ctor_super_inits (self ):
9191 from google .cloud .client import ClientWithProject
92+ from google .cloud .bigtable import __version__ as bigtable_version
9293 from google .api_core import client_options as client_options_lib
9394 from google .cloud .bigtable_v2 .services .bigtable .transports .base import (
9495 DEFAULT_CLIENT_INFO ,
@@ -122,7 +123,9 @@ def test_ctor_super_inits(self):
122123 assert kwargs ["client_options" ] == options_parsed
123124 expected_client_info = copy .copy (DEFAULT_CLIENT_INFO )
124125 expected_client_info .client_library_version = (
125- CrossSync ._Sync_Impl .DataClient ._client_version ()
126+ f"{ bigtable_version } -data"
127+ if not CrossSync ._Sync_Impl .is_async
128+ else f"{ bigtable_version } -data-async"
126129 )
127130 assert (
128131 kwargs ["client_info" ].to_user_agent ()
@@ -138,9 +141,11 @@ def test_ctor_super_inits(self):
138141 assert kwargs ["credentials" ] == credentials
139142 assert kwargs ["client_options" ] == options_parsed
140143
141- def test_ctor_client_info (self ):
144+ def test_ctor_legacy_client (self ):
142145 from google .api_core import client_options as client_options_lib
143146 from google .api_core .gapic_v1 .client_info import ClientInfo
147+ from google .cloud .bigtable import __version__ as bigtable_version
148+ import copy
144149
145150 project = "project-id"
146151 credentials = AnonymousCredentials ()
@@ -157,14 +162,28 @@ def test_ctor_client_info(self):
157162 client_options = options_parsed ,
158163 use_emulator = False ,
159164 _client_info = client_info ,
165+ _is_legacy_client = True ,
160166 )
161167 except TypeError :
162168 pass
163169 assert bigtable_client_init .call_count == 1
164170 kwargs = bigtable_client_init .call_args [1 ]
165171 assert kwargs ["credentials" ] == credentials
166172 assert kwargs ["client_options" ] == options_parsed
167- kwargs ["client_info" ] == client_info
173+ expected_client_info = copy .copy (client_info )
174+ expected_client_info .client_library_version = (
175+ f"{ bigtable_version } -data-shim"
176+ if not CrossSync ._Sync_Impl .is_async
177+ else f"{ bigtable_version } -data-shim-async"
178+ )
179+ assert (
180+ kwargs ["client_info" ].to_user_agent ()
181+ == expected_client_info .to_user_agent ()
182+ )
183+ assert (
184+ kwargs ["client_info" ].to_grpc_metadata ()
185+ == expected_client_info .to_grpc_metadata ()
186+ )
168187
169188 def test_ctor_dict_options (self ):
170189 from google .api_core .client_options import ClientOptions
@@ -238,10 +257,8 @@ def test__start_background_channel_refresh(self):
238257 assert ping_and_warm .call_count == 1
239258 client .close ()
240259
241- def test__start_background_channel_refresh_disable_refresh (self ):
242- client = self ._make_client (
243- project = "project-id" , _disable_background_channel_refresh = True
244- )
260+ def test__start_background_channel_refresh_legacy_client (self ):
261+ client = self ._make_client (project = "project-id" , _is_legacy_client = True )
245262 with mock .patch .object (
246263 client , "_ping_and_warm_instances" , CrossSync ._Sync_Impl .Mock ()
247264 ) as ping_and_warm :
0 commit comments