From 9a9f25f5eb54b320caeafd83fd514c82f9fc3021 Mon Sep 17 00:00:00 2001 From: gezimbll Date: Thu, 3 Nov 2022 11:48:36 -0400 Subject: [PATCH] coverage tests at engine --- config/objdp_test.go | 3 ++- config/registrarccfg_test.go | 2 +- config/rpcconn_test.go | 3 +-- engine/attributes_test.go | 9 ++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config/objdp_test.go b/config/objdp_test.go index 62b345569..9521bd504 100644 --- a/config/objdp_test.go +++ b/config/objdp_test.go @@ -133,7 +133,8 @@ func TestFieldAsInterfaceObjDPValid1(t *testing.T) { t.Error(err) } else if rcv != 1 { t.Errorf("Expected %+v, received %+v", 1, rcv) - } else if _, err = objDp.FieldAsInterface([]string{"val"}); err == nil && err != utils.ErrNotFound { + } + if _, err = objDp.FieldAsInterface([]string{"val"}); err == nil || err != utils.ErrNotFound { t.Error(err) } } diff --git a/config/registrarccfg_test.go b/config/registrarccfg_test.go index 11836fd54..63f160b30 100644 --- a/config/registrarccfg_test.go +++ b/config/registrarccfg_test.go @@ -32,7 +32,6 @@ func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { Hosts: []*RemoteHostJsonWithTenant{ { - Tenant: utils.StringPointer(utils.MetaDefault), RemoteHostJson: &RemoteHostJson{ Id: utils.StringPointer("Host1"), Transport: utils.StringPointer(utils.MetaJSON), @@ -168,6 +167,7 @@ func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { } else if !reflect.DeepEqual(expected, jsnCfg.registrarCCfg) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(jsnCfg.registrarCCfg)) } + } func TestDispatcherHCfgAsMapInterface(t *testing.T) { diff --git a/config/rpcconn_test.go b/config/rpcconn_test.go index 9a4d0bb29..f48e9e48f 100644 --- a/config/rpcconn_test.go +++ b/config/rpcconn_test.go @@ -192,12 +192,11 @@ func TestRPCConnsAsMapInterface(t *testing.T) { "key_path": "path_to_key", "cert_path": "path_to_cert", "ca_path": "path_to_ca", - "connect_attempts": 5, "reconnects": 3, "connect_timeout": "1m", "reply_timeout": "1m", "max_reconnect_interval":"1m", - + } ], diff --git a/engine/attributes_test.go b/engine/attributes_test.go index 0c476b415..1a8a86fa4 100644 --- a/engine/attributes_test.go +++ b/engine/attributes_test.go @@ -1003,8 +1003,15 @@ func TestAttributesParseAttributeSIPCID(t *testing.T) { InfieldSep), 0, utils.EmptyString, utils.EmptyString, utils.InfieldSep); err != utils.ErrNotFound { t.Errorf("Expected <%+v>, received <%+v>", utils.ErrNotFound, err) } -} + if _, err := ParseAttribute(dp, utils.MetaNone, utils.EmptyString, config.NewRSRParsersMustCompile("~*req.cid;~*req.extra;~*req.to;~*req.from", utils. + InfieldSep), 0, utils.EmptyString, utils.EmptyString, utils.InfieldSep); err != nil { + t.Errorf("received <%+v>", err) + } else if _, err = ParseAttribute(dp, utils.MetaUsageDifference, utils.EmptyString, config.NewRSRParsersMustCompile("~*req.cid;~*req.extra;~*req.to;~*req.from", utils. + InfieldSep), 0, utils.EmptyString, utils.EmptyString, utils.InfieldSep); err == nil { + t.Errorf("received <%+v>", err) + } +} func TestAttributesParseAttributeSIPCIDWrongPathErr(t *testing.T) { dp := utils.MapStorage{ utils.MetaReq: utils.MapStorage{