Skip to content

Commit

Permalink
Testing relay to next SMTP
Browse files Browse the repository at this point in the history
  • Loading branch information
chkpnt committed May 2, 2019
1 parent 4581301 commit 416f4a4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ There is a [`Makefile`](Makefile) which can be used to setup the Vagrant environ
| ID | Purpose |
|-----|--------------------------------|
| 00* | Authentication against Postfix |
| 10* | Postfix access table |
| 11* | Postfix remote delivery |
| 22* | DKIM stuff |
| 55* | Postfix access table |

### Vagrant environment

Expand Down
8 changes: 7 additions & 1 deletion tests/testfixtures/vms/sut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
mail_mailboxes:
- { name: 'john.doe@mydomain.test', path: '/srv/mail/john' }
mail_aliases:
- { for: '@mydomain.test', destination: 'john.doe@example.com' }
# Needed for mail_transports, otherwise the catch-all would match:
- { for: 'remote-delivery@mydomain.test', destination: 'remote-delivery@mydomain.test' }
# Catch-all:
- { for: '@mydomain.test', destination: 'john.doe@ydomain.test' }
mail_recipient_access:
- for: 'reject@mydomain.test'
action: 'REJECT This address is not supposed to receive mails!'
mail_transports:
- for: 'remote-delivery@mydomain.test'
nexthop: 'smtp:theirdomain.test'
27 changes: 27 additions & 0 deletions tests/tests/111_RelayToNextSmtpHop/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
- import_playbook: ../prepare/mail-sink.yml

- hosts: client
tasks:
- name: Send a mail from client to an address that is relayed to another SMTP
shell: |
echo "Test-Body" | mailx -s "Test" remote-delivery@mydomain.test
- hosts: mail-sink
tasks:
- name: Assert mail is received by the next SMTP hop
compare:
file: /tmp/maildump
with_content: |+
...
Received: from sut.mydomain.test ([10.0.3.10])
...
Received: from client.localdomain (unknown [10.0.3.201])
...
To: remote-delivery@mydomain.test
Subject: Test
...
From: vagrant@client.localdomain
Test-Body

0 comments on commit 416f4a4

Please sign in to comment.