feat(mail): send service identity mail through a leased worker

This commit is contained in:
shira committed 2026-10-06 21:08:11 +03:00
1 parent 204c6bae62
commit d21fd49a42
58 files changed
+7577 -164

No files matched your search

@@ -61,3 +61,26 @@ func TestMapDeliveryErrorDropsTheTextOfOtherPostgreSQLErrors(t *testing.T) {
t.Fatalf("mapped error lost the constraint name: %v", err)
}
}
func TestMapDeliveryErrorMarksOnlyDataFaultsAsRowFaults(t *testing.T) {
for code, wantRowFault := range map[string]bool{
"22001": true, // string data right truncation
"23514": true, // check violation
"23505": true, // unique violation without a known constraint
"40P01": false, // deadlock
"40001": false, // serialization failure
"08006": false, // connection failure
"53300": false, // too many connections
"57014": false, // statement timeout (query canceled)
"57P01": false, // admin shutdown
"XX000": false, // internal error
} {
err := mapDeliveryError(&pgconn.PgError{Code: code, ConstraintName: "some_constraint", Message: privateRowValue})
if got := errors.Is(err, outbound.ErrRowFault); got != wantRowFault {
t.Fatalf("SQLSTATE %s: ErrRowFault = %t, want %t", code, got, wantRowFault)
}
if strings.Contains(err.Error(), privateRowValue) {
t.Fatalf("SQLSTATE %s: the error quotes the row", code)
}
}
}