diff --git a/tests/http_base.py b/tests/http_base.py index e5a80c2..5c0008e 100644 --- a/tests/http_base.py +++ b/tests/http_base.py @@ -282,3 +282,14 @@ class DaphneTestCase(unittest.TestCase): self.assertIsInstance(address, str) self.assert_is_ip_address(address) self.assertIsInstance(port, int) + + def test_multiple_workers(self): + """ + Tests that the server can start with multiple workers. + """ + with DaphneTestingInstance() as test_app: + # Configure the server with 3 workers + test_app.process.kwargs["workers"] = 3 + test_app.process.start() + # Verify that the server is running + self.assertTrue(test_app.process.ready.wait(test_app.startup_timeout)) diff --git a/tests/test_cli.py b/tests/test_cli.py index 8368488..ecbf0de 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -257,6 +257,18 @@ class TestCLIInterface(TestCase): """ self.assertCLI(["--no-server-name"], {"server_name": ""}) + def test_workers_default(self): + """ + Tests that the default number of workers is 1. + """ + self.assertCLI([], {"workers": 1}) + + def test_workers_custom(self): + """ + Tests that the CLI correctly parses the --workers argument. + """ + self.assertCLI(["--workers", "4"], {"workers": 4}) + @skipUnless(os.getenv("ASGI_THREADS"), "ASGI_THREADS environment variable not set.") class TestASGIThreads(TestCase):