示例#1
0
 def test_nothing_starts(self):
     # Nothing should start now
     self.create_daemon(master=False, noNM=True, disable_zeroconf=True)
     self.assertTrue(
         utils.portIsClosed("localhost", constants.NODE_DEFAULT_REST_PORT, 0),
         "NM started but it should not have",
     )
     self.assertTrue(
         utils.portIsClosed("localhost", constants.MASTER_DEFAULT_REST_PORT, 0),
         "NM started but it should not have",
     )
示例#2
0
    def test_stop_start_node_via_rest(self):

        # test both stop and start of NM via REST
        self.create_daemon(master=True, noNM=False, disable_zeroconf=False)

        # Both managers started fine. If they zeroconf themselves correctly then
        # if we query the MM it should know about its nodes, which should have
        # one element
        mc = MasterManagerClient()
        nodes = _get_nodes_from_client(mc)
        self.assertIsNotNone(nodes)
        self.assertEqual(
            1,
            len(nodes),
            "MasterManager didn't find the NodeManager running on the same node",
        )

        # Check that the NM stops
        self._stop("node", http.HTTPStatus.OK, "")
        self.assertTrue(
            utils.portIsClosed('localhost', constants.NODE_DEFAULT_REST_PORT, _TIMEOUT),
            "The node did not stop successfully",
        )

        # Check that the NM starts
        self._start("node", http.HTTPStatus.OK, {"pid": nodes})
        self.assertTrue(
            utils.portIsOpen('localhost', constants.NODE_DEFAULT_REST_PORT, _TIMEOUT),
            "The node did not start successfully",
        )
示例#3
0
    def test_stop_dataisland_via_rest(self):

        # start master and island manager
        self.create_daemon(master=True, noNM=False, disable_zeroconf=False)
        mc = MasterManagerClient()
        nodes = _get_nodes_from_client(mc)
        self._start("island", http.HTTPStatus.OK, {"nodes": nodes})

        # Both managers started fine. If they zeroconf themselves correctly then
        # if we query the MM it should know about its nodes, which should have
        # one element
        mc = MasterManagerClient()
        nodes = _get_nodes_from_client(mc)
        self.assertIsNotNone(nodes)
        self.assertEqual(
            1,
            len(nodes),
            "MasterManager didn't find the NodeManager running on the same node",
        )

        # Check that the DataIsland stopped
        self._stop("island", http.HTTPStatus.OK, "")
        self.assertTrue(
            utils.portIsClosed("localhost", constants.ISLAND_DEFAULT_REST_PORT, _TIMEOUT),
            "The DIM did not stop successfully",
        )
示例#4
0
 def tearDown(self):
     if self._daemon_t is not None:
         self._daemon.stop(_TIMEOUT)
         self._daemon_t.join(_TIMEOUT)
         self.assertFalse(self._daemon_t.is_alive(), "Daemon running thread should have finished by now")
         self.assertTrue(utils.portIsClosed('localhost', 9000, _TIMEOUT),
                         'DALiuGE Daemon REST interface should be off')
     unittest.TestCase.tearDown(self)
示例#5
0
    def test_start_stop_master_via_rest(self):
        # test both stop and start of MASTER via REST
        self.create_daemon(master=False, noNM=False, disable_zeroconf=True)

        # Check that the MM starts
        self._start("master", http.HTTPStatus.OK)
        self.assertTrue(
            utils.portIsOpen("localhost", constants.MASTER_DEFAULT_REST_PORT, _TIMEOUT),
            "The MM did not start successfully",
        )

        # Check that the MM stops
        self._stop("master", http.HTTPStatus.OK, "")
        self.assertTrue(
            utils.portIsClosed("localhost", constants.MASTER_DEFAULT_REST_PORT, _TIMEOUT),
            "The MM did not stop successfully",
        )