1717from pathlib import Path
1818import shutil
1919from typing import List , Optional
20+ import re
2021
2122import synthtool as s
2223from synthtool import gcp
@@ -185,6 +186,22 @@ def get_staging_dirs(
185186 )"""
186187 )
187188
189+ count = s .replace (
190+ [
191+ library / "google/cloud/spanner_v1/services/*/transports/grpc*" ,
192+ library / "tests/unit/gapic/spanner_v1/*" ,
193+ ],
194+ "options=\\ [.*?\\ ]" ,
195+ """options=[
196+ ("grpc.max_send_message_length", -1),
197+ ("grpc.max_receive_message_length", -1),
198+ ("grpc.keepalive_time_ms", 120000),
199+ ]""" ,
200+ flags = re .MULTILINE | re .DOTALL ,
201+ )
202+ if count < 1 :
203+ raise Exception ("Expected replacements for gRPC channel options not made." )
204+
188205 s .move (
189206 library ,
190207 excludes = [
@@ -201,6 +218,21 @@ def get_staging_dirs(
201218for library in get_staging_dirs (
202219 spanner_admin_instance_default_version , "spanner_admin_instance"
203220):
221+ count = s .replace (
222+ [
223+ library / "google/cloud/spanner_admin_instance_v1/services/*/transports/grpc*" ,
224+ library / "tests/unit/gapic/spanner_admin_instance_v1/*" ,
225+ ],
226+ "options=\\ [.*?\\ ]" ,
227+ """options=[
228+ ("grpc.max_send_message_length", -1),
229+ ("grpc.max_receive_message_length", -1),
230+ ("grpc.keepalive_time_ms", 120000),
231+ ]""" ,
232+ flags = re .MULTILINE | re .DOTALL ,
233+ )
234+ if count < 1 :
235+ raise Exception ("Expected replacements for gRPC channel options not made." )
204236 s .move (
205237 library ,
206238 excludes = ["google/cloud/spanner_admin_instance/**" , "*.*" , "docs/index.rst" , "noxfile.py" , "**/gapic_version.py" , "testing/constraints-3.7.txt" ,],
@@ -209,6 +241,21 @@ def get_staging_dirs(
209241for library in get_staging_dirs (
210242 spanner_admin_database_default_version , "spanner_admin_database"
211243):
244+ count = s .replace (
245+ [
246+ library / "google/cloud/spanner_admin_database_v1/services/*/transports/grpc*" ,
247+ library / "tests/unit/gapic/spanner_admin_database_v1/*" ,
248+ ],
249+ "options=\\ [.*?\\ ]" ,
250+ """options=[
251+ ("grpc.max_send_message_length", -1),
252+ ("grpc.max_receive_message_length", -1),
253+ ("grpc.keepalive_time_ms", 120000),
254+ ]""" ,
255+ flags = re .MULTILINE | re .DOTALL ,
256+ )
257+ if count < 1 :
258+ raise Exception ("Expected replacements for gRPC channel options not made." )
212259 s .move (
213260 library ,
214261 excludes = ["google/cloud/spanner_admin_database/**" , "*.*" , "docs/index.rst" , "noxfile.py" , "**/gapic_version.py" , "testing/constraints-3.7.txt" ,],
0 commit comments