Skip to content

Commit

Permalink
Modify nightly crawlconfig stats test to retry until successful
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Mar 4, 2025
1 parent a2c0a54 commit 62eeef4
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions backend/test_nightly/test_crawlconfig_crawl_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,25 @@ def test_crawlconfig_crawl_stats(admin_auth_headers, default_org_id, crawl_confi
data = r.json()
assert data["deleted"]

time.sleep(10)

# Verify crawl stats from /crawlconfigs
r = requests.get(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/{crawl_config_id}",
headers=admin_auth_headers,
)
assert r.status_code == 200
data = r.json()
assert data["crawlAttemptCount"] == 2
assert data["crawlCount"] == 0
assert not data["lastCrawlId"]
assert not data["lastCrawlState"]
assert not data["lastCrawlTime"]
max_attempts = 18
attempts = 1
while True:
r = requests.get(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/{crawl_config_id}",
headers=admin_auth_headers,
)
assert r.status_code == 200
data = r.json()

if data["crawlAttemptCount"] == 2 and data["crawlCount"] == 0:
assert not data["lastCrawlId"]
assert not data["lastCrawlState"]
assert not data["lastCrawlTime"]
break

if attempts >= max_attempts:
assert False

time.sleep(10)
attempts += 1

0 comments on commit 62eeef4

Please sign in to comment.