X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7a78b6728122c56343d68502192445ae476d24b0..debf08b0415cf0f9d35338cfb280bde8628619eb:/services/nodemanager/tests/test_failure.py diff --git a/services/nodemanager/tests/test_failure.py b/services/nodemanager/tests/test_failure.py deleted file mode 100644 index 8704ef96c9..0000000000 --- a/services/nodemanager/tests/test_failure.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) The Arvados Authors. All rights reserved. -# -# SPDX-License-Identifier: AGPL-3.0 - -from __future__ import absolute_import, print_function - -import errno -import logging -import time -import threading -import unittest - -import mock -import pykka - -from . import testutil - -import arvnodeman.baseactor - -class BogusActor(arvnodeman.baseactor.BaseNodeManagerActor): - def __init__(self, e): - super(BogusActor, self).__init__() - self.exp = e - - def doStuff(self): - raise self.exp - - def ping(self): - # Called by WatchdogActorTest, this delay is longer than the test timeout - # of 1 second, which should cause the watchdog ping to fail. - time.sleep(2) - return True - -class ActorUnhandledExceptionTest(testutil.ActorTestMixin, unittest.TestCase): - def test_fatal_error(self): - for e in (MemoryError(), threading.ThreadError(), OSError(errno.ENOMEM, "")): - with mock.patch('os.kill') as kill_mock: - act = BogusActor.start(e).tell_proxy() - act.doStuff() - act.actor_ref.stop(block=True) - self.assertTrue(kill_mock.called) - - @mock.patch('os.kill') - def test_nonfatal_error(self, kill_mock): - act = BogusActor.start(OSError(errno.ENOENT, "")).tell_proxy() - act.doStuff() - act.actor_ref.stop(block=True) - self.assertFalse(kill_mock.called) - -class WatchdogActorTest(testutil.ActorTestMixin, unittest.TestCase): - @mock.patch('os.kill') - def test_time_timout(self, kill_mock): - act = BogusActor.start(OSError(errno.ENOENT, "")) - watch = arvnodeman.baseactor.WatchdogActor.start(1, act) - time.sleep(1) - watch.stop(block=True) - act.stop(block=True) - self.assertTrue(kill_mock.called)