diff --git a/tests/backends/test_cli_mini_exp.py b/tests/backends/test_cli_mini_exp.py index f7563fc96..2fde2ff5f 100644 --- a/tests/backends/test_cli_mini_exp.py +++ b/tests/backends/test_cli_mini_exp.py @@ -48,6 +48,7 @@ def test_cli_mini_exp_doesnt_error_out_with_dev_build( + prepare_db, local_db, test_dir, monkeypatch, @@ -57,9 +58,11 @@ def test_cli_mini_exp_doesnt_error_out_with_dev_build( to ensure that it does not accidentally report false positive/negatives """ + db = prepare_db(local_db).orchestrator + @contextmanager def _mock_make_managed_local_orc(*a, **kw): - (client_addr,) = local_db.get_address() + (client_addr,) = db.get_address() yield smartredis.Client(False, address=client_addr) monkeypatch.setattr( @@ -68,7 +71,7 @@ def _mock_make_managed_local_orc(*a, **kw): _mock_make_managed_local_orc, ) backends = installed_redisai_backends() - (db_port,) = local_db.ports + (db_port,) = db.ports smartsim._core._cli.validate.test_install( # Shouldn't matter bc we are stubbing creation of orc diff --git a/tests/on_wlm/test_symlinking.py b/tests/on_wlm/test_symlinking.py index 246457d1c..c5b5b90ba 100644 --- a/tests/on_wlm/test_symlinking.py +++ b/tests/on_wlm/test_symlinking.py @@ -28,8 +28,13 @@ import pathlib import time +import pytest + from smartsim import Experiment +if pytest.test_launcher not in pytest.wlm_options: + pytestmark = pytest.mark.skip(reason="Not testing WLM integrations") + def test_batch_model_and_ensemble(test_dir, wlmutils): exp_name = "test-batch" diff --git a/tests/test_collector_manager.py b/tests/test_collector_manager.py index 9d7933379..59c2eb9e5 100644 --- a/tests/test_collector_manager.py +++ b/tests/test_collector_manager.py @@ -246,11 +246,13 @@ async def test_collector_manager_collect_filesink( @pytest.mark.asyncio async def test_collector_manager_collect_integration( - test_dir: str, mock_entity: MockCollectorEntityFunc, local_db, mock_sink + test_dir: str, mock_entity: MockCollectorEntityFunc, prepare_db, local_db, mock_sink ) -> None: """Ensure that all collectors are executed and some metric is retrieved""" - entity1 = mock_entity(port=local_db.ports[0], name="e1", telemetry_on=True) - entity2 = mock_entity(port=local_db.ports[0], name="e2", telemetry_on=True) + + db = prepare_db(local_db).orchestrator + entity1 = mock_entity(port=db.ports[0], name="e1", telemetry_on=True) + entity2 = mock_entity(port=db.ports[0], name="e2", telemetry_on=True) # todo: consider a MockSink so i don't have to save the last value in the collector sinks = [mock_sink(), mock_sink(), mock_sink()] diff --git a/tests/test_collectors.py b/tests/test_collectors.py index fd2ed9080..2b647051e 100644 --- a/tests/test_collectors.py +++ b/tests/test_collectors.py @@ -42,6 +42,8 @@ # The tests in this file belong to the group_a group pytestmark = pytest.mark.group_a +PrepareDB = t.Callable[[dict], smartsim.experiment.Orchestrator] + @pytest.mark.asyncio async def test_dbmemcollector_prepare( @@ -171,12 +173,15 @@ async def test_dbmemcollector_collect( async def test_dbmemcollector_integration( mock_entity: MockCollectorEntityFunc, mock_sink: MockSink, - local_db: smartsim.experiment.Orchestrator, + prepare_db: PrepareDB, + local_db: dict, monkeypatch: pytest.MonkeyPatch, ) -> None: """Integration test with a real orchestrator instance to ensure output data matches expectations and proper db client API uage""" - entity = mock_entity(port=local_db.ports[0], telemetry_on=True) + + db = prepare_db(local_db).orchestrator + entity = mock_entity(port=db.ports[0], telemetry_on=True) sink = mock_sink() collector = DBMemoryCollector(entity, sink) @@ -268,12 +273,15 @@ async def test_dbconn_count_collector_collect( async def test_dbconncollector_integration( mock_entity: MockCollectorEntityFunc, mock_sink: MockSink, - local_db: smartsim.experiment.Orchestrator, + prepare_db: PrepareDB, + local_db: dict, monkeypatch: pytest.MonkeyPatch, ) -> None: """Integration test with a real orchestrator instance to ensure output data matches expectations and proper db client API uage""" - entity = mock_entity(port=local_db.ports[0], telemetry_on=True) + + db = prepare_db(local_db).orchestrator + entity = mock_entity(port=db.ports[0], telemetry_on=True) sink = mock_sink() collector = DBConnectionCollector(entity, sink) diff --git a/tests/test_orc_config_settings.py b/tests/test_orc_config_settings.py index 0cccb06de..74d0c1af2 100644 --- a/tests/test_orc_config_settings.py +++ b/tests/test_orc_config_settings.py @@ -41,14 +41,15 @@ pytestmark = pytest.mark.group_b -def test_config_methods(dbutils, local_db): +def test_config_methods(dbutils, prepare_db, local_db): """Test all configuration file edit methods on an active db""" + db = prepare_db(local_db).orchestrator # test the happy path and ensure all configuration file edit methods # successfully execute when given correct key-value pairs configs = dbutils.get_db_configs() for setting, value in configs.items(): - config_set_method = dbutils.get_config_edit_method(local_db, setting) + config_set_method = dbutils.get_config_edit_method(db, setting) config_set_method(value) # ensure SmartSimError is raised when Orchestrator.set_db_conf @@ -57,7 +58,7 @@ def test_config_methods(dbutils, local_db): for key, value_list in ss_error_configs.items(): for value in value_list: with pytest.raises(SmartSimError): - local_db.set_db_conf(key, value) + db.set_db_conf(key, value) # ensure TypeError is raised when Orchestrator.set_db_conf # is given either a key or a value that is not a string @@ -65,7 +66,7 @@ def test_config_methods(dbutils, local_db): for key, value_list in type_error_configs.items(): for value in value_list: with pytest.raises(TypeError): - local_db.set_db_conf(key, value) + db.set_db_conf(key, value) def test_config_methods_inactive(dbutils):