Add code to test users with postmap
postmap
is a command line tool that can be used (pointed at the DB's query configuration files that postfix uses) to do queries.
To make testing user configuration easier, a few things are needed:
- Add a way to specify the default path of
postmap
binary - Add function (part of
SupportsVirtualAliasLookup
trait?) that runs the command - Add the functionality to either
Postfix
(since it's config files must be written out prior) - Expose from CLI, something like
postmgr postfix mailbox-user-test -e <email>
to test that a user is findable by email using virtual alias lookup and what not.
How this test currently goes if run manually (from inside container):
# postmgr postfix db-init
... output ...
# postmgr postfix config generate-files
... output ...
# postmgr postfix mailbox-user-add -e test@example.com -p test
... output ...
# postmap -q test@example.com sqlite:/usr/src/postmgr/infra/runtime/config/postfix/valias_lookup.cf
example.com/test/
The postmap
command returns a 0 code, which shows that the query is working.
Edited by MrMan