Esempio n. 1
0
    def test_check_memory6(self):
        container_info = {'memory_stats': {'limit': 10, 'usage': 3}}

        with patch('check_docker.get_status', return_value='running'):
            with patch('check_docker.get_container_info',
                       return_value=container_info):
                check_docker.check_memory(container='container',
                                          warn=20,
                                          crit=30,
                                          units='%')
                self.assertEqual(check_docker.rc, check_docker.CRITICAL_RC)
Esempio n. 2
0
    def test_check_memory2(self):
        container_info = {'memory_stats': {'limit': 10, 'usage': 1}}

        with patch('check_docker.get_status', return_value='running'):
            with patch('check_docker.get_container_info',
                       return_value=container_info):
                check_docker.check_memory(container='container',
                                          warn=1,
                                          crit=2,
                                          units='b')
                self.assertEqual(check_docker.rc, check_docker.WARNING_RC)
    def test_check_memory6(self):
        container_info = {
            'memory_stats': {'limit': 10,
                             'usage': 3
                             }
        }

        with patch('check_docker.get_status', return_value='running'):
            with patch('check_docker.get_container_info', return_value=container_info):
                check_docker.check_memory(container='container', warn=20, crit=30, units='%')
                self.assertEqual(check_docker.rc, check_docker.CRITICAL_RC)
    def test_check_memory5(self):
        container_info = {
            'memory_stats': {'limit': 10,
                             'usage': 2
                             }
        }

        with patch('check_docker.get_state', return_value={'Status': 'running'}):
            with patch('check_docker.get_container_info', return_value=container_info):
                check_docker.check_memory(container='container', warn=20, crit=30, units='%')
                self.assertEqual(check_docker.rc, check_docker.WARNING_RC)
    def test_check_memory2(self):
        container_info = {
            'memory_stats': {'limit': 10,
                             'usage': 1
                             }
        }

        with patch('check_docker.get_status', return_value='running'):
            with patch('check_docker.get_container_info', return_value=container_info):
                check_docker.check_memory(container='container', warn=1, crit=2, units='b')
                self.assertEqual(check_docker.rc, check_docker.WARNING_RC)