X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e38ac44d14e9006c24c93bca9de1ee299b16d367..6a52723d82456e8e7a8e728bc073a4a59e96581a:/services/nodemanager/tests/test_computenode_dispatch_slurm.py diff --git a/services/nodemanager/tests/test_computenode_dispatch_slurm.py b/services/nodemanager/tests/test_computenode_dispatch_slurm.py index 0b6162dfaa..840d0a582a 100644 --- a/services/nodemanager/tests/test_computenode_dispatch_slurm.py +++ b/services/nodemanager/tests/test_computenode_dispatch_slurm.py @@ -13,7 +13,10 @@ import mock import arvnodeman.computenode.dispatch.slurm as slurm_dispatch from . import testutil -from .test_computenode_dispatch import ComputeNodeShutdownActorMixin, ComputeNodeUpdateActorTestCase +from .test_computenode_dispatch import \ + ComputeNodeShutdownActorMixin, \ + ComputeNodeSetupActorTestCase, \ + ComputeNodeUpdateActorTestCase @mock.patch('subprocess.check_output') class SLURMComputeNodeShutdownActorTestCase(ComputeNodeShutdownActorMixin, @@ -123,4 +126,30 @@ class SLURMComputeNodeUpdateActorTestCase(ComputeNodeUpdateActorTestCase): cloud_node = testutil.cloud_node_mock() arv_node = testutil.arvados_node_mock() self.updater.sync_node(cloud_node, arv_node).get(self.TIMEOUT) - check_output.assert_called_with(['scontrol', 'update', 'NodeName=compute99', 'Weight=99000']) + check_output.assert_called_with(['scontrol', 'update', 'NodeName=compute99', 'Weight=99000', 'Features=instancetype=z99.test']) + +class SLURMComputeNodeSetupActorTestCase(ComputeNodeSetupActorTestCase): + ACTOR_CLASS = slurm_dispatch.ComputeNodeSetupActor + + @mock.patch('subprocess.check_output') + def test_update_node_features(self, check_output): + # `scontrol update` happens only if the Arvados node record + # has a hostname. ComputeNodeSetupActorTestCase.make_mocks + # uses mocks with scrubbed hostnames, so we override with the + # default testutil.arvados_node_mock. + self.make_mocks(arvados_effect=[testutil.arvados_node_mock()]) + self.make_actor() + self.wait_for_assignment(self.setup_actor, 'cloud_node') + check_output.assert_called_with(['scontrol', 'update', 'NodeName=compute99', 'Weight=1000', 'Features=instancetype=z1.test']) + + @mock.patch('subprocess.check_output') + def test_failed_arvados_calls_retried(self, check_output): + super(SLURMComputeNodeSetupActorTestCase, self).test_failed_arvados_calls_retried() + + @mock.patch('subprocess.check_output') + def test_subscribe(self, check_output): + super(SLURMComputeNodeSetupActorTestCase, self).test_subscribe() + + @mock.patch('subprocess.check_output') + def test_creation_with_arvados_node(self, check_output): + super(SLURMComputeNodeSetupActorTestCase, self).test_creation_with_arvados_node()