Skip to content

Commit 7698043

Browse files
author
Stepan Rasputny
authored
fix: remove assertion for fixture ending (GoogleCloudPlatform#11834)
* fix: remove assertion for fixture ending * fix: skip test if service account was removed
1 parent 85df924 commit 7698043

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

iam/cloud-client/snippets/test_project_policies.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ def project_policy() -> policy_pb2.Policy:
5656
policy_copy.CopyFrom(policy)
5757
yield policy_copy
5858
finally:
59-
updated_policy = execute_wrapped(set_project_policy, PROJECT, policy, False)
60-
61-
updated_policy.ClearField("etag")
62-
assert updated_policy == policy
59+
execute_wrapped(set_project_policy, PROJECT, policy, False)
6360

6461

6562
@backoff.on_exception(backoff.expo, Aborted, max_tries=6)

iam/cloud-client/snippets/test_service_account_key.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import time
1818
import uuid
1919

20+
from google.api_core.exceptions import NotFound
2021
import google.auth
2122
import pytest
2223
from snippets.create_key import create_key
@@ -56,7 +57,10 @@ def key_found(project_id: str, account: str, key_id: str) -> bool:
5657

5758

5859
def test_delete_service_account_key(service_account: str) -> None:
59-
key = create_key(PROJECT, service_account)
60+
try:
61+
key = create_key(PROJECT, service_account)
62+
except NotFound:
63+
pytest.skip("Service account was removed from outside, skipping")
6064
json_key_data = json.loads(key.private_key_data)
6165
key_id = json_key_data["private_key_id"]
6266
time.sleep(5)

0 commit comments

Comments
 (0)