lab7: безопасность, mTLS, OpenBao и PKI lifecycle
Application / Go invariants and static checks (pull_request) Canceled after 0s
Application / Lab7 verified TLS and retained features (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Vladislav Kunetskiy
2026-11-10 14:39:57 +03:00
parent 20afc2c790
commit 1b6e96ccc0
570 changed files with 298308 additions and 137 deletions
+34
View File
@@ -0,0 +1,34 @@
package worker
import (
"context"
"errors"
"testing"
"mtusi-messenger/internal/domain"
)
func TestClassifyFailure(t *testing.T) {
t.Parallel()
tests := []struct {
name string
err error
wantCode string
permanent bool
}{
{name: "typed permanent", err: permanentError{code: "invalid_image", err: errors.New("bad")}, wantCode: "invalid_image", permanent: true},
{name: "validation", err: domain.ErrValidation, wantCode: "invalid_image", permanent: true},
{name: "deadline", err: context.DeadlineExceeded, wantCode: "processing_timeout", permanent: false},
{name: "transient", err: errors.New("temporary"), wantCode: "processing_failed", permanent: false},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
code, permanent := classifyFailure(test.err)
if code != test.wantCode || permanent != test.permanent {
t.Fatalf("classifyFailure() = (%q, %v), want (%q, %v)", code, permanent, test.wantCode, test.permanent)
}
})
}
}