Skip to content

Commit f3e83a0

Browse files
fix: compute template test issue (GoogleCloudPlatform#11166)
* fix: compute template test issue * 🦉 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>
1 parent 6e591be commit f3e83a0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compute/client_library/ingredients/instances/create_instance.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ def create_instance(
117117
instance.scheduling = compute_v1.Scheduling()
118118
if accelerators:
119119
instance.guest_accelerators = accelerators
120-
instance.scheduling.on_host_maintenance = compute_v1.Scheduling.OnHostMaintenance.TERMINATE.name
120+
instance.scheduling.on_host_maintenance = (
121+
compute_v1.Scheduling.OnHostMaintenance.TERMINATE.name
122+
)
121123

122124
if preemptible:
123125
# Set the preemptible setting
@@ -126,7 +128,7 @@ def create_instance(
126128
)
127129
instance.scheduling = compute_v1.Scheduling()
128130
instance.scheduling.preemptible = True
129-
131+
130132
if spot:
131133
# Set the Spot VM setting
132134
instance.scheduling.provisioning_model = (

compute/client_library/snippets/tests/test_templates.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def test_create_template_and_list(deletable_template_name):
5656
)
5757
assert template.properties.disks[0].initialize_params.disk_size_gb == 250
5858
assert "debian-11" in template.properties.disks[0].initialize_params.source_image
59-
assert template.properties.network_interfaces[0].name == "global/networks/default"
59+
assert template.properties.network_interfaces[0].name == "nic0"
60+
assert template.properties.network_interfaces[0].network.endswith(
61+
"global/networks/default"
62+
)
6063
assert template.properties.machine_type == "e2-standard-4"
6164

6265

0 commit comments

Comments
 (0)