|
| 1 | +"""The UnitTest Instance Launcher. |
| 2 | +
|
| 3 | +It runs Python module modules defined in the unit-test job-definitions file. |
| 4 | +
|
| 5 | +It also uses the UnitTestMessageDispatcher to send a simulated |
| 6 | +'end of instance' PodMessage that are normally sent to the WorkflowEngine's |
| 7 | +'handle_message()' method by the underlying queue. The 'exit code' of the module is |
| 8 | +passed to the WorkflowEngine through the PodMessage - so if the module fails |
| 9 | +(i.e. returns a non-zero exit code) then the WorkflowEngine will see that the PodMessage. |
| 10 | +This allows you to write jobs that fail and see how the WorkflowEngine responds. |
| 11 | +
|
| 12 | +Instances (jobs) are executed in a simulated project directory - actually |
| 13 | +tests/project-root/project-00000000-0000-0000-0000-000000000001. The project directory |
| 14 | +is created by the UnitTestInstanceLauncher and is also wiped as the launcher initialises |
| 15 | +(so the start of each test begins with an empty project directory). |
| 16 | +""" |
| 17 | + |
1 | 18 | import json
|
2 | 19 | import os
|
3 | 20 | import shutil
|
@@ -28,22 +45,7 @@ def project_file_exists(file_name: str) -> bool:
|
28 | 45 |
|
29 | 46 |
|
30 | 47 | class UnitTestInstanceLauncher(InstanceLauncher):
|
31 |
| - """A unit test instance launcher, which runs the |
32 |
| - Python module that matches the job name in the provided specification. |
33 |
| -
|
34 |
| - The Python module used to satisfy the step matches the job name in the |
35 |
| - step specification. If the step_specification's 'job' is 'my_job', then the launcher |
36 |
| - will run the Python module 'my_job.py' in the 'jobs' directory. The |
37 |
| - module is run synchronously - i.e. the launch() method waits for the |
38 |
| - module to complete. |
39 |
| -
|
40 |
| - It then uses the UnitTestMessageDispatcher to send a simulated |
41 |
| - 'end of instance' PodMessage that will be received by the WorkflowEngine's |
42 |
| - 'handle_message()' method. The 'exit code' of the module is passed to the |
43 |
| - WorkflowEngine through the PodMessage - so if the module fails (i.e. returns |
44 |
| - a non-zero exit code) then the WorkflowEngine will see that the PodMessage. |
45 |
| - This allows you to write jobs that fail and see how the WorkflowEngine responds. |
46 |
| - """ |
| 48 | + """A unit test instance launcher.""" |
47 | 49 |
|
48 | 50 | def __init__(
|
49 | 51 | self, api_adapter: UnitTestAPIAdapter, msg_dispatcher: UnitTestMessageDispatcher
|
|
0 commit comments