]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: a credential can be imported multiple times with different names
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 3 Aug 2024 05:22:37 +0000 (14:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 3 Aug 2024 05:23:17 +0000 (14:23 +0900)
This is supported since 831f208783aeac443e6f2fc2efc3119535a032ef.
Let's explicitly test the functionality.

test/units/TEST-54-CREDS.sh

index aa0a1329e0e7a46df5dd283334ce244376d1b166..f0e69328258882379ed5738f2dc4ab395dd0873b 100755 (executable)
@@ -332,6 +332,19 @@ systemd-run -p "ImportCredentialEx=test.creds.first:renamed.creds.first" \
             cat '${CREDENTIALS_DIRECTORY}/renamed.creds.first' >/tmp/ts54-concat
 cmp /tmp/ts54-concat <(echo -n a)
 
+# Test that a credential can be imported multiple times with different names.
+systemd-run -p "ImportCredentialEx=test.creds.first" \
+            -p "ImportCredentialEx=test.creds.first:renamed.creds.first" \
+            -p "ImportCredentialEx=test.creds.first:renamed.creds.second" \
+            --unit=test-54-ImportCredential.service \
+            -p DynamicUser=1 \
+            --wait \
+            --pipe \
+            cat '${CREDENTIALS_DIRECTORY}/test.creds.first' \
+                '${CREDENTIALS_DIRECTORY}/renamed.creds.first' \
+                '${CREDENTIALS_DIRECTORY}/renamed.creds.second' >/tmp/ts54-concat
+cmp /tmp/ts54-concat <(echo -n aaa)
+
 # Now test encrypted credentials (only supported when built with OpenSSL though)
 if systemctl --version | grep -q -- +OPENSSL ; then
     echo -n $RANDOM >/tmp/test-54-plaintext