def test_invalid_watchdogs(self): watchdog_dict = { self.node_list[1].label: "", self.node_list[2].label: None, self.node_list[3].label: "not/abs/path", self.node_list[4].label: "/dev/watchdog" } assert_raise_library_error( lambda: cmd_sbd._get_full_watchdog_list( self.node_list, "/dev/dog", watchdog_dict ), ( Severities.ERROR, report_codes.WATCHDOG_INVALID, {"watchdog": ""} ), ( Severities.ERROR, report_codes.WATCHDOG_INVALID, {"watchdog": None} ), ( Severities.ERROR, report_codes.WATCHDOG_INVALID, {"watchdog": "not/abs/path"} ) )
def test_unknown_nodes(self): watchdog_dict = { self.node_list[1].label: "/dev/watchdog1", self.node_list[2].label: "/dev/watchdog2", "unknown_node": "/dev/watchdog0", "another_unknown_node": "/dev/watchdog" } assert_raise_library_error( lambda: cmd_sbd._get_full_watchdog_list(self.node_list, "/dev/dog", watchdog_dict), (Severities.ERROR, report_codes.NODE_NOT_FOUND, { "node": "unknown_node" }), (Severities.ERROR, report_codes.NODE_NOT_FOUND, { "node": "another_unknown_node" }))
def test_full(self): watchdog_dict = { self.node_list[1].label: "/dev/watchdog1", self.node_list[2].label: "/dev/watchdog2" } expected = { self.node_list[0]: "/dev/default", self.node_list[1]: "/dev/watchdog1", self.node_list[2]: "/dev/watchdog2", self.node_list[3]: "/dev/default", self.node_list[4]: "/dev/default", } self.assertEqual( cmd_sbd._get_full_watchdog_list(self.node_list, "/dev/default", watchdog_dict), expected)