mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Covered errors to 100%
This commit is contained in:
committed by
Dan Christian Bogos
parent
2c81729e02
commit
50789d6000
@@ -208,6 +208,10 @@ func TestIsNetworkError(t *testing.T) {
|
||||
if !IsNetworkError(err) {
|
||||
t.Errorf("syscall.ECONNRESET should be consider a network error")
|
||||
}
|
||||
err = &net.DNSError{Err: "DNSError"}
|
||||
if !IsNetworkError(err) {
|
||||
t.Errorf("DNSError should be consider a network error")
|
||||
}
|
||||
err = fmt.Errorf("NOT_FOUND")
|
||||
if IsNetworkError(err) {
|
||||
t.Errorf("%s error should not be consider a network error", err)
|
||||
@@ -238,6 +242,27 @@ func TestNewErrChargerS(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewErrStatS(t *testing.T) {
|
||||
expected := "STATS_ERROR:NOT_FOUND"
|
||||
if rcv := NewErrStatS(ErrNotFound); rcv.Error() != expected {
|
||||
t.Errorf("Expecetd %+q, receiveed %+q", expected, rcv.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewErrCDRS(t *testing.T) {
|
||||
expected := "CDRS_ERROR:NOT_FOUND"
|
||||
if rcv := NewErrCDRS(ErrNotFound); rcv.Error() != expected {
|
||||
t.Errorf("Expected %+q, received %+q", expected, rcv.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewErrThresholdS(t *testing.T) {
|
||||
expected := "THRESHOLDS_ERROR:NOT_FOUND"
|
||||
if rcv := NewErrThresholdS(ErrNotFound); rcv.Error() != expected {
|
||||
t.Errorf("Expected %+q, received %+q", expected, rcv.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewSTIRError(t *testing.T) {
|
||||
expected := `*stir_authenticate: wrong header`
|
||||
if rcv := NewSTIRError("wrong header"); rcv.Error() != expected {
|
||||
|
||||
Reference in New Issue
Block a user