Exemplo n.º 1
0
    def test_wait_until_load_low(self):
        # Assume tests are running on a non-busy server
        global_status.wait_until_load_low()
        global_status.wait_until_load_low({
            'Threads_running': 50,
            'Threads_connected': 100
        })

        with pytest.raises(TimeoutError) as excinfo:
            global_status.wait_until_load_low(
                {'Threads_running': -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005,
            )
        message = str(excinfo.value)
        assert 'Threads_running' in message
        assert '-1' in message

        with pytest.raises(TimeoutError) as excinfo:
            global_status.wait_until_load_low(
                {
                    'Threads_running': 1000000,
                    'Uptime': -1
                },  # obviously impossible
                timeout=0.001,
                sleep=0.0005,
            )
        message = str(excinfo.value)
        assert 'Uptime' in message
        assert '-1' in message
        assert 'Threads_running' not in message
        assert '1000000' not in message
Exemplo n.º 2
0
    def test_wait_until_load_low(self):
        # Assume tests are running on a non-busy server
        global_status.wait_until_load_low()
        global_status.wait_until_load_low(
            {"Threads_running": 50, "Threads_connected": 100}
        )

        with pytest.raises(TimeoutError) as excinfo:
            global_status.wait_until_load_low(
                {"Threads_running": -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005,
            )
        message = str(excinfo.value)
        assert "Threads_running" in message
        assert "-1" in message

        with pytest.raises(TimeoutError) as excinfo:
            global_status.wait_until_load_low(
                {"Threads_running": 1000000, "Uptime": -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005,
            )
        message = str(excinfo.value)
        assert "Uptime" in message
        assert "-1" in message
        assert "Threads_running" not in message
        assert "1000000" not in message
Exemplo n.º 3
0
    def test_wait_until_load_low(self):
        # Assume tests are running on a non-busy server
        global_status.wait_until_load_low()
        global_status.wait_until_load_low({'Threads_running': 50,
                                           'Threads_connected': 100})

        with pytest.raises(TimeoutError) as excinfo:
            global_status.wait_until_load_low(
                {'Threads_running': -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005
            )
        message = str(excinfo.value)
        assert 'Threads_running' in message
        assert '-1' in message

        with pytest.raises(TimeoutError) as excinfo:
            global_status.wait_until_load_low(
                {'Threads_running': 1000000,
                 'Uptime': -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005
            )
        message = str(excinfo.value)
        assert 'Uptime' in message
        assert '-1' in message
        assert 'Threads_running' not in message
        assert '1000000' not in message
Exemplo n.º 4
0
    def test_wait_until_load_low(self):
        # Assume tests are running on a non-busy server
        global_status.wait_until_load_low()
        global_status.wait_until_load_low({'Threads_running': 50,
                                           'Threads_connected': 100})

        with self.assertRaises(TimeoutError) as cm:
            global_status.wait_until_load_low(
                {'Threads_running': -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005
            )
        message = str(cm.exception)
        self.assertIn('Threads_running', message)
        self.assertIn('-1', message)

        with self.assertRaises(TimeoutError) as cm:
            global_status.wait_until_load_low(
                {'Threads_running': 1000000,
                 'Uptime': -1},  # obviously impossible
                timeout=0.001,
                sleep=0.0005
            )
        message = str(cm.exception)
        self.assertIn('Uptime', message)
        self.assertIn('-1', message)
        self.assertNotIn('Threads_running', message)
        self.assertNotIn('1000000', message)