Skip to content

Commit ff736bb

Browse files
docs: Add documentation to start the integration tests.
1 parent 7107442 commit ff736bb

File tree

2 files changed

+62
-5
lines changed

2 files changed

+62
-5
lines changed

docs/source/DeveloperGuide/CodeTesting/index.rst

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,8 @@ Running the above might take a while. Supposing you are interested in running on
309309
./integration_tests.py prepare-environment [FLAGS]
310310
./integration_tests.py install-server
311311
312-
which (in some minutes) will give you a fully dockerized server setup
313-
(`docker container ls` will list the created container, and you can see what's going on inside with the standard `docker exec -it server /bin/bash`.
314-
Now, suppose that you want to run `WorkloadManagementSystem/Test_JobDB.py`,
315-
the first thing to do is that you should first login in the docker container, by doing:
312+
which (in some minutes) will give you a fully dockerized server setup. `docker container ls` will list the created container, and you can see what's going on inside with the standard `docker exec -it server /bin/bash`.
313+
Now, suppose that you want to run `WorkloadManagementSystem/Test_JobDB.py`, the first thing to do is that you should first login in the docker container, by doing:
316314

317315
.. code-block:: bash
318316
@@ -326,7 +324,7 @@ Now you can run the test with:
326324
327325
pytest --no-check-dirac-environment LocalRepo/ALTERNATIVE_MODULES/DIRAC/tests/Integration/WorkloadManagementSystem/Test_JobDB.py
328326
329-
You can find the logs of the services in `/home/dirac/ServerInstallDIR/diracos/runit/`
327+
You can find the logs of the services in `/home/dirac/ServerInstallDIR/diracos/runit/`.
330328

331329
You can also login in client and mysql with:
332330

@@ -335,7 +333,49 @@ You can also login in client and mysql with:
335333
./integration_tests.py exec-client
336334
./integration_tests.py exec-mysql
337335
336+
To restart a service, you can go into the server docker, and run `runsvctrl`:
338337

338+
.. code-block:: bash
339+
340+
./integration_tests.py exec-server
341+
...
342+
runsvctrl t /home/dirac/ServerInstallDIR/diracos/runit/WorkloadManagement/JobMonitor/
343+
344+
And you can also restart all services (it can take some time):
345+
346+
.. code-block:: bash
347+
348+
./integration_tests.py exec-server
349+
...
350+
runsvctrl t /home/dirac/ServerInstallDIR/diracos/runit/*/*
351+
352+
353+
You can also test DiracX in integration tests. To do that, you have to provide in the `prepare-environment` command the following flag: `TEST_DIRACX=Yes`. It will run DiracX alongside DIRAC, and use the available and activated legacy adapted services.
354+
355+
To deactivate a service from being used with DiracX, you can set the `diracxClient` field to `None`:
356+
357+
.. code-block:: python
358+
359+
class MyOldClient(Client):
360+
def __init__(self, **kwargs):
361+
super().__init__(**kwargs)
362+
self.setServer("...")
363+
364+
# Set to NULL to avoid using it in ClientSelector
365+
diracxClient = None
366+
367+
By setting `TEST_DIRACX=Yes` only, it will take the last version of DiracX by default. If you want to provide your own, you have to build your DiracX project, and provide the `dist` folder path when calling `prepare-client`. This path has to be absolute.
368+
369+
.. code-block:: bash
370+
371+
./integration-tests.py prepare-client TEST_DIRACX=Yes --diracx-dist-dir my-dist-folder/
372+
373+
It will then mount your dist folder into DIRAC and DiracX (in `/diracx_sources`) to install the right dependencies.
374+
375+
For MacOS, there are two bugs that can be fixed.
376+
377+
- The first one is about `docker compose` not being recognized. To fix that, you can set in your environment variables `DOCKER_COMPOSE_CMD="docker-compose"`.
378+
- The second one, is for macs with M1 (or more recent ones) chips which are not supported by the `opensearch` docker image. By setting the `ES_PLATFORM` flag to `linux/arm64` you will be able to start `opensearch` without issue.
339379

340380
Validation and System tests
341381
---------------------------

integration_tests.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
DEFAULT_HOST_OS = "el9"
2626
DEFAULT_MYSQL_VER = "mysql:8.4.4"
2727
DEFAULT_ES_VER = "opensearchproject/opensearch:2.18.0"
28+
# In MacOSX with Arm (MX), there's an issue with opensearch
29+
# You *must* set the ES_PLATFORM flag to `linux/arm64` to make it work.
2830
DEFAULT_ES_PLATFORM = "linux/amd64"
2931
DEFAULT_IAM_VER = "indigoiam/iam-login-service:v1.10.2"
3032
FEATURE_VARIABLES = {
@@ -37,6 +39,7 @@
3739
"INSTALLATION_BRANCH": "",
3840
"DEBUG": "Yes",
3941
}
42+
# If TEST_DIRACX is set to yes, all variables in DIRACX_OPTIONS will also be set to "Yes"
4043
DIRACX_OPTIONS = ()
4144
DEFAULT_MODULES = {"DIRAC": Path(__file__).parent.absolute()}
4245

@@ -72,6 +75,8 @@
7275
}
7376
LOG_PATTERN = re.compile(r"^[\d\-]{10} [\d:]{8} UTC [^\s]+ ([A-Z]+):")
7477

78+
# In niche cases where we use MacOSX with Orbstack, some commands may not work with docker compose
79+
# If you're in that case, set in your environment `export DOCKER_COMPOSE_CMD="docker-compose"`
7580
DOCKER_COMPOSE_CMD = shlex.split(os.environ.get("DOCKER_COMPOSE_CMD", "docker compose"))
7681

7782

@@ -143,6 +148,18 @@ def list_commands(self, ctx):
143148
After restarting your terminal you command completion is available using:
144149
145150
typer ./integration_tests.py run ...
151+
152+
## DiracX
153+
154+
If you want to activate DiracX, you have to set the flag TEST_DIRACX to "Yes".
155+
It will search for legacy adapted services (services with a future client activated)
156+
and do the necessary to make DIRAC work alongside DiracX.
157+
158+
To deactivate a legacy adapted service (to pass CI for example), you have to set in the old
159+
client the `diracxClient` field to "None". Else, set it to the right future client instance.
160+
161+
> Note that you can provide a DiracX project (repository, branch) by building it and providing
162+
the dist folder to the prepare-environment command.
146163
""",
147164
)
148165

0 commit comments

Comments
 (0)