Shutdown Source VM (PAUSED) on successfull migration + blackened all .py files
This commit is contained in:
parent
29e938dc74
commit
9bdf4d2180
31 changed files with 1307 additions and 638 deletions
|
|
@ -6,11 +6,7 @@ from os.path import dirname
|
|||
BASE_DIR = dirname(dirname(__file__))
|
||||
sys.path.insert(0, BASE_DIR)
|
||||
|
||||
from main import (
|
||||
dead_host_detection,
|
||||
dead_host_mitigation,
|
||||
config
|
||||
)
|
||||
from main import dead_host_detection, dead_host_mitigation, config
|
||||
|
||||
|
||||
class TestDeadHostMechanism(unittest.TestCase):
|
||||
|
|
@ -52,13 +48,23 @@ class TestDeadHostMechanism(unittest.TestCase):
|
|||
"last_heartbeat": datetime(2011, 1, 1).isoformat(),
|
||||
}
|
||||
with self.client.client.lock("lock"):
|
||||
self.client.put(f"{self.host_prefix}/1", host1, value_in_json=True)
|
||||
self.client.put(f"{self.host_prefix}/2", host2, value_in_json=True)
|
||||
self.client.put(f"{self.host_prefix}/3", host3, value_in_json=True)
|
||||
self.client.put(f"{self.host_prefix}/4", host4, value_in_json=True)
|
||||
self.client.put(
|
||||
f"{self.host_prefix}/1", host1, value_in_json=True
|
||||
)
|
||||
self.client.put(
|
||||
f"{self.host_prefix}/2", host2, value_in_json=True
|
||||
)
|
||||
self.client.put(
|
||||
f"{self.host_prefix}/3", host3, value_in_json=True
|
||||
)
|
||||
self.client.put(
|
||||
f"{self.host_prefix}/4", host4, value_in_json=True
|
||||
)
|
||||
|
||||
def test_dead_host_detection(self):
|
||||
hosts = self.client.get_prefix(self.host_prefix, value_in_json=True)
|
||||
hosts = self.client.get_prefix(
|
||||
self.host_prefix, value_in_json=True
|
||||
)
|
||||
deads = dead_host_detection(hosts)
|
||||
self.assertEqual(deads, ["/test/host/2", "/test/host/3"])
|
||||
return deads
|
||||
|
|
@ -66,7 +72,9 @@ class TestDeadHostMechanism(unittest.TestCase):
|
|||
def test_dead_host_mitigation(self):
|
||||
deads = self.test_dead_host_detection()
|
||||
dead_host_mitigation(self.client, deads)
|
||||
hosts = self.client.get_prefix(self.host_prefix, value_in_json=True)
|
||||
hosts = self.client.get_prefix(
|
||||
self.host_prefix, value_in_json=True
|
||||
)
|
||||
deads = dead_host_detection(hosts)
|
||||
self.assertEqual(deads, [])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue