From c3ee52b6c9ea11ee5c2eb3688a2eb2292059a194 2023-12-07 22:26:41 From: Branko Majic Date: 2023-12-07 22:26:41 Subject: [PATCH] MAR-189: Refactor test for additional SMTP server configuration: - Use different override to avoid Postfix warnings about overridden configuration option in the same file. --- diff --git a/roles/mail_server/molecule/default/group_vars/parameters-optional.yml b/roles/mail_server/molecule/default/group_vars/parameters-optional.yml index 247bcf7c5b0ebed71808fd75a0ecb8908dc2ec09..3f94dca6e0a718e9cdc47a94387e915e496d806a 100644 --- a/roles/mail_server/molecule/default/group_vars/parameters-optional.yml +++ b/roles/mail_server/molecule/default/group_vars/parameters-optional.yml @@ -31,7 +31,7 @@ smtp_allow_relay_from: - "{{ release_based_smtp_allow_relay_from[ansible_distribution_release] }}" mail_message_size_limit: 20480001 mail_server_smtp_additional_configuration: | - smtpd_banner = $myhostname ESMTP My SMTP Server + mail_name = MySMTP smtp_skip_5xx_greeting = no # Variables dependant on distribution release. diff --git a/roles/mail_server/molecule/default/tests/test_optional.py b/roles/mail_server/molecule/default/tests/test_optional.py index 8e893c59feaeb88c0227723ab3c31582ebf06ecd..80e2045fe0b9ba99aa8fac60a308ba2ba832c166 100644 --- a/roles/mail_server/molecule/default/tests/test_optional.py +++ b/roles/mail_server/molecule/default/tests/test_optional.py @@ -218,7 +218,7 @@ def test_smtp_additional_configuration_present_in_file(host): config = host.file("/etc/postfix/main.cf") - assert "smtpd_banner = $myhostname ESMTP My SMTP Server" in config.content_string + assert "mail_name = MySMTP" in config.content_string assert "smtp_skip_5xx_greeting = no" in config.content_string @@ -230,4 +230,4 @@ def test_smtp_additional_configuration_active(host): command = host.run('swaks --quit-after BANNER --to root@localhost') - assert "ESMTP My SMTP Server" in command.stdout + assert "ESMTP MySMTP (Debian/GNU)" in command.stdout