Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.11.9 (#201)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.11.7

PiperOrigin-RevId: 573230664

Source-Link: googleapis/googleapis@93beed3

Source-Link: googleapis/googleapis-gen@f4a4eda
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjRhNGVkYWE4MDU3NjM5ZmNmNmFkZjkxNzk4NzIyODBkMWE4ZjY1MSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Update gapic-generator-python to v1.11.8

PiperOrigin-RevId: 574178735

Source-Link: googleapis/googleapis@7307199

Source-Link: googleapis/googleapis-gen@ce3af21
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2UzYWYyMWI3YzU1OWE4N2MyYmVmYzA3NmJlMGUzYWVkYTNhMjZmMCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Update gapic-generator-python to v1.11.9

PiperOrigin-RevId: 574520922

Source-Link: googleapis/googleapis@5183984

Source-Link: googleapis/googleapis-gen@a59af19
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTU5YWYxOWQ0YWM2NTA5ZmFlZGYxY2MzOTAyOTE0MWI2YTViODk2OCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update post processor image; remove unused files

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Oct 20, 2023
1 parent 90cb1b9 commit d9f7138
Show file tree
Hide file tree
Showing 11 changed files with 258 additions and 515 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:08e34975760f002746b1d8c86fdc90660be45945ee6d9db914d1508acdf9a547
digest: sha256:4f9b3b106ad0beafc2c8a415e3f62c1a0cc23cabea115dbe841b848f581cfe99
# created: 2023-10-09T14:06:13.397766266Z
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ typing-extensions==4.4.0 \
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
# via -r requirements.in
urllib3==1.26.17 \
--hash=sha256:24d6a242c28d29af46c3fae832c36db3bbebcc533dd1bb549172cd739c82df21 \
--hash=sha256:94a757d178c9be92ef5539b8840d48dc9cf1b2709c9d6b588232a055c524458b
urllib3==1.26.18 \
--hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \
--hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0
# via
# requests
# twine
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-dataflow-client/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ API Reference
.. toctree::
:maxdepth: 2

dataflow_v1beta3/services
dataflow_v1beta3/types
dataflow_v1beta3/services_
dataflow_v1beta3/types_


Changelog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,9 @@ def test_launch_flex_template_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = templates.LaunchFlexTemplateResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = templates.LaunchFlexTemplateResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,9 @@ def test_list_job_messages_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = messages.ListJobMessagesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = messages.ListJobMessagesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1621,8 +1621,9 @@ def test_get_job_metrics_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = metrics.JobMetrics.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = metrics.JobMetrics.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -1742,8 +1743,9 @@ def test_get_job_execution_details_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = metrics.JobExecutionDetails.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = metrics.JobExecutionDetails.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -1932,8 +1934,9 @@ def test_get_stage_execution_details_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = metrics.StageExecutionDetails.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = metrics.StageExecutionDetails.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1247,8 +1247,9 @@ def test_get_snapshot_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = snapshots.Snapshot.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = snapshots.Snapshot.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -1381,8 +1382,9 @@ def test_delete_snapshot_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = snapshots.DeleteSnapshotResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = snapshots.DeleteSnapshotResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -1508,8 +1510,9 @@ def test_list_snapshots_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = snapshots.ListSnapshotsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = snapshots.ListSnapshotsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,9 @@ def test_create_job_from_template_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = jobs.Job.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = jobs.Job.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -1440,6 +1441,73 @@ def test_launch_template_rest(request_type):
"update": True,
"transform_name_mapping": {},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
# See https://github.com/googleapis/gapic-generator-python/issues/1748

# Determine if the message type is proto-plus or protobuf
test_field = templates.LaunchTemplateRequest.meta.fields["launch_parameters"]

def get_message_fields(field):
# Given a field which is a message (composite type), return a list with
# all the fields of the message.
# If the field is not a composite type, return an empty list.
message_fields = []

if hasattr(field, "message") and field.message:
is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR")

if is_field_type_proto_plus_type:
message_fields = field.message.meta.fields.values()
# Add `# pragma: NO COVER` because there may not be any `*_pb2` field types
else: # pragma: NO COVER
message_fields = field.message.DESCRIPTOR.fields
return message_fields

runtime_nested_fields = [
(field.name, nested_field.name)
for field in get_message_fields(test_field)
for nested_field in get_message_fields(field)
]

subfields_not_in_runtime = []

# For each item in the sample request, create a list of sub fields which are not present at runtime
# Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime
for field, value in request_init["launch_parameters"].items(): # pragma: NO COVER
result = None
is_repeated = False
# For repeated fields
if isinstance(value, list) and len(value):
is_repeated = True
result = value[0]
# For fields where the type is another message
if isinstance(value, dict):
result = value

if result and hasattr(result, "keys"):
for subfield in result.keys():
if (field, subfield) not in runtime_nested_fields:
subfields_not_in_runtime.append(
{
"field": field,
"subfield": subfield,
"is_repeated": is_repeated,
}
)

# Remove fields from the sample request which are not present in the runtime version of the dependency
# Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime
for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER
field = subfield_to_delete.get("field")
field_repeated = subfield_to_delete.get("is_repeated")
subfield = subfield_to_delete.get("subfield")
if subfield:
if field_repeated:
for i in range(0, len(request_init["launch_parameters"][field])):
del request_init["launch_parameters"][field][i][subfield]
else:
del request_init["launch_parameters"][field][subfield]
request = request_type(**request_init)

# Mock the http request call within the method and fake a response.
Expand All @@ -1450,8 +1518,9 @@ def test_launch_template_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = templates.LaunchTemplateResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = templates.LaunchTemplateResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -1528,33 +1597,6 @@ def test_launch_template_rest_bad_request(

# send a request that will satisfy transcoding
request_init = {"project_id": "sample1", "location": "sample2"}
request_init["launch_parameters"] = {
"job_name": "job_name_value",
"parameters": {},
"environment": {
"num_workers": 1212,
"max_workers": 1202,
"zone": "zone_value",
"service_account_email": "service_account_email_value",
"temp_location": "temp_location_value",
"bypass_temp_dir_validation": True,
"machine_type": "machine_type_value",
"additional_experiments": [
"additional_experiments_value1",
"additional_experiments_value2",
],
"network": "network_value",
"subnetwork": "subnetwork_value",
"additional_user_labels": {},
"kms_key_name": "kms_key_name_value",
"ip_configuration": 1,
"worker_region": "worker_region_value",
"worker_zone": "worker_zone_value",
"enable_streaming_engine": True,
},
"update": True,
"transform_name_mapping": {},
}
request = request_type(**request_init)

# Mock the http request call within the method and fake a BadRequest error.
Expand Down Expand Up @@ -1602,8 +1644,9 @@ def test_get_template_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = templates.GetTemplateResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = templates.GetTemplateResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down

0 comments on commit d9f7138

Please sign in to comment.