Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

Commit 777a4af

Browse files
stishkinstas
andauthored
Do not fail BVT when getting 504 (gateway timeout error) when setting webhooks (#86)
Co-authored-by: stas <statis@microsoft.com>
1 parent b8b4843 commit 777a4af

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Scripts/Tests/bvt-petstore3.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
sys.path.append(cli_path)
1414
import raft
1515
from raft_sdk.raft_service import RaftCLI
16-
from raft_sdk.raft_common import RaftDefinitions
16+
from raft_sdk.raft_common import RaftDefinitions, RaftApiException
1717
from raft_sdk.raft_deploy import azure_function_keys
1818

1919
def webhooks_test_url(subscription_id, resource_group, function):
@@ -40,8 +40,23 @@ def bvt(cli, definitions, subs):
4040
test_url = webhooks_test_url(definitions.subscription, definitions.resource_group, definitions.test_infra)
4141
for event in webhook_events:
4242
print(f'Setting webhook for {event}')
43-
compile_webhook = cli.set_webhooks_subscription('petstore3-compile', event, test_url)
44-
fuzz_webhook = cli.set_webhooks_subscription('petstore3-fuzz', event, test_url)
43+
try:
44+
compile_webhook = cli.set_webhooks_subscription('petstore3-compile', event, test_url)
45+
print(f'Set webhooks {compile_webhook}')
46+
except RaftApiException as ex:
47+
if ex.status_code == 504:
48+
print(f'Proceeding even though got gateway timeout error when setting webhook {ex}')
49+
else:
50+
raise ex
51+
52+
try:
53+
fuzz_webhook = cli.set_webhooks_subscription('petstore3-fuzz', event, test_url)
54+
print(f'Set webhooks {fuzz_webhook}')
55+
except RaftApiException as ex:
56+
if ex.status_code == 504:
57+
print(f'Proceeding even though got gateway timeout error when setting webhook {ex}')
58+
else:
59+
raise ex
4560

4661
added_compile = cli.list_webhooks('petstore3-compile', event)
4762
if len(added_compile) == 0:

0 commit comments

Comments
 (0)