Skip to content

Commit b195ea9

Browse files
authored
fix(test): fix stop deleting registries in integration tests (#82)
1 parent 9a489d5 commit b195ea9

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

tests/integrations/project_fixture.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
from scaleway import Client
88
from scaleway.account.v2 import AccountV2API
99
from scaleway.function.v1beta1 import FunctionV1Beta1API
10-
from scaleway.registry.v1 import RegistryV1API
1110
from scaleway_core.api import ScalewayException
12-
from scaleway_core.utils import WaitForOptions
1311

1412
from .utils import create_client
1513

@@ -42,30 +40,17 @@ def _create_scaleway_project(client: Client) -> ProjectID:
4240

4341
def _cleanup_project(client: Client, project_id: ProjectID):
4442
"""Delete all Scaleway resources created in the temporary project."""
45-
function_api = FunctionV1Beta1API(client)
43+
api = FunctionV1Beta1API(client)
4644

47-
namespaces = function_api.list_namespaces_all(project_id=project_id)
45+
namespaces = api.list_namespaces_all(project_id=project_id)
4846
for namespace in namespaces:
49-
function_api.delete_namespace(namespace_id=namespace.id)
50-
51-
registry_api = RegistryV1API(client)
52-
registries = registry_api.list_namespaces_all(project_id=project_id)
53-
for registry in registries:
54-
registry_api.delete_namespace(namespace_id=registry.id)
47+
api.delete_namespace(namespace_id=namespace.id)
5548

5649
# All deletions have been scheduled,
5750
# we can wait for their completion sequentially
5851
for namespace in namespaces:
5952
try:
60-
function_api.wait_for_namespace(namespace_id=namespace.id)
61-
except ScalewayException as e:
62-
if e.status_code != 404:
63-
raise e
64-
for registry in registries:
65-
try:
66-
registry_api.wait_for_namespace(
67-
namespace_id=registry.id, options=WaitForOptions(timeout=600)
68-
)
53+
api.wait_for_namespace(namespace_id=namespace.id)
6954
except ScalewayException as e:
7055
if e.status_code != 404:
7156
raise e

0 commit comments

Comments
 (0)