diff --git a/azure-slurm/test/slurmcc_test/allocation_test.py b/azure-slurm/test/slurmcc_test/allocation_test.py index 7c035c19..bf67c49d 100644 --- a/azure-slurm/test/slurmcc_test/allocation_test.py +++ b/azure-slurm/test/slurmcc_test/allocation_test.py @@ -11,6 +11,7 @@ from . import testutil import logging +import pytest import sys logging.basicConfig(level=logging.DEBUG, format="%(message)s", stream=sys.stderr) @@ -93,8 +94,18 @@ def test_mixed_resume_names() -> None: assert len(bootup_result.nodes) == 2 assert node_list == [n.name for n in bootup_result.nodes] - + +@pytest.fixture(autouse=True) +def mock_is_slurmctld_up() -> None: + implementation = slutil.is_slurmctld_up + slutil.is_slurmctld_up = lambda: True + yield + slutil.is_slurmctld_up = implementation + + def test_resume_dynamic_by_feature() -> None: + + node_mgr = testutil.make_test_node_manager() bindings: MockClusterBinding = node_mgr.cluster_bindings # type: ignore native_cli = testutil.make_native_cli() @@ -130,8 +141,6 @@ def test_resume_dynamic_by_feature() -> None: assert 2 == len(result.nodes) - - def test_failure_mode() -> None: node_mgr = testutil.make_test_node_manager() bindings: MockClusterBinding = node_mgr.cluster_bindings # type: ignore diff --git a/azure-slurm/test/slurmcc_test/cli_test.py b/azure-slurm/test/slurmcc_test/cli_test.py index 63c974d9..693602a6 100644 --- a/azure-slurm/test/slurmcc_test/cli_test.py +++ b/azure-slurm/test/slurmcc_test/cli_test.py @@ -32,7 +32,7 @@ def make_partition( use_pcpu: bool = True, slurm_memory: str = "", dampen_memory: Optional[float] = None, - dynamic_config: str = "", + dynamic_feature: str = "", ) -> Partition: resources = {"slurm_memory": Memory.value_of(slurm_memory)} if slurm_memory else {} node_def = NodeDefinition( @@ -64,7 +64,7 @@ def make_partition( [bucket], 100, use_pcpu, - dynamic_config, + dynamic_feature, {}, ["Standard_f4"], dampen_memory, @@ -76,7 +76,7 @@ def test_partitions() -> None: partitions = [ make_partition("htc", False, False), make_partition("hpc", True, True), - make_partition("dynamic", False, False, dynamic_config="-Z Feature=dyn"), + make_partition("dynamic", False, False, dynamic_feature="dyn"), ] # Define neither slurm_memory nor dampen_memory, autoscale=true @@ -123,7 +123,7 @@ def test_partitions() -> None: make_partition("htc", False, False, slurm_memory="15g"), make_partition("hpc", True, True, slurm_memory="14g"), make_partition( - "dynamic", False, False, dynamic_config="-Z Feature=dyn", slurm_memory="13g" + "dynamic", False, False, dynamic_feature="dyn", slurm_memory="13g" ), ] # No slurm.dampen_memory or slurm_memory resource, autoscale=FALSE @@ -151,7 +151,7 @@ def test_partitions() -> None: "dynamic", False, False, - dynamic_config="-Z Feature=dyn", + dynamic_feature="dyn", slurm_memory="13g", dampen_memory=0.75, ), @@ -181,7 +181,7 @@ def test_partitions() -> None: "dynamic", False, False, - dynamic_config="-Z Feature=dyn", + dynamic_feature="dyn", slurm_memory="13g", dampen_memory=0.75, ), diff --git a/azure-slurm/test/slurmcc_test/testutil.py b/azure-slurm/test/slurmcc_test/testutil.py index 5bd357be..1c18b3a9 100644 --- a/azure-slurm/test/slurmcc_test/testutil.py +++ b/azure-slurm/test/slurmcc_test/testutil.py @@ -135,6 +135,9 @@ def create_nodes(self, node_names: List[str], features: List[str] = [], partitio } clear_caches() + def srun(self, args: List[str], retry: bool = True) -> str: + raise RuntimeError("srun not implemented") + set_slurm_cli(MockNativeSlurmCLI()) diff --git a/azure-slurm/test/slurmcc_test/util_test.py b/azure-slurm/test/slurmcc_test/util_test.py index 14bed953..7b87a1a1 100644 --- a/azure-slurm/test/slurmcc_test/util_test.py +++ b/azure-slurm/test/slurmcc_test/util_test.py @@ -46,6 +46,6 @@ def test_run_function() -> None: # test case for permissions errors try: - out=run(['touch', '/root/.test']) + run(['touch', '/root/.test']) except subprocess.CalledProcessError as e: - assert out.returncode != 0 \ No newline at end of file + assert e.returncode != 0 \ No newline at end of file