X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d2369c0fb8742d54f0cdfc88ef485beff62ea277..4d7567b7b3577b561dd064d397c10a9331c3ee16:/services/nodemanager/tests/test_jobqueue.py diff --git a/services/nodemanager/tests/test_jobqueue.py b/services/nodemanager/tests/test_jobqueue.py index a64fb23026..de83b68fed 100644 --- a/services/nodemanager/tests/test_jobqueue.py +++ b/services/nodemanager/tests/test_jobqueue.py @@ -154,12 +154,12 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin, super(JobQueueMonitorActorTestCase, self).build_monitor(*args, **kwargs) self.client.jobs().queue().execute.side_effect = side_effect - @mock.patch("subprocess.check_call") - @mock.patch("subprocess.check_output") + @mock.patch("subprocess32.check_call") + @mock.patch("subprocess32.check_output") def test_unsatisfiable_jobs(self, mock_squeue, mock_scancel): job_uuid = 'zzzzz-8i9sb-zzzzzzzzzzzzzzz' container_uuid = 'yyyyy-dz642-yyyyyyyyyyyyyyy' - mock_squeue.return_value = "1|1024|0|(Resources)|" + container_uuid + "|\n" + mock_squeue.return_value = "1|1024|0|(Resources)|" + container_uuid + "||1234567890\n" self.build_monitor([{'items': [{'uuid': job_uuid}]}], self.MockCalculatorUnsatisfiableJobs(), True, True) @@ -169,7 +169,7 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin, self.client.jobs().cancel.assert_called_with(uuid=job_uuid) mock_scancel.assert_called_with(['scancel', '--name='+container_uuid]) - @mock.patch("subprocess.check_output") + @mock.patch("subprocess32.check_output") def test_subscribers_get_server_lists(self, mock_squeue): mock_squeue.return_value = "" @@ -179,10 +179,10 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin, self.subscriber.assert_called_with([testutil.MockSize(1), testutil.MockSize(2)]) - @mock.patch("subprocess.check_output") + @mock.patch("subprocess32.check_output") def test_squeue_server_list(self, mock_squeue): - mock_squeue.return_value = """1|1024|0|(Resources)|zzzzz-dz642-zzzzzzzzzzzzzzy| -2|1024|0|(Resources)|zzzzz-dz642-zzzzzzzzzzzzzzz| + mock_squeue.return_value = """1|1024|0|(Resources)|zzzzz-dz642-zzzzzzzzzzzzzzy|(null)|1234567890 +2|1024|0|(Resources)|zzzzz-dz642-zzzzzzzzzzzzzzz|(null)|1234567890 """ super(JobQueueMonitorActorTestCase, self).build_monitor(jobqueue.ServerCalculator( @@ -193,10 +193,10 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin, self.subscriber.assert_called_with([testutil.MockSize(1), testutil.MockSize(2)]) - @mock.patch("subprocess.check_output") + @mock.patch("subprocess32.check_output") def test_squeue_server_list_suffix(self, mock_squeue): - mock_squeue.return_value = """1|1024M|0|(ReqNodeNotAvail, UnavailableNodes:compute123)|zzzzz-dz642-zzzzzzzzzzzzzzy| -1|2G|0|(ReqNodeNotAvail)|zzzzz-dz642-zzzzzzzzzzzzzzz| + mock_squeue.return_value = """1|1024M|0|(ReqNodeNotAvail, UnavailableNodes:compute123)|zzzzz-dz642-zzzzzzzzzzzzzzy|(null)|1234567890 +1|2G|0|(ReqNodeNotAvail)|zzzzz-dz642-zzzzzzzzzzzzzzz|(null)|1234567890 """ super(JobQueueMonitorActorTestCase, self).build_monitor(jobqueue.ServerCalculator( @@ -207,9 +207,9 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin, self.subscriber.assert_called_with([testutil.MockSize(1), testutil.MockSize(2)]) - @mock.patch("subprocess.check_output") + @mock.patch("subprocess32.check_output") def test_squeue_server_list_instancetype_constraint(self, mock_squeue): - mock_squeue.return_value = """1|1024|0|(Resources)|zzzzz-dz642-zzzzzzzzzzzzzzy|instancetype=z2.test\n""" + mock_squeue.return_value = """1|1024|0|(Resources)|zzzzz-dz642-zzzzzzzzzzzzzzy|instancetype=z2.test|1234567890\n""" super(JobQueueMonitorActorTestCase, self).build_monitor(jobqueue.ServerCalculator( [(testutil.MockSize(n), {'cores': n, 'ram': n*1024, 'scratch': n}) for n in range(1, 3)]), True, True)