From 321a784c627a8f6c43aa5882e7437fcc995791b7 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Mon, 16 Oct 2023 19:30:11 +0300 Subject: [PATCH] fixing tests --- .circleci/config.yml | 2 +- tests/test_cluster.py | 12 +++++++++++- tests/test_database.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3fabd1a8..08db9db1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: name: "Run pytest" command: | mkdir test-results - args=("--host" "localhost" "--complete" "--junitxml=test-results/junit.xml") + args=("--host" "localhost" "--junitxml=test-results/junit.xml") if [ << parameters.cluster >> = true ]; then args+=("--cluster" "--port=8529" "--port=8539" "--port=8549") else diff --git a/tests/test_cluster.py b/tests/test_cluster.py index 5702f877..2d423b37 100644 --- a/tests/test_cluster.py +++ b/tests/test_cluster.py @@ -1,3 +1,5 @@ +import time + import pytest from packaging import version @@ -174,7 +176,15 @@ def test_cluster_rebalance(sys_db, bad_db, cluster, db_version): assert err.value.error_code == FORBIDDEN # Test rebalance execution - assert sys_db.cluster.execute_rebalance_plan(rebalance["moves"]) is True + tries = 0 + while sys_db.cluster.execute_rebalance_plan(rebalance["moves"]) is False: + if tries < 10: + tries += 1 + time.sleep(0.5) + else: + tries = -1 + break + assert tries != -1 with assert_raises(ClusterRebalanceError) as err: bad_db.cluster.execute_rebalance_plan(rebalance["moves"]) assert err.value.error_code == FORBIDDEN diff --git a/tests/test_database.py b/tests/test_database.py index 046754ad..4fa0c0ed 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -209,7 +209,7 @@ def test_database_misc_methods(sys_db, db, bad_db, cluster): assert err.value.error_code in {11, 1228} # Test set log levels - new_levels = {"agency": "DEBUG", "collector": "INFO", "threads": "WARNING"} + new_levels = {"agency": "DEBUG", "engines": "INFO", "threads": "WARNING"} result = sys_db.set_log_levels(**new_levels) for key, value in new_levels.items(): assert result[key] == value