How to use _wait_for_workers_report_after_ramp_up method in locust

Best Python code snippet using locust

test_runners.py

Source:test_runners.py Github

copy

Full Screen

...1848 self.assertFalse(test_custom_msg[0])1849 self.assertEqual(1, len(self.mocked_log.warning))1850 msg = self.mocked_log.warning[0]1851 self.assertIn("Unknown message type recieved from worker", msg)1852 def test_wait_for_workers_report_after_ramp_up(self):1853 def assert_cache_hits():1854 self.assertEqual(master._wait_for_workers_report_after_ramp_up.cache_info().hits, 0)1855 master._wait_for_workers_report_after_ramp_up()1856 self.assertEqual(master._wait_for_workers_report_after_ramp_up.cache_info().hits, 1)1857 master = self.get_runner()1858 master._wait_for_workers_report_after_ramp_up.cache_clear()1859 self.assertEqual(master._wait_for_workers_report_after_ramp_up(), 0.1)1860 assert_cache_hits()1861 master._wait_for_workers_report_after_ramp_up.cache_clear()1862 with _patch_env("LOCUST_WAIT_FOR_WORKERS_REPORT_AFTER_RAMP_UP", "5.7"):1863 self.assertEqual(master._wait_for_workers_report_after_ramp_up(), 5.7)1864 assert_cache_hits()1865 master._wait_for_workers_report_after_ramp_up.cache_clear()1866 with mock.patch("locust.runners.WORKER_REPORT_INTERVAL", new=1.5), _patch_env(1867 "LOCUST_WAIT_FOR_WORKERS_REPORT_AFTER_RAMP_UP", "5.7 * WORKER_REPORT_INTERVAL"1868 ):1869 self.assertEqual(master._wait_for_workers_report_after_ramp_up(), 5.7 * 1.5)1870 assert_cache_hits()1871 master._wait_for_workers_report_after_ramp_up.cache_clear()1872@contextmanager1873def _patch_env(name: str, value: str):1874 prev_value = os.getenv(name)1875 os.environ[name] = value1876 try:1877 yield1878 finally:1879 if prev_value is None:1880 del os.environ[name]1881 else:1882 os.environ[name] = prev_value1883class TestWorkerRunner(LocustTestCase):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run locust automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful