Skip to content

Commit 2fbabe2

Browse files
authored
Merge pull request #8076 from fstagni/80_use_containerized_certs_creation_simple
[8.0] integration test fixes (actually mounting volumes)
2 parents 1f30699 + bffddea commit 2fbabe2

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

integration_tests.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def destroy():
181181
with _gen_docker_compose(DEFAULT_MODULES) as docker_compose_fn:
182182
os.execvpe(
183183
"docker",
184-
["docker", "compose", "-f", docker_compose_fn, "down", "--remove-orphans", "-t", "0"],
184+
["docker", "compose", "-f", docker_compose_fn, "down", "--remove-orphans", "-t", "0", "--volumes"],
185185
_make_env({}),
186186
)
187187

@@ -510,16 +510,21 @@ class TestExit(typer.Exit):
510510

511511
@contextmanager
512512
def _gen_docker_compose(modules):
513-
# Load the docker-compose configuration and mount the necessary volumes
513+
# Load the docker compose configuration and mount the necessary volumes
514514
input_fn = Path(__file__).parent / "tests/CI/docker-compose.yml"
515515
docker_compose = yaml.safe_load(input_fn.read_text())
516+
for ctn in ("dirac-server", "dirac-client"):
517+
if "volumes" not in docker_compose["services"][ctn]:
518+
docker_compose["services"][ctn]["volumes"] = []
516519
volumes = [f"{path}:/home/dirac/LocalRepo/ALTERNATIVE_MODULES/{name}" for name, path in modules.items()]
517520
volumes += [f"{path}:/home/dirac/LocalRepo/TestCode/{name}" for name, path in modules.items()]
518-
docker_compose["services"]["dirac-server"]["volumes"] = volumes[:]
519-
docker_compose["services"]["dirac-client"]["volumes"] = volumes[:]
521+
docker_compose["services"]["dirac-server"]["volumes"].extend(volumes[:])
522+
docker_compose["services"]["dirac-client"]["volumes"].extend(volumes[:])
523+
524+
module_configs = _load_module_configs(modules)
520525

521526
# Add any extension services
522-
for module_name, module_configs in _load_module_configs(modules).items():
527+
for module_name, module_configs in module_configs.items():
523528
for service_name, service_config in module_configs["extra-services"].items():
524529
typer.secho(f"Adding service {service_name} for {module_name}", err=True, fg=c.GREEN)
525530
docker_compose["services"][service_name] = service_config.copy()

tests/CI/docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
volumes:
2+
# Volume used to store the certificates of dirac
3+
certs_data:
24
# Volume used to store the jwks of the IAM service
35
diracx-iam-key-store:
46

@@ -88,6 +90,15 @@ services:
8890
- debug=true
8991
pull_policy: always
9092

93+
dirac-init-certificates:
94+
image: ghcr.io/diracgrid/management/certificates-generation:latest
95+
container_name: dirac-init-certificates
96+
volumes:
97+
- certs_data:/ca/certs/
98+
entrypoint: |
99+
/entrypoint.sh
100+
pull_policy: always
101+
91102
dirac-server:
92103
image: ${CI_REGISTRY_IMAGE}/${HOST_OS}-dirac
93104
container_name: server
@@ -98,8 +109,12 @@ services:
98109
condition: service_healthy
99110
elasticsearch:
100111
condition: service_healthy
112+
dirac-init-certificates:
113+
condition: service_completed_successfully # Let the init container create the certificates
101114
ulimits:
102115
nofile: 8192
116+
volumes:
117+
- certs_data:/ca/certs
103118
pull_policy: always
104119
command: ["sleep", "infinity"] # This is necessary because of the issue described in https://github.com/moby/moby/issues/42275. What is added here is a hack/workaround.
105120

@@ -111,6 +126,8 @@ services:
111126
user: "${DIRAC_UID}:${DIRAC_GID}"
112127
depends_on:
113128
- dirac-server
129+
volumes:
130+
- certs_data:/ca/certs
114131
ulimits:
115132
nofile: 8192
116133
pull_policy: always

tests/Jenkins/utilities.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ installDIRAC() {
266266
echo "$DIRAC"
267267
echo "$PATH"
268268

269+
if ! dirac-proxy-init -g dirac_admin --nocs --no-upload -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
270+
echo 'ERROR: dirac-proxy-init --nocs --no-upload failed' >&2
271+
exit 1
272+
fi
273+
269274
# now configuring
270275
cmd="dirac-configure -S ${DIRACSETUP} -C ${CSURL} --SkipCAChecks ${CONFIGUREOPTIONS} ${DEBUG}"
271276
if ! bash -c "${cmd}"; then

0 commit comments

Comments
 (0)