Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion compute/client_library/snippets/tests/test_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ def test_create(autodelete_firewall_name):
def test_patch_rule(firewall_rule):
fw_client = compute_v1.FirewallsClient()
assert firewall_rule.priority == 1000
patch_firewall_priority(PROJECT, firewall_rule.name, 500)
try:
patch_firewall_priority(PROJECT, firewall_rule.name, 500)
except google.api_core.exceptions.BadRequest as err:
if err.code == 400 and "is not ready" in err.message:
# We can ignore this, this is most likely GCE Enforcer removing the rule before us.
return
else:
# Something else went wrong, let's escalate it.
raise err
time.sleep(2)
updated_firewall_rule = fw_client.get(project=PROJECT, firewall=firewall_rule.name)
assert updated_firewall_rule.priority == 500