Skip to content

Commit

Permalink
Ref #187 - Make the rootless test fully using rootless and allow to s…
Browse files Browse the repository at this point in the history
…kip the expose_php assertion

The HIDE_PHP_VERSION is not usable with rootless
  • Loading branch information
williamdes committed Aug 20, 2024
1 parent 0109a4f commit f79c707
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 10 additions & 5 deletions testing/docker-compose/docker-compose.testing-run-as-www-data.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -45,6 +44,8 @@ services:
condition: service_healthy

sut:
# nobody:nobody
user: 65534:65534
depends_on:
phpmyadmin:
condition: service_healthy
Expand All @@ -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
Expand All @@ -69,3 +71,6 @@ services:
networks:
testing:
driver: bridge

volumes:
mariadb-data:
6 changes: 5 additions & 1 deletion testing/phpmyadmin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -111,7 +113,9 @@ def test_php_ini(url, username, password, server):
assert(b'<tr><td class="e">upload_max_filesize</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)
assert(b'<tr><td class="e">post_max_size</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)

assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)
if not skip_expose_php_test:
assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)

assert(b'<tr><td class="e">session.save_path</td><td class="v">/sessions</td><td class="v">/sessions</td></tr>' in response)

def test_import_from_folder(url, username, password, server, sqlfile):
Expand Down

0 comments on commit f79c707

Please sign in to comment.