Files
selfpost/test/e2e/wait.go
T
mix 8ce050ef7f release: 0.1.0: Phases 0-11: panel, Postfix/DKIM, milter, backup, Docker image
Initial feature-complete implementation of the v1.0 specification (phases 0-11 of `docs/implementation-plan.md`).
Added:
  - Panel (Go, single static binary) with SQLite persistence, one-time
  - Domain management with per-domain DKIM (RSA-2048, generated in pure Go) and
  - Application (sender identity) management: SASL credentials via `sasldb2`,
  - Full Postfix relay config generated from env at container start: SMTPS 465,
  - Journal milter (pure Go, `go-milter`) recording every send to `send_log`;
  … (6 more in CHANGELOG)

Full detail: CHANGELOG.md (0.1.0).
2026-09-22 15:24:51 +03:00

30 lines
834 B
Go

package e2e
import (
"fmt"
"time"
)
// waitFor polls check every interval until it returns true or timeout elapses.
// Every wait in this suite goes through here — no fixed sleeps standing in for
// a readiness check (plan C.4): a passing check ends the wait immediately, and
// a timeout fails with what was being waited for, not a bare "timed out".
func waitFor(what string, timeout, interval time.Duration, check func() (bool, error)) error {
deadline := time.Now().Add(timeout)
var lastErr error
for {
ok, err := check()
if ok {
return nil
}
lastErr = err
if time.Now().After(deadline) {
if lastErr != nil {
return fmt.Errorf("timed out after %s waiting for %s: %w", timeout, what, lastErr)
}
return fmt.Errorf("timed out after %s waiting for %s", timeout, what)
}
time.Sleep(interval)
}
}