예제 #1
0
    def test_node_stop(self, m_docker_client, m_client):
        """
        Test the client removes the host and stops the node when node_stop
        called
        """
        # Call method under test
        node.node_stop(True)

        # Assert
        m_client.remove_host.assert_called_once_with(node.hostname)
        m_docker_client.stop.assert_called_once_with('calico-node')
예제 #2
0
    def test_node_stop(self, m_docker_client, m_client):
        """
        Test the client removes the host and stops the node when node_stop
        called
        """
        # Call method under test
        node.node_stop(True)

        # Assert
        m_client.remove_host.assert_called_once_with(node.hostname)
        m_docker_client.stop.assert_called_once_with('calico-node')
예제 #3
0
    def test_node_stop(self, m_docker_client, m_client):
        """
        Test the client stops the node when node_stop called when there are
        endpoints and the force flag is set.
        """
        # Call method under test
        m_client.get_endpoints.return_value = [Mock()]
        node.node_stop(True)

        # Assert
        m_client.get_endpoints.assert_called_once_with(hostname=node.hostname)
        m_docker_client.stop.assert_has_calls([call("calico-node"), call("calico-libnetwork")])
예제 #4
0
    def test_node_stop(self, m_docker_client, m_client):
        """
        Test the client stops the node when node_stop called when there are
        endpoints and the force flag is set.
        """
        # Call method under test
        m_client.get_endpoints.return_value = [Mock()]
        node.node_stop(True)

        # Assert
        m_client.get_endpoints.assert_called_once_with(hostname=node.hostname)
        m_docker_client.stop.assert_has_calls([call('calico-node'),
                                               call('calico-libnetwork')])