Skip to content

Commit

Permalink
add test for --expect-workers and --expect-workers-max-wait (expectin…
Browse files Browse the repository at this point in the history
…g this to fail)
  • Loading branch information
cyberw committed Nov 1, 2021
1 parent 36b5ad9 commit 5186af4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions locust/test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,3 +667,26 @@ def test_html_report_option(self):
self.assertIn("charts-container", html_report_content)

self.assertNotIn("Download the Report", html_report_content, "Download report link found in HTML content")

def test_expect_workers(self):
with mock_locustfile() as mocked:
proc = subprocess.Popen(
[
"locust",
"-f",
mocked.file_path,
"--headless",
"--master",
"--expect-workers",
"2",
"--expect-workers-max-wait",
"1",
],
stdout=PIPE,
stderr=PIPE,
)
_, stderr = proc.communicate()
stderr = stderr.decode("utf-8")
self.assertIn("Waiting for workers to be ready, 0 of 2 connected", stderr)
self.assertIn("Gave up waiting for workers to connect", stderr)
self.assertEqual(1, proc.returncode)

0 comments on commit 5186af4

Please sign in to comment.