From f79c7073ab4f3abf9267735a3f69572ed8ae7628 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 20 Aug 2024 20:33:03 +0200 Subject: [PATCH] Ref #187 - Make the rootless test fully using rootless and allow to skip the expose_php assertion The HIDE_PHP_VERSION is not usable with rootless --- .../docker-compose.testing-run-as-www-data.yml | 15 ++++++++++----- testing/phpmyadmin_test.py | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/testing/docker-compose/docker-compose.testing-run-as-www-data.yml b/testing/docker-compose/docker-compose.testing-run-as-www-data.yml index 7389ba06..9533ec38 100644 --- a/testing/docker-compose/docker-compose.testing-run-as-www-data.yml +++ b/testing/docker-compose/docker-compose.testing-run-as-www-data.yml @@ -1,8 +1,8 @@ -version: "3.1" - services: db_server: image: ${DB:-mariadb:10.11} + # mysql:mysql in MariaDB for Docker (https://stackoverflow.com/a/55241769/5155484) + user: 999:999 environment: MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" healthcheck: @@ -15,8 +15,8 @@ services: testing: aliases: - phpmyadmin_testing_db - tmpfs: - - /var/lib/mysql:rw,noexec,nosuid,size=300m + volumes: + - mariadb-data:/var/lib/mysql phpmyadmin: build: @@ -27,7 +27,6 @@ services: PMA_HOST: db_server UPLOAD_LIMIT: 123M MAX_EXECUTION_TIME: 125 - HIDE_PHP_VERSION: 1 volumes: - ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro healthcheck: @@ -45,6 +44,8 @@ services: condition: service_healthy sut: + # nobody:nobody + user: 65534:65534 depends_on: phpmyadmin: condition: service_healthy @@ -61,6 +62,7 @@ services: TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" PMA_HOST: phpmyadmin_testing_db PMA_PORT: 3306 + SKIP_EXPOSE_PHP_TEST: true volumes: - ../../:/tests:ro - /var/run/docker.sock:/var/run/docker.sock @@ -69,3 +71,6 @@ services: networks: testing: driver: bridge + +volumes: + mariadb-data: diff --git a/testing/phpmyadmin_test.py b/testing/phpmyadmin_test.py index 5b78136e..5bd24b13 100755 --- a/testing/phpmyadmin_test.py +++ b/testing/phpmyadmin_test.py @@ -91,6 +91,8 @@ def test_phpmyadmin_secrets(): def test_php_ini(url, username, password, server): + skip_expose_php_test = os.environ.get('SKIP_EXPOSE_PHP_TEST'); + br = create_browser() response = do_login(br, url, username, password, server) @@ -111,7 +113,9 @@ def test_php_ini(url, username, password, server): assert(b'upload_max_filesize123M123M' in response) assert(b'post_max_size123M123M' in response) - assert(b'expose_phpOffOff' in response) + if not skip_expose_php_test: + assert(b'expose_phpOffOff' in response) + assert(b'session.save_path/sessions/sessions' in response) def test_import_from_folder(url, username, password, server, sqlfile):