summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-08-25 09:23:14 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-09-06 17:53:28 +0200
commit25033cca08485607aacf22ab67baf70e35eae30b (patch)
tree19d159720159e9ac01a0c39588714b29a77d4b15 /test
parentcore/exec-credential: introduce exec_context_get_credential_directory() helpe... (diff)
downloadsystemd-25033cca08485607aacf22ab67baf70e35eae30b.tar.xz
systemd-25033cca08485607aacf22ab67baf70e35eae30b.zip
test-execute: check credentials can be read on ExecStartPost= and friends
Prompted by https://github.com/systemd/systemd/pull/28787#issuecomment-1690614202.
Diffstat (limited to 'test')
-rw-r--r--test/test-execute/exec-credentials-dir-specifier.service6
-rw-r--r--test/test-execute/exec-load-credential.service3
-rw-r--r--test/test-execute/exec-set-credential.service3
3 files changed, 12 insertions, 0 deletions
diff --git a/test/test-execute/exec-credentials-dir-specifier.service b/test/test-execute/exec-credentials-dir-specifier.service
index 818619acaa..5e71eee246 100644
--- a/test/test-execute/exec-credentials-dir-specifier.service
+++ b/test/test-execute/exec-credentials-dir-specifier.service
@@ -10,3 +10,9 @@ ExecStart=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
LoadCredential=very_top_secret
ExecStart=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
ExecStart=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
+ExecStartPost=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
+ExecStartPost=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
+ExecStop=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
+ExecStop=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
+ExecStopPost=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
+ExecStopPost=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
diff --git a/test/test-execute/exec-load-credential.service b/test/test-execute/exec-load-credential.service
index b3e3650075..3a29b6d13d 100644
--- a/test/test-execute/exec-load-credential.service
+++ b/test/test-execute/exec-load-credential.service
@@ -4,5 +4,8 @@ Description=Test for LoadCredential=
[Service]
ExecStart=/bin/sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
+ExecStartPost=/bin/sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
+ExecStop=/bin/sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
+ExecStopPost=/bin/sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
Type=oneshot
LoadCredential=test-execute.load-credential
diff --git a/test/test-execute/exec-set-credential.service b/test/test-execute/exec-set-credential.service
index 2af236dc4b..9db6c5f3d4 100644
--- a/test/test-execute/exec-set-credential.service
+++ b/test/test-execute/exec-set-credential.service
@@ -4,5 +4,8 @@ Description=Test for SetCredential=
[Service]
ExecStart=/bin/sh -x -c 'test "$$(cat %d/test-execute.set-credential)" = "hoge"'
+ExecStartPost=/bin/sh -x -c 'test "$$(cat %d/test-execute.set-credential)" = "hoge"'
+ExecStop=/bin/sh -x -c 'test "$$(cat %d/test-execute.set-credential)" = "hoge"'
+ExecStopPost=/bin/sh -x -c 'test "$$(cat %d/test-execute.set-credential)" = "hoge"'
Type=oneshot
SetCredential=test-execute.set-credential:hoge