add "mox localserve" subcommand, for running mox locally for email-related testing/developing

localserve creates a config for listening on localhost for
imap/smtp/submission/http, on port numbers 1000 + the common service port
numbers. all incoming email is accepted (if checks pass), and a few pattern in
localparts are recognized and result in delivery errors.
This commit is contained in:
Mechiel Lukkien
2023-03-12 10:38:02 +01:00
parent bddc8e4062
commit 0099197d00
12 changed files with 694 additions and 108 deletions

View File

@ -39,8 +39,6 @@ func tcheck(t *testing.T, err error, msg string) {
// We check if we receive the message.
func TestDeliver(t *testing.T) {
mlog.Logfmt = true
mox.Context, mox.ContextCancel = context.WithCancel(context.Background())
mox.Shutdown, mox.ShutdownCancel = context.WithCancel(context.Background())
// Remove state.
os.RemoveAll("testdata/integration/data")
@ -53,7 +51,7 @@ func TestDeliver(t *testing.T) {
// Load mox config.
mox.ConfigStaticPath = "testdata/integration/config/mox.conf"
filepath.Join(filepath.Dir(mox.ConfigStaticPath), "domains.conf")
if errs := mox.LoadConfig(mox.Context, false); len(errs) > 0 {
if errs := mox.LoadConfig(context.Background(), false); len(errs) > 0 {
t.Fatalf("loading mox config: %v", errs)
}