Skip to content

Commit 644fe50

Browse files
committed
Updated arguments and test
1 parent c4de2b1 commit 644fe50

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

compute/client_library/ingredients/disks/сonsistency_groups/clone_disks_consistency_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222

2323
# <INGREDIENT consistency_group_clone_disks>
24-
def clone_disks_to_consistency_group(project_id, group_name, group_region):
24+
def clone_disks_to_consistency_group(project_id, group_region, group_name):
2525
"""
2626
Clones disks to a consistency group in the specified region.
2727
Args:
2828
project_id (str): The ID of the Google Cloud project.
29-
group_name (str): The name of the consistency group.
3029
group_region (str): The region where the consistency group is located.
30+
group_name (str): The name of the consistency group.
3131
Returns:
3232
bool: True if the disks were successfully cloned to the consistency group.
3333
"""

compute/client_library/snippets/disks/сonsistency_groups/clone_disks_consistency_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ def wait_for_extended_operation(
7777
return result
7878

7979

80-
def clone_disks_to_consistency_group(project_id, group_name, group_region):
80+
def clone_disks_to_consistency_group(project_id, group_region, group_name):
8181
"""
8282
Clones disks to a consistency group in the specified region.
8383
Args:
8484
project_id (str): The ID of the Google Cloud project.
85-
group_name (str): The name of the consistency group.
8685
group_region (str): The region where the consistency group is located.
86+
group_name (str): The name of the consistency group.
8787
Returns:
8888
bool: True if the disks were successfully cloned to the consistency group.
8989
"""

compute/client_library/snippets/tests/test_disks.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
)
4747
from ..disks.сonsistency_groups.create_consistency_group import create_consistency_group
4848
from ..disks.сonsistency_groups.delete_consistency_group import delete_consistency_group
49-
from ..disks.сonsistency_groups.remove_disk_consistency_group import remove_disk_consistency_group
49+
from ..disks.сonsistency_groups.remove_disk_consistency_group import (
50+
remove_disk_consistency_group,
51+
)
5052
from ..images.get import get_image_from_family
5153
from ..instances.create import create_instance, disk_from_image
5254
from ..instances.delete import delete_instance
@@ -514,14 +516,16 @@ def test_clone_disks_in_consistency_group(
514516
autodelete_regional_disk_name,
515517
autodelete_regional_blank_disk,
516518
):
517-
first = "first-group" + uuid.uuid4().hex[:5]
518-
create_consistency_group(PROJECT, REGION, first, "description")
519+
group_name1 = "first-group" + uuid.uuid4().hex[:5]
520+
group_name2 = "second-group" + uuid.uuid4().hex[:5]
521+
create_consistency_group(PROJECT, REGION, group_name1, "description")
522+
create_consistency_group(PROJECT, REGION_SECONDARY, group_name2, "description")
519523

520524
add_disk_consistency_group(
521525
project_id=PROJECT,
522526
disk_name=autodelete_regional_blank_disk.name,
523527
disk_location=REGION,
524-
consistency_group_name=first,
528+
consistency_group_name=group_name1,
525529
consistency_group_region=REGION,
526530
)
527531

@@ -535,14 +539,11 @@ def test_clone_disks_in_consistency_group(
535539
DISK_SIZE,
536540
)
537541

538-
second = "second-group" + uuid.uuid4().hex[:5]
539-
create_consistency_group(PROJECT, REGION_SECONDARY, second, "description")
540-
541542
add_disk_consistency_group(
542543
project_id=PROJECT,
543544
disk_name=second_disk.name,
544545
disk_location=REGION_SECONDARY,
545-
consistency_group_name=second,
546+
consistency_group_name=group_name2,
546547
consistency_group_region=REGION_SECONDARY,
547548
)
548549

@@ -555,7 +556,7 @@ def test_clone_disks_in_consistency_group(
555556
)
556557
time.sleep(60)
557558
try:
558-
assert clone_disks_to_consistency_group(PROJECT, second, REGION_SECONDARY)
559+
assert clone_disks_to_consistency_group(PROJECT, REGION_SECONDARY, group_name2)
559560
finally:
560561
stop_disk_replication(
561562
project_id=PROJECT,
@@ -571,6 +572,8 @@ def test_clone_disks_in_consistency_group(
571572
for disk in disks:
572573
delete_regional_disk(PROJECT, REGION_SECONDARY, disk.name)
573574
time.sleep(25)
574-
remove_disk_consistency_group(PROJECT, autodelete_regional_blank_disk.name, REGION, first, REGION)
575-
delete_consistency_group(PROJECT, REGION, first)
576-
delete_consistency_group(PROJECT, REGION_SECONDARY, second)
575+
remove_disk_consistency_group(
576+
PROJECT, autodelete_regional_blank_disk.name, REGION, group_name1, REGION
577+
)
578+
delete_consistency_group(PROJECT, REGION, group_name1)
579+
delete_consistency_group(PROJECT, REGION_SECONDARY, group_name2)

0 commit comments

Comments
 (0)