예제 #1
0
    def test_peer_status(self):
        '''
        Test gluster peer status
        '''
        mock_run = MagicMock(return_value=xml_peer_present)
        with patch.dict(glusterfs.__salt__, {'cmd.run': mock_run}):
            self.assertDictEqual(
                glusterfs.peer_status(),
                {'uuid1': {
                 'hostnames': ['node02', 'node02.domain.dom', '10.0.0.2']}})

        mock_run = MagicMock(return_value=xml_command_success)
        with patch.dict(glusterfs.__salt__, {'cmd.run': mock_run}):
            self.assertDictEqual(glusterfs.peer_status(), {})
예제 #2
0
    def test_peer_status(self):
        '''
        Test gluster peer status
        '''
        mock_run = MagicMock(return_value=xml_peer_present)
        with patch.dict(glusterfs.__salt__, {'cmd.run': mock_run}):
            self.assertDictEqual(
                glusterfs.peer_status(),
                {'uuid1': {
                 'hostnames': ['node02', 'node02.domain.dom', '10.0.0.2']}})

        mock_run = MagicMock(return_value=xml_command_success)
        with patch.dict(glusterfs.__salt__, {'cmd.run': mock_run}):
            self.assertDictEqual(glusterfs.peer_status(), {})
예제 #3
0
    def test_peer_status(self):
        """
        Test gluster peer status
        """
        mock_run = MagicMock(return_value=xml_peer_present)
        with patch.dict(glusterfs.__salt__, {"cmd.run": mock_run}):
            self.assertDictEqual(
                glusterfs.peer_status(),
                {
                    "uuid1": {
                        "hostnames":
                        ["node02", "node02.domain.dom", "10.0.0.2"]
                    }
                },
            )

        mock_run = MagicMock(return_value=xml_command_success)
        with patch.dict(glusterfs.__salt__, {"cmd.run": mock_run}):
            self.assertDictEqual(glusterfs.peer_status(), {})