Skip to content

Commit

Permalink
wait for rg creation in e2e tests (#3117)
Browse files Browse the repository at this point in the history
* wait for rg creation

* update param

* check for rg existance

* input rg name
  • Loading branch information
nagworld9 authored May 7, 2024
1 parent 6e5cde0 commit eb503d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests_e2e/orchestrator/lib/agent_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

import makepkg
from azurelinuxagent.common.version import AGENT_VERSION
from tests_e2e.tests.lib.retry import retry_if_false

from tests_e2e.tests.lib.virtual_machine_client import VirtualMachineClient
from tests_e2e.tests.lib.virtual_machine_scale_set_client import VirtualMachineScaleSetClient
Expand Down Expand Up @@ -913,6 +914,10 @@ def _create_test_scale_set(self) -> None:
self._lisa_log.info("Creating resource group %s", self._resource_group_name)
resource_group = ResourceGroupClient(cloud=self._cloud, location=self._location, subscription=self._subscription_id, name=self._resource_group_name)
resource_group.create()
exist = retry_if_false(resource_group.is_exists)
if not exist:
self._lisa_log.error("Failed to create resource group %s", self._resource_group_name)
raise Exception("Failed to create resource group: {0}".format(self._resource_group_name))
self._delete_scale_set = True

self._lisa_log.info("Creating scale set %s", self._vmss_name)
Expand Down
6 changes: 6 additions & 0 deletions tests_e2e/tests/lib/resource_group_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@ def delete(self) -> None:
log.info("Deleting resource group %s (no wait)", self)
self._resource_client.resource_groups.begin_delete(self.name) # Do not wait for the deletion to complete

def is_exists(self) -> bool:
"""
Checks if the resource group exists
"""
return self._resource_client.resource_groups.check_existence(self.name)

def __str__(self):
return f"{self.name}"

0 comments on commit eb503d4

Please sign in to comment.