postfix/Sanity/default-map-type/test.sh
2024-07-25 19:20:16 +00:00

32 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
rlAssertRpm "postfix"
# postfix-lmdb presented on rhel9.3 and higher, but default only on rhel10/c10s and higher and fedora
(rlIsRHEL '>=9.3' || rlIsFedora || rlIsCentOS '>=9') && rlAssertRpm "postfix-lmdb"
rlFileBackup --clean /etc/postfix
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd $tmp"
rlPhaseEnd
rlPhaseStartTest
rlRun "echo \"test_key test_value\" > /etc/postfix/test" 0 "Creating config"
rlRun "postmap /etc/postfix/test &> postmap.log" 0 "Running postmap"
if rlIsRHELLike '<10' || rlIsFedora; then
rlAssertExists "/etc/postfix/test.db"
else
rlAssertExists "/etc/postfix/test.lmdb"
fi
rlAssertNotGrep "postmap: fatal: unsupported map type: hash" postmap.log
rlPhaseEnd
rlPhaseStartCleanup
rlFileRestore
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd