Skip to content

Commit

Permalink
Update test cases from Go Quadlet
Browse files Browse the repository at this point in the history
  • Loading branch information
riyad committed Dec 29, 2022
1 parent 8584507 commit b301743
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 47 deletions.
4 changes: 2 additions & 2 deletions tests/cases/annotation.container
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename
## assert-podman-args "--annotation" "org.foo.Arg0=arg0"
## assert-podman-args "--annotation" "org.foo.Arg1=arg1"
## assert-podman-args "--annotation" "org.foo.Arg2=arg 2"
## assert-podman-args "--annotation" "org.foo.Arg3=arg3"

[Container]
Image=imagename
Image=localhost/imagename
Annotation=org.foo.Arg1=arg1 "org.foo.Arg2=arg 2" \
org.foo.Arg3=arg3

Expand Down
6 changes: 3 additions & 3 deletions tests/cases/basepodman.container
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## assert-podman-final-args run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm -d --log-driver journald --pull=never --runtime /usr/bin/crun --cgroups=split --sdnotify=conmon imagename
## assert-podman-final-args run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm -d --log-driver passthrough --runtime /usr/bin/crun --cgroups=split --sdnotify=conmon localhost/imagename

[Container]
Image=imagename
Image=localhost/imagename

# Disable all default features to get as empty podman run command as we can
RemapUsers=no
ReadOnly=no
NoNewPrivileges=no
DropCapability=
RunInit=no
Expand Down
14 changes: 4 additions & 10 deletions tests/cases/basic.container
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename
## assert-podman-args "--name=systemd-%N"
## assert-podman-args "--cidfile=%t/%N.cid"
## assert-podman-args "--rm"
## assert-podman-args "--replace"
## assert-podman-args "-d"
## assert-podman-args "--log-driver" "journald"
## assert-podman-args "--pull=never"
## assert-podman-args "--init"
## assert-podman-args "--log-driver" "passthrough"
## assert-podman-args "--runtime" "/usr/bin/crun"
## assert-podman-args "--cgroups=split"
## assert-podman-args "--sdnotify=conmon"
## assert-podman-args "--security-opt=no-new-privileges"
## assert-podman-args "--cap-drop=all"
## assert-podman-args "--tmpfs" "/tmp:rw,size=512M,mode=1777"
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers"
## assert-key-is "Service" "KillMode" "mixed"
## assert-key-is "Service" "Delegate" "yes"
## assert-key-is "Service" "Type" "notify"
## assert-key-is "Service" "NotifyAccess" "all"
## assert-key-is "Service" "SyslogIdentifier" "%N"
## assert-key-is "Service" "ExecStartPre" "-rm -f %t/%N.cid"
## assert-key-is "Service" "ExecStopPost" "-/usr/bin/podman rm -f -i --cidfile=%t/%N.cid" "-rm -f %t/%N.cid"
## assert-key-is-regex "Service" "ExecStopPost" "-.*/podman rm -f -i --cidfile=%t/%N.cid" "-rm -f %t/%N.cid"
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"

[Container]
Image=imagename
Image=localhost/imagename
3 changes: 1 addition & 2 deletions tests/cases/basic.volume
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
## assert-key-is Unit RequiresMountsFor "%t/containers"
## assert-key-is Service Type oneshot
## assert-key-is Service RemainAfterExit yes
## assert-key-is Service ExecCondition '/usr/bin/bash -c "! /usr/bin/podman volume exists systemd-basic"'
## assert-key-is Service ExecStart "/usr/bin/podman volume create systemd-basic"
## assert-key-is-regex Service ExecStart ".*/podman volume create --ignore systemd-basic"
## assert-key-is Service SyslogIdentifier "%N"

[Volume]
7 changes: 4 additions & 3 deletions tests/cases/capabilities.container
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## assert-podman-args "--cap-drop=all"
## !assert-podman-args "--cap-drop=all"
## assert-podman-args "--cap-add=cap_dac_override"
## assert-podman-args "--cap-add=cap_audit_write"
## assert-podman-args "--cap-add=cap_ipc_owner"

[Container]
Image=imagename
AddCapability=CAP_DAC_OVERRIDE
Image=localhost/imagename
AddCapability=CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
AddCapability=CAP_IPC_OWNER
4 changes: 2 additions & 2 deletions tests/cases/env.container
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename
## assert-podman-args --env "FOO1=foo1"
## assert-podman-args --env "FOO2=foo2 "
## assert-podman-args --env "FOO3=foo3"
## assert-podman-args --env "REPLACE=replaced"
## assert-podman-args --env "FOO4=foo\\nfoo"

[Container]
Image=imagename
Image=localhost/imagename
Environment=FOO1=foo1 "FOO2=foo2 " \
FOO3=foo3 REPLACE=replace
Environment=REPLACE=replaced 'FOO4=foo\nfoo'
2 changes: 1 addition & 1 deletion tests/cases/escapes.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args "/some/path" "an arg" "a;b\\nc\\td'e" "a;b\\nc\\td" "a\"b"

[Container]
Image=imagename
Image=localhost/imagename
Exec=/some/path "an arg" "a;b\nc\td'e" a;b\nc\td 'a"b'
4 changes: 2 additions & 2 deletions tests/cases/exec.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args imagename "/some/binary file" "--arg1" "arg 2"
## assert-podman-final-args localhost/imagename "/some/binary file" "--arg1" "arg 2"

[Container]
Image=imagename
Image=localhost/imagename
Exec="/some/binary file" --arg1 \
"arg 2"
4 changes: 2 additions & 2 deletions tests/cases/image.container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename

[Container]
Image=imagename
Image=localhost/imagename
2 changes: 1 addition & 1 deletion tests/cases/install.container
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## assert-symlink req3.service.requires/install.service ../install.service

[Container]
Image=imagename
Image=localhost/imagename

[Install]
Alias=alias.service \
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/label.container
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename
## assert-podman-args "--label" "org.foo.Arg0=arg0"
## assert-podman-args "--label" "org.foo.Arg1=arg1"
## assert-podman-args "--label" "org.foo.Arg2=arg 2"
## assert-podman-args "--label" "org.foo.Arg3=arg3"

[Container]
Image=imagename
Image=localhost/imagename
Label=org.foo.Arg1=arg1 "org.foo.Arg2=arg 2" \
org.foo.Arg3=arg3

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/name.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-args "--name=foobar"

[Container]
Image=imagename
Image=localhost/imagename
ContainerName=foobar
2 changes: 1 addition & 1 deletion tests/cases/noimage.container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-failed
## assert-stderr-contains "No Image key specified"
## assert-stderr-contains "no Image key specified"

[Container]
2 changes: 1 addition & 1 deletion tests/cases/notify.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-args "--sdnotify=container"

[Container]
Image=imagename
Image=localhost/imagename
Notify=yes
6 changes: 3 additions & 3 deletions tests/cases/other-sections.container
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename
## assert-key-is "Unit" "Foo" "bar1" "bar2"
## assert-key-is "X-Container" "Image" "imagename"
## assert-key-is "X-Container" "Image" "localhost/imagename"

[Unit]
Foo=bar1
Foo=bar2

[Container]
Image=imagename
Image=localhost/imagename
2 changes: 1 addition & 1 deletion tests/cases/podmanargs.container
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## assert-podman-args "--also"

[Container]
Image=imagename
Image=localhost/imagename
PodmanArgs="--foo" \
--bar
PodmanArgs=--also
4 changes: 1 addition & 3 deletions tests/cases/ports.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Container]
Image=imagename
Image=localhost/imagename
## assert-podman-args --expose=1000
ExposeHostPort=1000
## assert-podman-args --expose=2000-3000
Expand Down Expand Up @@ -52,5 +52,3 @@ ExposeHostPort=2000-3000/udp

## assert-podman-args --expose=2000-3000/tcp
ExposeHostPort=2000-3000/tcp


2 changes: 1 addition & 1 deletion tests/cases/ports_ipv6.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Container]
Image=imagename
Image=localhost/imagename
## assert-podman-args -p=[::1]:80:90
PublishPort=[::1]:80:90

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/socketactivated.container
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
## assert-key-is "Service" "NotifyAccess" "all"

[Container]
Image=imagename
Image=localhost/imagename
SocketActivated=yes
2 changes: 1 addition & 1 deletion tests/cases/timezone.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-args --tz=foo

[Container]
Image=imagename
Image=localhost/imagename
Timezone=foo
4 changes: 2 additions & 2 deletions tests/cases/user.container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## assert-podman-final-args imagename
## assert-podman-final-args localhost/imagename
## assert-podman-args "--user" "998:999"

[Container]
Image=imagename
Image=localhost/imagename
User=998
Group=999
4 changes: 2 additions & 2 deletions tests/cases/volume.container
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## assert-podman-args -v=/host/dir:/container/volume
## assert-podman-args -v=/host/dir2:/container/volume2:Z
## assert-podman-args -v=named:/container/named
## assert-podman-args -v=systemd-quadlet:/container/quadlet imagename
## assert-podman-args -v=systemd-quadlet:/container/quadlet localhost/imagename

[Container]
Image=imagename
Image=localhost/imagename
Volume=/host/dir:/container/volume
Volume=/host/dir2:/container/volume2:Z
Volume=/container/empty
Expand Down

0 comments on commit b301743

Please sign in to comment.