1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-23 15:37:01 +00:00

smtpsrv: Disable SPF lookups in tests

When testing, we don't want the server to do SPF lookups, as those cause
real DNS queries which can be problematic and add a dependency on the
environment.

This patch adds an internal boolean to disable the SPF lookups, which is
only set from the tests.
This commit is contained in:
Alberto Bertogli
2016-11-22 22:05:07 +00:00
parent b1a29d8194
commit de09923933
2 changed files with 10 additions and 0 deletions

View File

@@ -453,6 +453,9 @@ func realMain(m *testing.M) int {
s.AddDomain("localhost")
s.AddUserDB("localhost", udb)
// Disable SPF lookups, to avoid leaking DNS queries.
disableSPFForTesting = true
go s.ListenAndServe()
}