Repository navigation
[TASK] Move the container-structure-test checks into the image tests and remove container-structure-test - #661
Merged
Merged
Conversation
…and remove container-structure-test The CI tested bootstrap, base, base-app, php, php-dev and php-nginx twice: with the PHPUnit image tests and with the container-structure-test suites in tests/structure-test. Most checks of the suites were covered by the image tests already; the others now are, in the traits of the images with that property, so that the images that build on them (php-nginx-dev, php-apache, ...) get them too: the environment, entrypoint, command and exposed ports of the image (read with docker image inspect), the exact modes of the bootstrap commands and of the files of base, the installers of the services that an image does not run, the build scripts that docker-run-bootstrap deleted, the paths of the tools, php-fpm -m, the Blackfire CLI and php.session.upload_progress.enabled from the environment. The image tests are now the only tests of the images. The suites, run.sh, the "run structure-test" step of the image jobs, make structure-test and the container-structure-test binary in webdevops/dockerfile-build-env are removed.
Kanti
force-pushed
the
task/structure-tests-to-phpunit
branch
from
November 23, 2026 08:18
220f259 to
3ce7c11
Compare
…ogress, allow spaces around = in autostart php-fpm -i shows the setting before a pool applies its own: with php_admin_flag[session.upload_progress.enabled] = off in a pool, php-fpm -i still shows On while the worker has it off. The test now asks a worker over FastCGI. The check of autostart in supervisor.d accepts autostart=true too.
|
Kanti
marked this pull request as ready for review
November 23, 2026 08:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
The CI tested
bootstrap,base,base-app,php,php-devandphp-nginxtwice: with the PHPUnit image tests inci/image-testsand with the container-structure-test suites intests/structure-test. Most checks of the suites were covered by the image tests already, often more strictly (a service that runs instead of a line in its configuration, a request through Nginx instead ofnginx -T). The rest is moved into the image tests here, so they are the only tests of the images: one place to add a test, one runner, one result per image job, and no binary downloaded fromstorage.googleapis.com/.../latestinto the build environment.What
Based on
master(stack: this → #662). It needs none of the other open pull requests: it was first stacked on #660, #658 and #657, where the checks below were made, and was rebased ontomasterwithout conflicts;make generatechanges nothing, and the PHPUnit tests (351) and PHPStan ofci/pass.ci/image-tests): every check of the suites is in the image tests now, see the mapping under Tests. New tests go at the end of the trait that the images with that property use, so the images that inherit it get them too (for examplephp-nginx-dev,php-apacheandphp-apache-dev, which had no suite).Docker/ImageConfiguration.php(new) reads what the image sets for its containers withdocker image inspect: environment variables, entrypoint, command and exposed ports. The suites'metadataTestchecked the same.Docker/FileInfo::permissions()(new) gives type and mode asls -lshows them, e.g.-rwxr-xr-x, including the setuid, setgid and sticky bits.assertRootScript()andassertRootFile()only check the r, w and x bits, so the exact modes of the suites (permissions: '-rwxr-xr-x') are checked with it.PhpModuleslistsreadline, which the suite'sphp -mlist had and the image tests did not; the CLI and PHP-FPM load it in all PHP images.tests/structure-test(the six suites andrun.sh), and with ittests/.GithubJobBuilder::structuredTests()and its call;.github/workflows/build.yamlregenerated (33 steps fewer).make structure-test.container-structure-testinwebdevops/dockerfile-build-env(downloaded unpinned aslatest), and its check inBuildEnvChecks.ci/tests/Fixtures/repository/tests/structure-testandGithubJobBuilderTest::testStructureTestUsesTheSuiteOfTheTagToo; the expected step lists no longer have the step.AGENTS.md(repository map, the paragraph onmake structure-test),CONTRIBUTING.md(Building in CI, Building and testing locally; the image tests also read the configuration of the image).docs/did not mention it.Changes for existing users
webdevops/dockerfile-build-envno longer containscontainer-structure-test. The CI of this repository was its only user here; install it yourself if you need it.make structure-testis gone;make test-image IMAGE=webdevops/<image>:<tag>runs the tests of an image.Tests
Mapping of the checks of the suites
"Covered" means an image test that already existed checks it; "new" means this pull request adds the test. Traits in
ci/image-tests/Checks/.bootstrap (
bootstrap:ubuntu-22.04)LC_ALL=C.UTF-8,LANG=C.UTF-8,TERM=xterm,PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binBootstrapChecks::testLocaleTerminalAndPathOfTheImageapk-install,apk-upgrade,apt-install,apt-upgrade-rwxr-xr-xBootstrapChecks::testBootstrapScript(program of root, r/w/x bits) andtestBootstrapCommandPermissions(exact mode)apt-add-repository,apt-update,docker-image-cleanup,docker-image-info,generate-locales,generate-dockerimage-info,docker-run-bootstrap,go-replace-rwxr-xr-xBootstrapChecks::testBootstrapCommandPermissionsPhpChecks::testPhpScripthad six of them, only for the PHP images)/sbin/gosu-rwxr-xr-xBootstrapChecks::testGosuPermissionsbase (
base:ubuntu-22.04)["/entrypoint"], cmd["supervisord"]EntrypointChecks::testEntrypointCommandAndLogVariablesOfTheImageDOCKER_CONF_HOME=/opt/docker/,LOG_STDOUT="",LOG_STDERR=""bootstrap.sh,config.sh,control.sh,entrypoint.sh,service.d/supervisor.shin/opt/docker/bin-rwxr-xr-xBaseChecks::testBaseScriptandtestBasePermissions(exact mode)supervisor.conf,supervisor.d/{cron,dnsmasq,postfix,ssh,syslog}.conf,logrotate.d/syslog-ng,syslog-ng/syslog-ng.confin/opt/docker/etc-rw-r--r--BaseChecks::testBaseFileandtestBasePermissions/opt/docker/provision/service.d/{cron,dnsmasq,postfix,ssh,syslog}.sh-rw-r--r--ServiceChecks::testInstallerIsKeptOnlyForTheServicesTheImageDoesNotRunwhich supervisord,wget,curl(/usr/bin),zic(/usr/sbin),netstat,sed(/usr/binor/bin)BaseChecks::testBaseCommandIsOnThePathbase-app (
base-app:ubuntu-22.04)APPLICATION_USER=application,APPLICATION_GROUP=application,APPLICATION_PATH=/app,APPLICATION_UID=1000,APPLICATION_GID=1000BaseAppChecks::testApplicationVariablesOfTheImagebootstrap.d/10-user-application.shand20-app.shdeletedBaseAppChecks::testBuildScriptsWereRunAndDeleted(no*.shleft in/opt/docker/provision/bootstrap.d)/appdrwxr-xr-x, UID and GID 1000BaseAppChecks::testApplicationPathBelongsToTheApplicationUser(directory ofapplication) andtestApplicationPathPermissions(mode,1000:1000)id application:uid=1000(application) gid=1000(application) groups=1000(application)BaseAppChecks::testApplicationUser(UID, GID, group) andtestIdOfTheApplicationUser(the line)which zip,unzip,nslookup,ssh,rsync,git,patch,bzip2:/usr/bin/<tool>BaseAppChecks::testApplicationToolIsOnThePathphp (all ten tags)
EntrypointChecks::testEntrypointCommandAndLogVariablesOfTheImage9000PhpFpmPublicChecks::testImageExposesPhpFpmLC_ALL,LANG,TERMBootstrapChecks::testLocaleTerminalAndPathOfTheImageDOCKER_CONF_HOME,LOG_STDOUT,LOG_STDERREntrypointChecks::testEntrypointCommandAndLogVariablesOfTheImageAPPLICATION_*BaseAppChecks::testApplicationVariablesOfTheImage/usr/local/bin/pieand/tmp/piedo not existPhpChecks::testPieIsOnlyThereDuringTheBuildbootstrap.d/10-php-init.sh,11-php-conf.sh,10-user-application.sh,20-app.shdeletedBaseAppChecks::testBuildScriptsWereRunAndDeletedservice.d/cron.shandsyslog.shdeleted;dnsmasq.sh,postfix.sh,ssh.shkept,-rw-r--r--ServiceChecks::testInstallerIsKeptOnlyForTheServicesTheImageDoesNotRunfpm/php-fpm.conf,fpm/pool.d/application.confexistPhpFpmChecks::testPhpFpmLayoutentrypoint.d/20-php-fpm.sh,20-php.shexistPhpChecks::testEntrypointScriptsOfPhpsupervisor.d/php-fpm.confexists;syslog.confandcron.confhaveautostart = trueServiceChecks::testServiceStartsAutomaticallyOnlyIfTheImageRunsIt(that they run:ServiceChecks::testSupervisordStartsTheServicesOfTheImage)/appphp.session.upload_progress.enabled=On:enabledin the CLI,session.upload_progress.enabled => On => Oninphp-fpm -iPhpEnvironmentChecks::testSessionUploadProgressFromTheEnvironmentwhich zip…patchBaseAppChecks::testApplicationToolIsOnThePathphp -v: PHP 8.2 or newerPhpChecks::testPhpVersion: the PHP version of the tag (8.2 to 8.6) and at least its security releasephp-fpm -t:test is successfulPhpFpmServiceChecks::testPhpFpmRuns: PHP-FPM runs under supervisord, which it does not with a configuration that fails-tSOME_VAR=somevalinphp-fpm -iPhpFpmEnvironmentChecks::testPhpFpmPoolDirectivesOfDockerConfFromTheEnvironment: a PHP-FPM worker seesAPPLICATION_PATHof the containerwhich convert,gm,gs(/usr/bin),composer(/usr/local/bin)PhpChecks::testPhpCommandIsOnThePath(testImageMagick,testGraphicsMagick,testGhostscript,testComposerran them by their absolute path)php -m: 66 modulesPhpChecks::testPhpModulesreadlineadded toPhpModulesphp-fpm -m: the same modulesPhpFpmChecks::testPhpFpmCommandListsTheModulesPhpWebChecks::testPhpFpmModuleschecked a worker, only in the images with a web server)vipsandxmlrpcup to PHP 8.5PhpChecks::testPhpModules(PhpModulesadds them up to 8.5)php-dev (all ten tags)
/usr/bin/blackfireexistsPhpDevelopmentChecks::testBlackfireClisyslog.conf,postfix.conf,ssh.confhaveautostart = trueServiceChecks::testServiceStartsAutomaticallyOnlyIfTheImageRunsItphp -mlists Xdebug and not BlackfirePhpDevelopmentChecks::testXdebugIsLoadedPHP_DEBUGGER=blackfire: Blackfire, not XdebugPhpDevelopmentEnvironmentChecks::testPhpDebuggerSelectsTheExtension(blackfire)php-nginx (all ten tags)
WEB_DOCUMENT_ROOT=/app,WEB_DOCUMENT_INDEX=index.php,WEB_ALIAS_DOMAIN=*.vm,WEB_PHP_TIMEOUT=600,WEB_PHP_SOCKET=127.0.0.1:9000WebEnvironmentChecks::testWebServerVariablesOfTheImage80,443PiPageChecks::testImageExposesHttpAndHttps/opt/docker/bin/service.d/nginx.shexistsNginxChecks::testNginxScript/opt/docker/etc/nginx/vhost.confexistsNginxChecks::testNginxFilenginx.confhasautostart = trueServiceChecks::testServiceStartsAutomaticallyOnlyIfTheImageRunsItnginx -t:syntax is ok,test is successfulNginxChecks::testNginxRunsandPiPageChecks::testWebServerAnswers: Nginx runs with the configuration of the entrypoint and answers over http and httpsWEB_DOCUMENT_ROOT=/some/test/dir:root "/some/test/dir";innginx -TWebEnvironmentChecks::testDocumentRootAndIndexFromTheEnvironment: a request gets the start page ofWEB_DOCUMENT_ROOTWEB_DOCUMENT_INDEX=somefile.php:index somefile.php;WEB_DOCUMENT_INDEX=start.htmlResults
The PHPUnit tests of
ci/:DockerTestcoversFileInfo::permissions()(program, file, directory, setuid and setgid, setgid without x, sticky directory, link, character device, missing path) andImageConfiguration::parse();GithubJobBuilderTestno longer expects the step.The image tests of this branch and of master, against the published images (amd64):
bootstrap:ubuntu-22.04base:ubuntu-22.04base-app:ubuntu-22.04php:8.5php:8.5-alpinetestBaseCommandIsOnThePath@zicphp-dev:8.5php-dev:8.5-alpinetestBaseCommandIsOnThePath@zicphp-nginx:8.5php-nginx:8.5-alpinetestBaseCommandIsOnThePath@zicEvery other failure is the same with master's tests: the published images are older than master, e.g. PHP 8.5.12 and no
docker-healthcheck(#645). The published Alpine images have no/usr/sbin/zic, and master'sPhpChecks::testZicIsInstalledfails on them too: master installstzdata-utilssince #638, so the image of this pull request's CI has it.With the changes of #657, #658 and #660 (the published images with their files copied over), the tests of this branch and of #660:
php:8.5php:8.5-alpinetestBaseCommandIsOnThePath@zic, as abovephp-nginx:8.5-alpinetestBaseCommandIsOnThePath@zic, as aboveThe new tests fail without the property
local/port-st-mutantisphp-nginx:8.5without the properties, everything else unchanged (ENV LC_ALL=C DOCKER_CONF_HOME=/opt/docker APPLICATION_GID=1001 WEB_PHP_TIMEOUT=60,ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"],chmod u+sofgo-replace,chmod 0775ofgosuand/app,chmod g+sofconfig.sh,wgetandpatchmoved to/usr/local/bin,gmcopied there,autostart=truewithout spaces incron.conf,ssh.shremoved fromservice.d, a script left inbootstrap.d,/tmp/pie,20-php.shrenamed).PhpNginxTestagainst it fails these tests, besides the failures of the published image:testLocaleTerminalAndPathOfTheImage,testBootstrapCommandPermissions@go-replace,testGosuPermissions,testBasePermissions@config.sh,testBaseCommandIsOnThePath@wget,testServiceStartsAutomaticallyOnlyIfTheImageRunsIt@cron,testInstallerIsKeptOnlyForTheServicesTheImageDoesNotRun@ssh,testEntrypointCommandAndLogVariablesOfTheImage,testApplicationVariablesOfTheImage,testApplicationPathPermissions,testApplicationToolIsOnThePath@patch,testBuildScriptsWereRunAndDeleted,testPieIsOnlyThereDuringTheBuild,testEntrypointScriptsOfPhp,testPhpCommandIsOnThePath@gm,testWebServerVariablesOfTheImage, and the existingtestPhpScript@/sbin/gosu. The existingtestBaseScript@config.shpasses on it: it checks the r, w and x bits only.php-dev:8.5withENV PHP_DISMOD=redisand/usr/bin/blackfiremoved to/usr/local/bin:testBlackfireCli,testPhpFpmCommandListsTheModules(php-fpm -m should list redis) and the existingtestPhpModulesfail, nothing else.Where no such image could be built:
testImageExposesHttpAndHttpsandtestImageExposesPhpFpm: a derived image cannot drop anEXPOSE.docker image inspectshows{"9000/tcp":{}}forphp:8.5(no 80 and 443) andnullforbase-app:ubuntu-22.04(no 9000).testIdOfTheApplicationUser:id applicationfails inbase:ubuntu-22.04(no such user).testSessionUploadProgressFromTheEnvironment: without the variable, the same commands printdisabledandsession.upload_progress.enabled => Off => Off(the defaults thattestPhpSettingsandtestPhpFpmDisablesUploadProgresscheck); with itenabledandOn => On.How it was verified
ci/console generateleaves no change; it removed the 33 steps "run structure-test" from.github/workflows/build.yaml.ci/(351) pass, PHPStan (level 8) and Rector with the configuration ofci/find nothing.docker image inspectof 11 images (the three base images;php,php-devandphp-nginxwith8.5and8.5-alpine;php-nginx-dev:8.5,php-apache:8.5), andstat,whichand theautostartlines of the configuration in containers of 14 images (the three base images and the PHP images with8.5and8.5-alpine, exceptphp-apache-dev:8.5-alpine).php-apacheand the-devimages with a web server in full runs; this pull request's CI runs the tests on all of them.webdevops/dockerfile-build-envwas not built here (a build cannot reach HTTPS in this environment); only three lines of aRUNare removed.