Updated integration tests

This commit is contained in:
Trial97
2021-01-26 12:47:59 +02:00
committed by Dan Christian Bogos
parent 0d7ae998d4
commit 0b062d87ec
7 changed files with 12 additions and 138 deletions

View File

@@ -196,6 +196,8 @@ func testAnalyzerSChargerSv1ProcessEvent(t *testing.T) {
}
func testAnalyzerSV1Search(t *testing.T) {
// need to wait in order for the log gorutine to execute
time.Sleep(10 * time.Millisecond)
var result []map[string]interface{}
if err := anzRPC.Call(utils.AnalyzerSv1StringQuery, &QueryArgs{HeaderFilters: `+RequestEncoding:\*internal +RequestMethod:AttributeSv1\.ProcessEvent`}, &result); err != nil {
t.Error(err)

View File

@@ -740,7 +740,7 @@ func main() {
}()
select {
case <-shtdDone:
case <-time.After(10 * time.Second): //cfg.CoreSCfg().ShutdownTimeout):
case <-time.After(cfg.CoreSCfg().ShutdownTimeout):
utils.Logger.Err(fmt.Sprintf("<%s> Failed to shutdown all subsystems in the given time",
utils.ServiceManager))
}

View File

@@ -242,13 +242,13 @@ func TestNMAsXMLElements(t *testing.T) {
func TestNMAsCGREvent(t *testing.T) {
if cgrEv := NMAsCGREvent(nil, "cgrates.org",
utils.NestingSep,nil); cgrEv != nil {
utils.NestingSep, nil); cgrEv != nil {
t.Errorf("expecting: %+v, \nreceived: %+v", utils.ToJSON(nil), utils.ToJSON(cgrEv.Event))
}
nM := utils.NewOrderedNavigableMap()
if cgrEv := NMAsCGREvent(nM, "cgrates.org",
utils.NestingSep,nil); cgrEv != nil {
utils.NestingSep, nil); cgrEv != nil {
t.Errorf("expecting: %+v, \nreceived: %+v", utils.ToJSON(nil), utils.ToJSON(cgrEv.Event))
}
@@ -329,8 +329,8 @@ func TestNMAsCGREvent(t *testing.T) {
"FirstLevel2.Field6": "Value6",
"Field4": "Val4",
}
if cgrEv := NMAsCGREvent(nM, "cgrates.org",
utils.NestingSep,utils.NewOrderedNavigableMap()); cgrEv.Tenant != "cgrates.org" ||
if cgrEv := NMAsCGREvent(nM, "cgrates.org",
utils.NestingSep, utils.NewOrderedNavigableMap()); cgrEv.Tenant != "cgrates.org" ||
cgrEv.Time == nil ||
!reflect.DeepEqual(eEv, cgrEv.Event) {
t.Errorf("expecting: %+v, \nreceived: %+v", utils.ToJSON(eEv), utils.ToJSON(cgrEv.Event))

View File

@@ -1,132 +0,0 @@
{
// CGRateS Configuration file
"general": {
"log_level": 7,
"reply_timeout": "30s",
},
"listen": {
"rpc_json": ":2012",
"rpc_gob": ":2013",
"http": ":2080",
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true,
"thresholds_conns": ["*internal"],
"max_increments":3000000,
},
"schedulers": {
"enabled": true,
"cdrs_conns": ["*localhost"],
},
"cdrs": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"resources": {
"enabled": true,
"store_interval": "1s",
"thresholds_conns": ["*internal"]
},
"stats": {
"enabled": true,
"store_interval": "1s",
"thresholds_conns": ["*internal"],
},
"thresholds": {
"enabled": true,
"store_interval": "1s",
},
"routes": {
"enabled": true,
"stats_conns": ["*localhost"],
"resources_conns": ["*localhost"],
"rals_conns": ["*internal"],
},
"attributes": {
"enabled": true,
"stats_conns": ["*localhost"],
"resources_conns": ["*localhost"],
"apiers_conns": ["*localhost"]
},
"sessions": {
"enabled": true,
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"],
},
"migrator": {
"out_datadb_type": "mongo",
"out_datadb_port": "27017",
"out_datadb_name": "10",
"out_stordb_type": "mongo",
"out_stordb_port": "27017",
"out_stordb_name": "cgrates",
"users_filters":["Account"],
},
"apiers": {
"enabled": true,
"scheduler_conns": ["*internal"],
},
"rates": {
"enabled": true
},
"filters": {
"apiers_conns": ["*internal"],
},
"analyzers":{ // AnalyzerS config
"enabled": true, // starts AnalyzerS service: <true|false>.
},
}

View File

@@ -23,6 +23,7 @@ package dispatchers
import (
"fmt"
"testing"
"time"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
@@ -190,6 +191,7 @@ func testDspResponderBroadcast(t *testing.T) {
t.Errorf("Expected error: %s received error: %v and reply %q", utils.ErrPartiallyExecuted.Error(), err, pingReply)
}
allEngine.stopEngine(t)
time.Sleep(10 * time.Millisecond)
pingReply = ""
if err := dispEngine.RPC.Call(utils.ResponderPing, pingEv, &pingReply); err == nil ||
!rpcclient.IsNetworkError(err) {

View File

@@ -61,7 +61,7 @@ func TestAnalyzerSReload(t *testing.T) {
var reply string
if err := cfg.V1ReloadConfig(&config.ReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "analyzers_it_test"),
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "analyzers"),
Section: config.AnalyzerCfgJson,
}, &reply); err != nil {
t.Error(err)

View File

@@ -27,6 +27,7 @@ import (
"runtime"
"strings"
"testing"
"time"
)
var (
@@ -192,6 +193,7 @@ func testCriticalLogger(t *testing.T) {
if err := writer.Close(); err != nil {
t.Error(err)
}
time.Sleep(100 * time.Millisecond)
if err := l.Close(); err != nil {
t.Error(err)
}