Fix crawl stopping tests (#875)

* Update currCrawlStopping references in backend tests

* Make sure previous crawl is fully stopped before next test
This commit is contained in:
Tessa Walsh 2023-05-23 15:39:53 -04:00 committed by GitHub
parent 5c944d4626
commit e94e179bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,7 @@ def test_start_crawl_and_stop_immediately(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/{crawler_config_id_only}",
headers=crawler_auth_headers,
)
assert r.json()["currCrawlStopping"] == True
assert r.json()["lastCrawlStopping"] == True
while data["state"] in ("starting", "running", "waiting"):
data = get_crawl(default_org_id, crawler_auth_headers, crawl_id)
@ -97,6 +97,15 @@ def test_start_crawl_and_stop_immediately(
def test_start_crawl_to_stop_partial(
default_org_id, crawler_config_id_only, crawler_auth_headers
):
while True:
time.sleep(2)
r = requests.get(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/{crawler_config_id_only}",
headers=crawler_auth_headers,
)
if r.json().get("isCrawlRunning") is False:
break
r = requests.post(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/{crawler_config_id_only}/run",
headers=crawler_auth_headers,
@ -136,7 +145,7 @@ def test_stop_crawl_partial(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/{crawler_config_id_only}",
headers=crawler_auth_headers,
)
assert r.json()["currCrawlStopping"] == True
assert r.json()["lastCrawlStopping"] == True
while data["state"] == "running":
data = get_crawl(default_org_id, crawler_auth_headers, crawl_id)