package scans import ( "errors" "testing" ) func TestIsStoreCapacityOrConnExhausted(t *testing.T) { if !isStoreCapacityOrConnExhausted(errors.New(`FATAL: sorry, too many clients already (SQLSTATE 53300)`)) { t.Fatal("expected too many clients") } if !isStoreCapacityOrConnExhausted(errors.New(`remaining connection slots are reserved for roles`)) { t.Fatal("expected reserved slots") } if isStoreCapacityOrConnExhausted(errors.New("duplicate key value violates unique constraint")) { t.Fatal("unexpected match for unrelated error") } if isStoreCapacityOrConnExhausted(nil) { t.Fatal("nil should be false") } }