mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
queue: Support sending to pipes
With the introduction of aliases, the queue may now be delivering mail to pipes. This patch implements pipe delivery. It uses a fixed 30s timeout for now, as these commands should really not take much time, and we don't want to overly complicate the configuration for now.
This commit is contained in:
@@ -135,3 +135,27 @@ func TestFullQueue(t *testing.T) {
|
||||
}
|
||||
q.Remove(id)
|
||||
}
|
||||
|
||||
func TestPipes(t *testing.T) {
|
||||
q := New("/tmp/queue_test", set.NewString("loco"))
|
||||
item := &Item{
|
||||
Message: Message{
|
||||
ID: <-newID,
|
||||
From: "from",
|
||||
Rcpt: []*Recipient{
|
||||
{"true", Recipient_PIPE, Recipient_PENDING}},
|
||||
Data: []byte("data"),
|
||||
},
|
||||
CreatedAt: time.Now(),
|
||||
}
|
||||
|
||||
if err := item.deliver(q, item.Rcpt[0]); err != nil {
|
||||
t.Errorf("pipe delivery failed: %v", err)
|
||||
}
|
||||
|
||||
// Make the command "false", should fail.
|
||||
item.Rcpt[0].Address = "false"
|
||||
if err := item.deliver(q, item.Rcpt[0]); err == nil {
|
||||
t.Errorf("pipe delivery worked, expected failure")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user