From 13427e42bd44b12f7ad1b9ab06740f66482ec7ef Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Fri, 22 Oct 2021 19:31:36 +0200 Subject: [PATCH 1/5] chore(docs): Securing tests against leaks. --- samples/snippets/noxfile_config.py | 3 + samples/snippets/test_sample_create_vm.py | 88 ++++++++++++----------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/samples/snippets/noxfile_config.py b/samples/snippets/noxfile_config.py index 16c4c694e..e26fd4aef 100644 --- a/samples/snippets/noxfile_config.py +++ b/samples/snippets/noxfile_config.py @@ -15,4 +15,7 @@ TEST_CONFIG_OVERRIDE = { # Tests in test_sample_default_values.py require separate projects to not interfere with each other. 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', + # Temporarily blocking all versions except 3.8, as I have + # viewer access only to 3.8 test project. + 'ignored_versions': ["3.6", "3.7", "3.9", "3.10"] } diff --git a/samples/snippets/test_sample_create_vm.py b/samples/snippets/test_sample_create_vm.py index b69570f16..f3e265bb6 100644 --- a/samples/snippets/test_sample_create_vm.py +++ b/samples/snippets/test_sample_create_vm.py @@ -48,13 +48,13 @@ def src_disk(request): op = disk_client.insert(project=PROJECT, zone=INSTANCE_ZONE, disk_resource=disk) wait_for_operation(op, PROJECT) - disk = disk_client.get(project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name) - request.cls.disk = disk - - yield disk - - op = disk_client.delete(project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name) - wait_for_operation(op, PROJECT) + try: + disk = disk_client.get(project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name) + request.cls.disk = disk + yield disk + finally: + op = disk_client.delete(project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name) + wait_for_operation(op, PROJECT) @pytest.fixture(scope="class") @@ -70,14 +70,14 @@ def snapshot(request, src_disk): snapshot_resource=snapshot, ) wait_for_operation(op, PROJECT) + try: + request.cls.snapshot = snapshot_client.get(project=PROJECT, snapshot=snapshot.name) + snapshot = request.cls.snapshot - request.cls.snapshot = snapshot_client.get(project=PROJECT, snapshot=snapshot.name) - snapshot = request.cls.snapshot - - yield snapshot - - op = snapshot_client.delete(project=PROJECT, snapshot=snapshot.name) - wait_for_operation(op, PROJECT) + yield snapshot + finally: + op = snapshot_client.delete(project=PROJECT, snapshot=snapshot.name) + wait_for_operation(op, PROJECT) @pytest.fixture(scope="class") @@ -89,13 +89,13 @@ def image(request, src_disk): op = image_client.insert(project=PROJECT, image_resource=image) wait_for_operation(op, PROJECT) - - image = image_client.get(project=PROJECT, image=image.name) - request.cls.image = image - yield image - - op = image_client.delete(project=PROJECT, image=image.name) - wait_for_operation(op, PROJECT) + try: + image = image_client.get(project=PROJECT, image=image.name) + request.cls.image = image + yield image + finally: + op = image_client.delete(project=PROJECT, image=image.name) + wait_for_operation(op, PROJECT) @pytest.fixture() @@ -106,29 +106,31 @@ def subnetwork(): network.auto_create_subnetworks = True op = network_client.insert(project=PROJECT, network_resource=network) wait_for_operation(op, PROJECT) - network = network_client.get(project=PROJECT, network=network.name) - - subnet = compute_v1.Subnetwork() - subnet.name = "test-subnet-" + uuid.uuid4().hex[:10] - subnet.network = network_client.get(project=PROJECT, network=network.name).self_link - subnet.region = "europe-central2" - subnet.ip_cidr_range = "10.0.0.0/20" - subnet_client = compute_v1.SubnetworksClient() - op = subnet_client.insert( - project=PROJECT, region="europe-central2", subnetwork_resource=subnet - ) - wait_for_operation(op, PROJECT) - subnet = subnet_client.get( - project=PROJECT, region="europe-central2", subnetwork=subnet.name - ) - - yield subnet - - op = subnet_client.delete(project=PROJECT, region='europe-central2', subnetwork=subnet.name) - wait_for_operation(op, PROJECT) + try: + network = network_client.get(project=PROJECT, network=network.name) + + subnet = compute_v1.Subnetwork() + subnet.name = "test-subnet-" + uuid.uuid4().hex[:10] + subnet.network = network_client.get(project=PROJECT, network=network.name).self_link + subnet.region = "europe-central2" + subnet.ip_cidr_range = "10.0.0.0/20" + subnet_client = compute_v1.SubnetworksClient() + op = subnet_client.insert( + project=PROJECT, region="europe-central2", subnetwork_resource=subnet + ) + wait_for_operation(op, PROJECT) + try: + subnet = subnet_client.get( + project=PROJECT, region="europe-central2", subnetwork=subnet.name + ) - op = network_client.delete(project=PROJECT, network=network.name) - wait_for_operation(op, PROJECT) + yield subnet + finally: + op = subnet_client.delete(project=PROJECT, region='europe-central2', subnetwork=subnet.name) + wait_for_operation(op, PROJECT) + finally: + op = network_client.delete(project=PROJECT, network=network.name) + wait_for_operation(op, PROJECT) @pytest.mark.usefixtures("image", "snapshot") From 1848aba8a10b45ca64d409f2456ddf1ec4b2cf53 Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Mon, 25 Oct 2021 13:52:00 +0200 Subject: [PATCH 2/5] chore(docs): Fighting with GCE Enforcer in tests. --- samples/snippets/test_sample_create_vm.py | 195 +++++++++++++--------- 1 file changed, 120 insertions(+), 75 deletions(-) diff --git a/samples/snippets/test_sample_create_vm.py b/samples/snippets/test_sample_create_vm.py index f3e265bb6..469916287 100644 --- a/samples/snippets/test_sample_create_vm.py +++ b/samples/snippets/test_sample_create_vm.py @@ -11,8 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import time import uuid +from collections import deque +from google.api_core.exceptions import NotFound import google.auth from google.cloud import compute_v1 import pytest @@ -29,7 +32,8 @@ ) PROJECT = google.auth.default()[1] -INSTANCE_ZONE = "europe-central2-b" +REGION = 'us-central1' +INSTANCE_ZONE = "us-central1-b" def get_active_debian(): @@ -71,7 +75,9 @@ def snapshot(request, src_disk): ) wait_for_operation(op, PROJECT) try: - request.cls.snapshot = snapshot_client.get(project=PROJECT, snapshot=snapshot.name) + request.cls.snapshot = snapshot_client.get( + project=PROJECT, snapshot=snapshot.name + ) snapshot = request.cls.snapshot yield snapshot @@ -112,96 +118,134 @@ def subnetwork(): subnet = compute_v1.Subnetwork() subnet.name = "test-subnet-" + uuid.uuid4().hex[:10] subnet.network = network_client.get(project=PROJECT, network=network.name).self_link - subnet.region = "europe-central2" + subnet.region = REGION subnet.ip_cidr_range = "10.0.0.0/20" subnet_client = compute_v1.SubnetworksClient() op = subnet_client.insert( - project=PROJECT, region="europe-central2", subnetwork_resource=subnet + project=PROJECT, region=REGION, subnetwork_resource=subnet ) wait_for_operation(op, PROJECT) try: subnet = subnet_client.get( - project=PROJECT, region="europe-central2", subnetwork=subnet.name + project=PROJECT, region=REGION, subnetwork=subnet.name ) yield subnet finally: - op = subnet_client.delete(project=PROJECT, region='europe-central2', subnetwork=subnet.name) + op = subnet_client.delete( + project=PROJECT, region=REGION, subnetwork=subnet.name + ) wait_for_operation(op, PROJECT) finally: - op = network_client.delete(project=PROJECT, network=network.name) - wait_for_operation(op, PROJECT) + firewall_client = compute_v1.FirewallsClient() + firewall_request = compute_v1.ListFirewallsRequest() + firewall_request.project = PROJECT + firewall_request.filter = f'network = "{network.self_link}"' + network_request = compute_v1.ListNetworksRequest() + network_request.project = PROJECT + network_request.filter = f'name = "{network.name}"' + networks = network_client.list(network_request) + start_time = time.time() + while networks: + # Repeat until the test network is gone. + ops = deque() + # Get all firewall rules associated with the test network. + firewalls = firewall_client.list(firewall_request) + # while firewalls: + # Repeat until all firewall rules are gone. + for firewall in firewalls: + # Start deleting all firewall rules for test network. + ops.append(firewall_client.delete(project=PROJECT, firewall=firewall.name)) + # for op in ops: + # Wait for the delete operations to finish. + # wait_for_operation(op, PROJECT) + # Update firewall rules list, to make sure they are all gone. + # firewalls = firewall_client.list(firewall_request) + # Attempt deleting the test network. Hopefully, the firewall + # rules were not re-added by the enforcer. + try: + op = network_client.delete(project=PROJECT, network=network.name) + wait_for_operation(op, PROJECT) + except NotFound: + pass + # Update list of networks to make sure the network is gone. + networks = network_client.list(network_request) + if time.time() - start_time >= 300: + # If we fail to remove the the network for 5 minutes + # We fail with a bang! + raise RuntimeError(f"Couldn't clean up network: {network.name}. " + f"This will need manual clean-up!!!") @pytest.mark.usefixtures("image", "snapshot") class TestCreation: - def test_create_from_custom_image(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_from_custom_image( - PROJECT, INSTANCE_ZONE, instance_name, self.image.self_link - ) - try: - assert ( - instance.disks[0].initialize_params.source_image == self.image.self_link - ) - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_from_public_image(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_from_public_image( - PROJECT, - INSTANCE_ZONE, - instance_name, - ) - try: - assert "debian-cloud" in instance.disks[0].initialize_params.source_image - assert "debian-10" in instance.disks[0].initialize_params.source_image - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_from_snapshot(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_from_snapshot( - PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link - ) - try: - assert ( - instance.disks[0].initialize_params.source_snapshot - == self.snapshot.self_link - ) - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_with_additional_disk(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) - try: - assert any( - disk.initialize_params.disk_size_gb == 11 for disk in instance.disks - ) - assert any( - disk.initialize_params.disk_size_gb == 10 for disk in instance.disks - ) - assert len(instance.disks) == 2 - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_with_snapshotted_data_disk(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_with_snapshotted_data_disk( - PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link - ) - try: - assert any( - disk.initialize_params.disk_size_gb == 11 for disk in instance.disks - ) - assert any( - disk.initialize_params.disk_size_gb == 10 for disk in instance.disks - ) - assert len(instance.disks) == 2 - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + # def test_create_from_custom_image(self): + # instance_name = "i" + uuid.uuid4().hex[:10] + # instance = create_from_custom_image( + # PROJECT, INSTANCE_ZONE, instance_name, self.image.self_link + # ) + # try: + # assert ( + # instance.disks[0].initialize_params.source_image == self.image.self_link + # ) + # finally: + # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + # + # def test_create_from_public_image(self): + # instance_name = "i" + uuid.uuid4().hex[:10] + # instance = create_from_public_image( + # PROJECT, + # INSTANCE_ZONE, + # instance_name, + # ) + # try: + # assert "debian-cloud" in instance.disks[0].initialize_params.source_image + # assert "debian-10" in instance.disks[0].initialize_params.source_image + # finally: + # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + # + # def test_create_from_snapshot(self): + # instance_name = "i" + uuid.uuid4().hex[:10] + # instance = create_from_snapshot( + # PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link + # ) + # try: + # assert ( + # instance.disks[0].initialize_params.source_snapshot + # == self.snapshot.self_link + # ) + # finally: + # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + # + # def test_create_with_additional_disk(self): + # instance_name = "i" + uuid.uuid4().hex[:10] + # instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) + # try: + # assert any( + # disk.initialize_params.disk_size_gb == 11 for disk in instance.disks + # ) + # assert any( + # disk.initialize_params.disk_size_gb == 10 for disk in instance.disks + # ) + # assert len(instance.disks) == 2 + # finally: + # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + # + # def test_create_with_snapshotted_data_disk(self): + # instance_name = "i" + uuid.uuid4().hex[:10] + # instance = create_with_snapshotted_data_disk( + # PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link + # ) + # try: + # assert any( + # disk.initialize_params.disk_size_gb == 11 for disk in instance.disks + # ) + # assert any( + # disk.initialize_params.disk_size_gb == 10 for disk in instance.disks + # ) + # assert len(instance.disks) == 2 + # finally: + # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) def test_create_with_subnet(self, subnetwork): instance_name = "i" + uuid.uuid4().hex[:10] @@ -212,6 +256,7 @@ def test_create_with_subnet(self, subnetwork): subnetwork.network, subnetwork.self_link, ) + time.sleep(120) try: assert instance.network_interfaces[0].name == subnetwork.network assert instance.network_interfaces[0].subnetwork == subnetwork.self_link From 0d7feed95720a834a28cc902b9ab3ddd9510d410 Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Mon, 25 Oct 2021 14:13:24 +0200 Subject: [PATCH 3/5] chore(docs): Using default network for the subnetwork test. --- samples/snippets/test_sample_create_vm.py | 211 +++++++--------------- 1 file changed, 67 insertions(+), 144 deletions(-) diff --git a/samples/snippets/test_sample_create_vm.py b/samples/snippets/test_sample_create_vm.py index 469916287..d610d4776 100644 --- a/samples/snippets/test_sample_create_vm.py +++ b/samples/snippets/test_sample_create_vm.py @@ -11,17 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import time import uuid -from collections import deque -from google.api_core.exceptions import NotFound import google.auth from google.cloud import compute_v1 import pytest - from quickstart import delete_instance, wait_for_operation + from sample_create_vm import ( create_from_custom_image, create_from_public_image, @@ -104,161 +101,87 @@ def image(request, src_disk): wait_for_operation(op, PROJECT) -@pytest.fixture() -def subnetwork(): - network_client = compute_v1.NetworksClient() - network = compute_v1.Network() - network.name = "test-network-" + uuid.uuid4().hex[:10] - network.auto_create_subnetworks = True - op = network_client.insert(project=PROJECT, network_resource=network) - wait_for_operation(op, PROJECT) - try: - network = network_client.get(project=PROJECT, network=network.name) - - subnet = compute_v1.Subnetwork() - subnet.name = "test-subnet-" + uuid.uuid4().hex[:10] - subnet.network = network_client.get(project=PROJECT, network=network.name).self_link - subnet.region = REGION - subnet.ip_cidr_range = "10.0.0.0/20" - subnet_client = compute_v1.SubnetworksClient() - op = subnet_client.insert( - project=PROJECT, region=REGION, subnetwork_resource=subnet +@pytest.mark.usefixtures("image", "snapshot") +class TestCreation: + def test_create_from_custom_image(self): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_from_custom_image( + PROJECT, INSTANCE_ZONE, instance_name, self.image.self_link ) - wait_for_operation(op, PROJECT) try: - subnet = subnet_client.get( - project=PROJECT, region=REGION, subnetwork=subnet.name + assert ( + instance.disks[0].initialize_params.source_image == self.image.self_link ) + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - yield subnet + def test_create_from_public_image(self): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_from_public_image( + PROJECT, + INSTANCE_ZONE, + instance_name, + ) + try: + assert "debian-cloud" in instance.disks[0].initialize_params.source_image + assert "debian-10" in instance.disks[0].initialize_params.source_image finally: - op = subnet_client.delete( - project=PROJECT, region=REGION, subnetwork=subnet.name + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + def test_create_from_snapshot(self): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_from_snapshot( + PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link + ) + try: + assert ( + instance.disks[0].initialize_params.source_snapshot + == self.snapshot.self_link ) - wait_for_operation(op, PROJECT) - finally: - firewall_client = compute_v1.FirewallsClient() - firewall_request = compute_v1.ListFirewallsRequest() - firewall_request.project = PROJECT - firewall_request.filter = f'network = "{network.self_link}"' - network_request = compute_v1.ListNetworksRequest() - network_request.project = PROJECT - network_request.filter = f'name = "{network.name}"' - networks = network_client.list(network_request) - start_time = time.time() - while networks: - # Repeat until the test network is gone. - ops = deque() - # Get all firewall rules associated with the test network. - firewalls = firewall_client.list(firewall_request) - # while firewalls: - # Repeat until all firewall rules are gone. - for firewall in firewalls: - # Start deleting all firewall rules for test network. - ops.append(firewall_client.delete(project=PROJECT, firewall=firewall.name)) - # for op in ops: - # Wait for the delete operations to finish. - # wait_for_operation(op, PROJECT) - # Update firewall rules list, to make sure they are all gone. - # firewalls = firewall_client.list(firewall_request) - # Attempt deleting the test network. Hopefully, the firewall - # rules were not re-added by the enforcer. - try: - op = network_client.delete(project=PROJECT, network=network.name) - wait_for_operation(op, PROJECT) - except NotFound: - pass - # Update list of networks to make sure the network is gone. - networks = network_client.list(network_request) - if time.time() - start_time >= 300: - # If we fail to remove the the network for 5 minutes - # We fail with a bang! - raise RuntimeError(f"Couldn't clean up network: {network.name}. " - f"This will need manual clean-up!!!") + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + def test_create_with_additional_disk(self): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) + try: + assert any( + disk.initialize_params.disk_size_gb == 11 for disk in instance.disks + ) + assert any( + disk.initialize_params.disk_size_gb == 10 for disk in instance.disks + ) + assert len(instance.disks) == 2 + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) -@pytest.mark.usefixtures("image", "snapshot") -class TestCreation: - # def test_create_from_custom_image(self): - # instance_name = "i" + uuid.uuid4().hex[:10] - # instance = create_from_custom_image( - # PROJECT, INSTANCE_ZONE, instance_name, self.image.self_link - # ) - # try: - # assert ( - # instance.disks[0].initialize_params.source_image == self.image.self_link - # ) - # finally: - # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - # - # def test_create_from_public_image(self): - # instance_name = "i" + uuid.uuid4().hex[:10] - # instance = create_from_public_image( - # PROJECT, - # INSTANCE_ZONE, - # instance_name, - # ) - # try: - # assert "debian-cloud" in instance.disks[0].initialize_params.source_image - # assert "debian-10" in instance.disks[0].initialize_params.source_image - # finally: - # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - # - # def test_create_from_snapshot(self): - # instance_name = "i" + uuid.uuid4().hex[:10] - # instance = create_from_snapshot( - # PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link - # ) - # try: - # assert ( - # instance.disks[0].initialize_params.source_snapshot - # == self.snapshot.self_link - # ) - # finally: - # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - # - # def test_create_with_additional_disk(self): - # instance_name = "i" + uuid.uuid4().hex[:10] - # instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) - # try: - # assert any( - # disk.initialize_params.disk_size_gb == 11 for disk in instance.disks - # ) - # assert any( - # disk.initialize_params.disk_size_gb == 10 for disk in instance.disks - # ) - # assert len(instance.disks) == 2 - # finally: - # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - # - # def test_create_with_snapshotted_data_disk(self): - # instance_name = "i" + uuid.uuid4().hex[:10] - # instance = create_with_snapshotted_data_disk( - # PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link - # ) - # try: - # assert any( - # disk.initialize_params.disk_size_gb == 11 for disk in instance.disks - # ) - # assert any( - # disk.initialize_params.disk_size_gb == 10 for disk in instance.disks - # ) - # assert len(instance.disks) == 2 - # finally: - # delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + def test_create_with_snapshotted_data_disk(self): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_with_snapshotted_data_disk( + PROJECT, INSTANCE_ZONE, instance_name, self.snapshot.self_link + ) + try: + assert any( + disk.initialize_params.disk_size_gb == 11 for disk in instance.disks + ) + assert any( + disk.initialize_params.disk_size_gb == 10 for disk in instance.disks + ) + assert len(instance.disks) == 2 + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - def test_create_with_subnet(self, subnetwork): + def test_create_with_subnet(self): instance_name = "i" + uuid.uuid4().hex[:10] instance = create_with_subnet( PROJECT, INSTANCE_ZONE, instance_name, - subnetwork.network, - subnetwork.self_link, + "global/networks/default", + f"regions/{REGION}/subnetworks/default", ) - time.sleep(120) try: - assert instance.network_interfaces[0].name == subnetwork.network - assert instance.network_interfaces[0].subnetwork == subnetwork.self_link + assert instance.network_interfaces[0].name == "global/networks/default" + assert instance.network_interfaces[0].subnetwork == f"regions/{REGION}/subnetworks/default" finally: delete_instance(PROJECT, INSTANCE_ZONE, instance_name) From 0add87703276fe7446934a96d847048610ade07f Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Mon, 25 Oct 2021 14:18:40 +0200 Subject: [PATCH 4/5] chore(docs): Unlocking the Python versions for tests. --- samples/snippets/noxfile_config.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/samples/snippets/noxfile_config.py b/samples/snippets/noxfile_config.py index e26fd4aef..16c4c694e 100644 --- a/samples/snippets/noxfile_config.py +++ b/samples/snippets/noxfile_config.py @@ -15,7 +15,4 @@ TEST_CONFIG_OVERRIDE = { # Tests in test_sample_default_values.py require separate projects to not interfere with each other. 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', - # Temporarily blocking all versions except 3.8, as I have - # viewer access only to 3.8 test project. - 'ignored_versions': ["3.6", "3.7", "3.9", "3.10"] } From 4b7e2df1202d80bf987aced55d28d8775c5f64e9 Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Fri, 29 Oct 2021 17:32:47 +0200 Subject: [PATCH 5/5] chore(docs): Updating some docstrings. --- samples/snippets/sample_create_vm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/sample_create_vm.py b/samples/snippets/sample_create_vm.py index 24331f9d7..21021e010 100644 --- a/samples/snippets/sample_create_vm.py +++ b/samples/snippets/sample_create_vm.py @@ -324,7 +324,7 @@ def create_from_snapshot( project_id: str, zone: str, instance_name: str, snapshot_link: str ): """ - Create a new VM instance with Debian 10 operating system. + Create a new VM instance with boot disk created from a snapshot. Args: project_id: project ID or project number of the Cloud project you want to use. @@ -350,7 +350,7 @@ def create_with_snapshotted_data_disk( project_id: str, zone: str, instance_name: str, snapshot_link: str ): """ - Create a new VM instance with Debian 10 operating system. + Create a new VM instance with Debian 10 operating system and data disk created from snapshot. Args: project_id: project ID or project number of the Cloud project you want to use.