Run worker inline so it's easier to see errors
This commit is contained in:
parent
f9476ee1df
commit
f5d27f558e
1 changed files with 14 additions and 14 deletions
|
@ -2,6 +2,7 @@ import functools
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
|
||||
|
@ -17,6 +18,7 @@ from catfish.utils.processes import (
|
|||
terminate_subprocesses,
|
||||
)
|
||||
from catfish.utils.sockets import create_base_socket_dir, delete_base_socket_dir
|
||||
from catfish.worker.server import WORKER_SERVER_SOCKET
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
|
@ -47,24 +49,22 @@ class BaseWorkerTestCase(BaseTestCase):
|
|||
def setUp(self):
|
||||
super().setUp()
|
||||
self.unused_port = unused_port()
|
||||
result = subprocess.run(
|
||||
[shutil.which("ctf"), "start", "--port", str(self.unused_port)],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
self.worker_process = subprocess.Popen(
|
||||
[
|
||||
shutil.which("ctf"),
|
||||
"start",
|
||||
"--port",
|
||||
str(self.unused_port),
|
||||
"--no-fork",
|
||||
],
|
||||
universal_newlines=True,
|
||||
timeout=10,
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stdout)
|
||||
while not WORKER_SERVER_SOCKET.exists():
|
||||
time.sleep(0.1)
|
||||
|
||||
def tearDown(self):
|
||||
result = subprocess.run(
|
||||
[shutil.which("ctf"), "stop"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True,
|
||||
timeout=10,
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stdout)
|
||||
self.worker_process.terminate()
|
||||
self.worker_process.wait()
|
||||
super().tearDown()
|
||||
|
||||
|
||||
|
|
Reference in a new issue