Testing

<!-- NOTES - Notes here --> <!-- GOAL ONE-LINER --> <p>Verify whether Postfix has been correctly configured for MySQL usage.</p> <!-- RATIONALE --> <p><code>postmap</code> can query Postfix via the CLI, using a specific Postfix configuration file. This allows - per configuration file defined in <a href="/mailserver/postfix-mysql-config/testing/Mail-server_Postfix-MySQL-configuration">Postfix-MySQL configuration</a> and assuming the <a href="/mailserver/postfix-mysql-config/testing/Mail-server_Example-data-import">test data imported earlier</a> - verification whether the configuration files contain the correct information.</p> <!-- NUANCE --> <blockquote> <p>:information_source: <em>The catch-all is verified by checking the literal <code>@example.org</code> entry in the alias table.</em></p> </blockquote> <h2>Procedure</h2> <!-- NARRATIVE FORM --> <!-- STEP BY STEP --> <ol> <li> <p>Execute the following tests (<code>PASSED</code> reflects correct operation)</p> <pre><code class="language-shell"># Verify whether Postfix correctly (in)validates domain names test 1 -eq `postmap -q example.org mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf` &amp;&amp; echo PASSED || echo FAILED test -z `postmap -q example.com mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf` &amp;&amp; echo PASSED || echo FAILED # Verify whether Postfix correctly (in)validates email addresses test 1 -eq `postmap -q john.doe@example.org mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf` &amp;&amp; echo PASSED || echo test -z `postmap -q john.doe@example.com mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf` &amp;&amp; echo PASSED || echo FAILED # Verify whether Postfix correctly resolves aliases test john.doe@example.org = `postmap -q jane.doe@example.org mysql:/etc/postfix/mysql-virtual-alias-maps.cf` &amp;&amp; echo PASSED || echo FAILED test jack.doe@example.org = `postmap -q @example.org mysql:/etc/postfix/mysql-virtual-alias-maps.cf` &amp;&amp; echo PASSED || echo FAILED test -z `postmap -q foo.bar@example.com mysql:/etc/postfix/mysql-virtual-alias-maps.cf` &amp;&amp; echo PASSED || echo FAILED # Verify whether Postfix correctly resolves mail2mail requests test john.doe@example.org = `postmap -q john.doe@example.org mysql:/etc/postfix/mysql-email2email.cf` &amp;&amp; echo PASSED || echo FAILED test -z `postmap -q jane.doe@example.org mysql:/etc/postfix/mysql-email2email.cf` &amp;&amp; echo PASSED || echo FAILED</code></pre> </li> </ol> <blockquote> <p>:bulb: Issue the following command to download and run all tests using a script:</p> <pre><code class="language-shell">wget -qO- https://raw.githubusercontent.com/SomethingWithHorizons/mailserver/master/tests/postfix-mysql.sh | bash</code></pre> </blockquote> <!-- REFERENCES -->