test(mail): derive the mail sender clock from the current date

This commit is contained in:
shira committed 2026-10-09 17:16:56 +03:00
1 parent a38d7571ea
commit c410636b7f
3 files changed
+105 -4

No files matched your search

@@ -140,6 +140,16 @@ func (server *Server) Script(replies ...Reply) {
server.scripted = append(server.scripted, replies...)
}
// ClearScript drops the queued answers that no call has used and returns
// their number, so a test that stops early does not hand them to the next one.
func (server *Server) ClearScript() int {
server.mu.Lock()
defer server.mu.Unlock()
left := len(server.scripted)
server.scripted = nil
return left
}
// SetDelay makes the fixture wait before it answers every later call, so a
// test can act while a send is in flight.
func (server *Server) SetDelay(delay time.Duration) { server.delay.Store(int64(delay)) }