25 lines
672 B
Go
25 lines
672 B
Go
package dispatcher
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"git.ipao.vip/rogee/go-sip/internal/contract"
|
|
"git.ipao.vip/rogee/go-sip/internal/mq"
|
|
)
|
|
|
|
func TestPermanentCommandClassification(t *testing.T) {
|
|
if !isPermanentCommandError(contract.ErrInvalidTenantKey) {
|
|
t.Fatal("tenant validation must be permanent")
|
|
}
|
|
if !isPermanentCommandError(errors.New("mq schema validation: required field")) {
|
|
t.Fatal("schema validation must be permanent")
|
|
}
|
|
if isPermanentCommandError(errors.New("sqlite busy")) {
|
|
t.Fatal("storage failure must be retried")
|
|
}
|
|
if !mq.IsPermanent(mq.Permanent(contract.ErrInvalidTenantKey)) {
|
|
t.Fatal("permanent wrapper was not recognized")
|
|
}
|
|
}
|