diff --git a/st2common/tests/unit/test_db.py b/st2common/tests/unit/test_db.py index 7fe10ef3f4..0ae1ee79f1 100644 --- a/st2common/tests/unit/test_db.py +++ b/st2common/tests/unit/test_db.py @@ -126,6 +126,7 @@ def test_check_connect(self): def test_network_level_compression(self): disconnect() + # db is not modified in this test, so this is safe to run in parallel. db_name = "st2" db_host = "localhost" db_port = 27017 @@ -521,6 +522,7 @@ def test_db_connect_server_selection_timeout_ssl_on_non_ssl_listener(self): # and propagating the error disconnect() + # db is not modified in this test, so this is safe to run in parallel. db_name = "st2" db_host = "localhost" db_port = 27017 diff --git a/st2tests/st2tests/config.py b/st2tests/st2tests/config.py index feef6f589f..9848ffb626 100644 --- a/st2tests/st2tests/config.py +++ b/st2tests/st2tests/config.py @@ -85,7 +85,9 @@ def _register_config_opts(): def _override_db_opts(): - CONF.set_override(name="db_name", override="st2-test", group="database") + # use separate dbs for safer parallel test runs + db_name = f"st2-test{os.environ.get('ST2TESTS_PARALLEL_SLOT', '')}" + CONF.set_override(name="db_name", override=db_name, group="database") CONF.set_override(name="host", override="127.0.0.1", group="database")