From 3d9d91b043c0a1bca651cc750bb1f77cf1613795 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Wed, 8 May 2024 00:31:37 +0200 Subject: [PATCH] test: get full nginx config from container --- test/conftest.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index dda20f6..a4fcff5 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -288,17 +288,13 @@ def remove_all_containers(): def get_nginx_conf_from_container(container): """ - return the nginx /etc/nginx/conf.d/default.conf file content from a container + return the full nginx config from a container """ - import tarfile from io import BytesIO - strm_generator, stat = container.get_archive('/etc/nginx/conf.d/default.conf') + _, strm_generator = container.exec_run("nginx -T", stream = True) strm_fileobj = BytesIO(b"".join(strm_generator)) - - with tarfile.open(fileobj=strm_fileobj) as tf: - conffile = tf.extractfile('default.conf') - return conffile.read() + return strm_fileobj.read() def docker_compose_up(compose_file='docker-compose.yml'):