Skip to content

Commit

Permalink
enh: add tests for multiple gpg keys setup
Browse files Browse the repository at this point in the history
  • Loading branch information
speed47 committed Oct 25, 2023
1 parent d9431b6 commit 6ff1990
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/functional/launch_tests_on_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,68 @@ LicUjkm1z+cdyt8b5qQnbFW1OjYtbkZIBz3wrB0L2tiuks9PckuiYFT9DzyoGwyt
4fa+23uEetbTatxVLjJDOPGTsSwk7YlU+36568JzzvTK
=hEcM
-----END PGP PUBLIC KEY BLOCK-----
'
# 25305EA2FCA333C4
admins_gpg_key_pub_2='
-----BEGIN PGP PUBLIC KEY BLOCK-----
mI0EZTjYygEEAMbJBg+8/bKtsWif5I/EaoNYhY4dPJ2wc4rg/6JJFTvXQP5hCP5S
9vUyw/PW1Lho8fYNbTOFdgI0lbi0HObTuy1oMPRmBdMFppUbA06RcYImCB+ueZgN
F4TYXtleF26xasOSuf+k7lH8FrSfdnDxE/3+xddWUReTCs+Z5o/odTItABEBAAG0
JWJhc3Rpb24gdGVzdHMgNiA8YmFzdGlvbkBleGFtcGxlLm9yZz6I1AQTAQoAPhYh
BCRiNpSK15lfa7/YoiUwXqL8ozPEBQJlONjKAhsDBQkDwmcABQsJCAcCBhUKCQgL
AgQWAgMBAh4BAheAAAoJECUwXqL8ozPE7QEEAIcgxxBkn66ibzGfHFTwBg5mOEsh
CVOKkLms+5T22EgwgD5IVusYkHuwzPLpzvIHbm49Q2zZpoWzz/D+A8WhlB1hf1hD
MEs/zwyji35LzxENL3sGm+PaADzQpj/2BFNr+KkLvDtP+ly1DqoDsWB5VlKRTcej
fKo/0fnlgVgUH9QWuI0EZTjamwEEAM6tWi1JeLKKn3dXy4W/tgWcG8qkLnk1IBsT
ADRPMhmRpevfDEf93L9E/Nb4hNHOXtI4H93ZI1V3xsqLtZn7Vp5xtf8hRUgySyeJ
BUvcZCSn8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IBYhBAB98E297Qm/EV76+uxs6mcZ7zcABQJl
ONq+AhsMAAoJEOxs6mcZ7zcAATgD/3tFCp1GszTi935QMXCNZpZY09QdncgXKVy9
jcJ2pnpER/7t2Pm6Zqu0UZdWHuAIP+lPTgL8Bf0UAmF+h7jIOwr0n76NvPiHNW1X
Gx+RVkNPSEbTH0bWdsyV8LE+E0NowoUaVsjWMzq+QZY+wjrURSWC2iLC1yDb+EPd
kTfIwdES
=ZNGF
-----END PGP PUBLIC KEY BLOCK-----
'
};

Expand Down
29 changes: 29 additions & 0 deletions tests/functional/tests.d/200-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,35 @@ testsuite_scripts()
contain "Paste the admins"
contain "50-gpg-admins-key.conf updated:"
contain "50-gpg.conf updated:"
contain "Parsed and added 1 keys"
contain "GPGKEYS='1B72FD2C2215EA44'"
contain '[ "1B72FD2C2215EA44" ]'
nocontain "WARN:"
nocontain "ERROR:"
nocontain "Unexpected termination"

script setup_keys_import_2 $r0 "\"echo '$admins_gpg_key_pub_2' | /opt/bastion/bin/admin/setup-gpg.sh --import --overwrite\""
retvalshouldbe 0
contain "Paste the admins"
contain "50-gpg-admins-key.conf already exists, but overwriting"
contain "50-gpg.conf already exists, but overwriting"
contain "Parsed and added 1 keys"
contain "GPGKEYS='25305EA2FCA333C4'"
contain '[ "25305EA2FCA333C4" ]'
nocontain "WARN:"
nocontain "ERROR:"
nocontain "Unexpected termination"

success setup_keys_clear $r0 "\"rm -f $opt_remote_etc_bastion/osh-encrypt-rsync.conf.d/50-gpg-admins-key.conf $opt_remote_etc_bastion/osh-backup-acl-keys.conf.d/50-gpg.conf\""

script setup_keys_import_3 $r0 "\"echo '$admins_gpg_key_pub_double' | /opt/bastion/bin/admin/setup-gpg.sh --import\""
retvalshouldbe 0
contain "Paste the admins"
contain "50-gpg-admins-key.conf updated:"
contain "50-gpg.conf updated:"
contain "Parsed and added 2 keys"
contain "GPGKEYS='CF27BEC1C8266FFE EC6CEA6719EF3700'"
contain '[ "CF27BEC1C8266FFE", "EC6CEA6719EF3700" ]'
nocontain "WARN:"
nocontain "ERROR:"
nocontain "Unexpected termination"
Expand Down

0 comments on commit 6ff1990

Please sign in to comment.