Skip to content

Commit 481bd8b

Browse files
committed
ensure test_recalculate_org_storage actually stops
1 parent cc38b8d commit 481bd8b

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

backend/test/test_stop_cancel_crawl.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ def test_stop_crawl_partial(
181181
def test_crawl_with_hostname(default_org_id, crawler_auth_headers):
182182
r = requests.get(
183183
f"{API_PREFIX}/orgs/{default_org_id}/crawls/{crawl_id}/replay.json",
184-
headers={"X-Forwarded-Proto": "https", "host": "custom-domain.example.com", **crawler_auth_headers},
184+
headers={
185+
"X-Forwarded-Proto": "https",
186+
"host": "custom-domain.example.com",
187+
**crawler_auth_headers,
188+
},
185189
)
186190
assert r.status_code == 200
187191
assert r.json()["pagesQueryUrl"].startswith("https://custom-domain.example.com/")

backend/test/test_z_delete_org.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33

44
from .conftest import API_PREFIX
5+
from mypy.dmypy.client import p
56

67

78
def test_recalculate_org_storage(admin_auth_headers, default_org_id):
@@ -10,6 +11,7 @@ def test_recalculate_org_storage(admin_auth_headers, default_org_id):
1011
r = requests.post(
1112
f"{API_PREFIX}/orgs/{default_org_id}/recalculate-storage",
1213
headers=admin_auth_headers,
14+
timeout=120,
1315
)
1416
assert r.status_code == 200
1517
data = r.json()
@@ -24,7 +26,9 @@ def test_recalculate_org_storage(admin_auth_headers, default_org_id):
2426
while True:
2527
try:
2628
r = requests.get(
27-
f"{API_PREFIX}/orgs/all/jobs/{job_id}", headers=admin_auth_headers
29+
f"{API_PREFIX}/orgs/all/jobs/{job_id}",
30+
headers=admin_auth_headers,
31+
timeout=120,
2832
)
2933
assert r.status_code == 200
3034
success = r.json()["success"]
@@ -35,13 +39,16 @@ def test_recalculate_org_storage(admin_auth_headers, default_org_id):
3539
if success is False:
3640
assert False
3741

38-
if attempts >= max_attempts:
39-
assert False
42+
4043

4144
time.sleep(10)
4245
except:
4346
time.sleep(10)
4447

48+
if attempts >= max_attempts:
49+
print(f"Giving up waiting for job after {max_attempts} attempts")
50+
assert False
51+
4552
attempts += 1
4653
print(f"Job not yet succeeded, retrying... ({attempts}/{max_attempts})")
4754

0 commit comments

Comments
 (0)