From 77b8586a478ea0d12c65ab6908e056a7ad0256fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Fri, 14 Aug 2026 22:19:27 +0400 Subject: [PATCH] =?UTF-8?q?tests:=20=D0=B0=D0=B2=D1=82=D0=BE=D1=87=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=BA=D0=B0=20=D0=BE=D1=87=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=B4=D0=BE=20=D0=B8=20=D0=BF=D0=BE=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=B0=20(=D0=BC?= =?UTF-8?q?=D1=83=D1=81=D0=BE=D1=80=20=D0=BD=D0=B5=20=D0=BA=D0=BE=D0=BF?= =?UTF-8?q?=D0=B8=D1=82=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/load_test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/load_test.py b/tests/load_test.py index 66f16a3..4027b15 100644 --- a/tests/load_test.py +++ b/tests/load_test.py @@ -324,6 +324,26 @@ def worker(wid): time.sleep(random.uniform(0.01, 0.05)) +def cleanup_all_queues(sqs): + """Удаляет ВСЕ очереди тенанта. + Вызывается ПЕРЕД прогоном (стартовый мусор прошлых прогонов) и ПОСЛЕ + (остатки от циклов, упавших на сбое — без этого копятся очереди и + тест упирается в лимит MaxQueues тенанта).""" + try: + urls = sqs.list_queues().get("QueueUrls", []) + except Exception: + urls = [] + deleted = 0 + for u in urls: + try: + sqs.delete_queue(QueueUrl=u) + deleted += 1 + except Exception: + pass + if deleted: + print(f"cleanup: удалено очередей {deleted}", flush=True) + + def progress_printer(): while not stop.is_set(): stop.wait(30) @@ -341,6 +361,9 @@ def main(): print("Нужны AWS_ACCESS_KEY_ID и AWS_SECRET_ACCESS_KEY") return 1 + # Чистим стартовый мусор прошлых прогонов. + cleanup_all_queues(make_client()) + threads = [threading.Thread(target=worker, args=(i,), daemon=True) for i in range(WORKERS)] hthread = threading.Thread(target=health_monitor, daemon=True) pthread = threading.Thread(target=progress_printer, daemon=True) @@ -354,6 +377,9 @@ def main(): for t in threads: t.join(timeout=30) + # Чистим остатки: очереди от циклов, упавших на сбоях. + cleanup_all_queues(make_client()) + el = int(time.time() - start_ts) with stats_lock: s = dict(stats)