container-structure-test
container-structure-test copied to clipboard
podman support for commands test
Is there a plan to support podman/buildah for doing command test in container structure test. As for doing command test today, it needs docker today.
No current plans. But we are accepting designs and code changes.
Hey, I just wanted to chime in and say that as of Podman 3.0 this use-case is partially supported!
$ systemctl start --user podman.socket # make sure podman socket is available
$ export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"
$ container-structure-test test -c container-structure.yaml -i foobar:latest
=================================================
====== Test file: container-structure.yaml ======
=================================================
=== RUN: File Content Test: Apache mod_ldap is configured to use global CA certificates
--- PASS
duration: 0s
=== RUN: File Content Test: Apache listens on port 8000
--- PASS
duration: 0s
=== RUN: File Content Test: Apache MPM configuration
--- PASS
duration: 0s
=== RUN: File Existence Test: certificates are installed
--- PASS
duration: 0s
=================================================
==================== RESULTS ====================
=================================================
Passes: 4
Failures: 0
Duration: 0s
Total tests: 4
PASS
However, commandTests do not appear to work when there is a non-shell entrypoint (in my case httpd). The entrypoint does not get overridden like it should:
$ cat container-structure.yaml
schemaVersion: "2.0.0"
commandTests:
- name: "Test"
command: "true"
exitCode: 0
setup: [["/bin/sh", "-c"]]
$ container-structure-test test -c container-structure.yaml -i foobar:latest
=================================================
====== Test file: container-structure.yaml ======
=================================================
=== RUN: Command Test: Test
--- FAIL
duration: 2.021230465s
stderr: Usage: httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t -D DUMP_INCLUDES: show all included configuration files
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
Error: Test 'Test' exited with incorrect error code. Expected: 0, Actual: 1
=================================================
==================== RESULTS ====================
=================================================
Passes: 0
Failures: 1
Duration: 2.021230465s
Total tests: 1
FAIL
FATA[0011] FAIL
Software versions:
$ container-structure-test version
v1.10.0
$ podman version
Version: 3.4.0
API Version: 3.4.0
Go Version: go1.17.1
Git Commit: 6e8de00bb224f9931d7402648f0177e7357ed079
Built: Fri Oct 1 12:14:18 2021
OS/Arch: linux/amd64