Revise tests

This commit is contained in:
arberkatellari
2025-06-04 13:01:43 +02:00
committed by Dan Christian Bogos
parent 9b08994b5e
commit 746846eaaf
29 changed files with 273 additions and 70 deletions

View File

@@ -110,9 +110,12 @@ var (
func TestRsV1IT(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
rlsV1ConfDIR = "tutinternal"
sTestsRLSV1 = sTestsRLSV1[:len(sTestsRLSV1)-24]
rlsV1ConfDIR = "tutinternal_offline"
defer func() {
if err := os.RemoveAll("/tmp/internal_db"); err != nil {
t.Error(err)
}
}()
case utils.MetaMySQL:
rlsV1ConfDIR = "tutmysql"
case utils.MetaMongo:
@@ -133,6 +136,14 @@ func testV1RsLoadConfig(t *testing.T) {
if rlsV1Cfg, err = config.NewCGRConfigFromPath(rlsV1CfgPath); err != nil {
t.Error(err)
}
if *utils.DBType == utils.MetaInternal {
if err := os.MkdirAll(rlsV1Cfg.DataDbCfg().Opts.InternalDBDumpPath, 0755); err != nil {
t.Fatal(err)
}
if err := os.MkdirAll(rlsV1Cfg.StorDbCfg().Opts.InternalDBDumpPath, 0755); err != nil {
t.Fatal(err)
}
}
}
func testV1RsInitDataDb(t *testing.T) {

View File

@@ -68,7 +68,6 @@ var sTestSessionSv1ProcessEvent = []func(t *testing.T){
func TestSSv1ItProcessEventWithPrepaid(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
sessionsConfDIR = "sessions_internal"
case utils.MetaMySQL:
sessionsConfDIR = "sessions_mysql"
@@ -89,7 +88,6 @@ func TestSSv1ItProcessEventWithPrepaid(t *testing.T) {
func TestSSv1ItProcessEventWithPostPaid(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
sessionsConfDIR = "sessions_internal"
case utils.MetaMySQL:
sessionsConfDIR = "sessions_mysql"
@@ -111,7 +109,6 @@ func TestSSv1ItProcessEventWithPostPaid(t *testing.T) {
func TestSSv1ItProcessEventWithRated(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
sessionsConfDIR = "sessions_internal"
case utils.MetaMySQL:
sessionsConfDIR = "sessions_mysql"
@@ -133,7 +130,6 @@ func TestSSv1ItProcessEventWithRated(t *testing.T) {
func TestSSv1ItProcessEventWithPseudoPrepaid(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
sessionsConfDIR = "sessions_internal"
case utils.MetaMySQL:
sessionsConfDIR = "sessions_mysql"

View File

@@ -67,7 +67,6 @@ var (
func TestSessionSITtests(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
sessionsConfDIR = "sessions_internal"
case utils.MetaMySQL:
sessionsConfDIR = "sessions_mysql"

View File

@@ -107,9 +107,6 @@ func TestSSv1ItWithPrepaid(t *testing.T) {
if *utils.DBType == utils.MetaPostgres {
t.SkipNow()
}
if *utils.DBType == utils.MetaInternal {
t.Skip("unfinished, resources solution needed")
}
sSV1RequestType = utils.MetaPrepaid
for _, stest := range sTestSessionSv1 {
t.Run(sSV1RequestType, stest)
@@ -120,9 +117,6 @@ func TestSSv1ItWithPostPaid(t *testing.T) {
if *utils.DBType == utils.MetaPostgres {
t.SkipNow()
}
if *utils.DBType == utils.MetaInternal {
t.Skip("unfinished, resources solution needed")
}
sSV1RequestType = utils.MetaPostpaid
for _, stest := range sTestSessionSv1 {
t.Run(sSV1RequestType, stest)
@@ -133,9 +127,6 @@ func TestSSv1ItWithRated(t *testing.T) {
if *utils.DBType == utils.MetaPostgres {
t.SkipNow()
}
if *utils.DBType == utils.MetaInternal {
t.Skip("unfinished, resources solution needed")
}
sSV1RequestType = utils.MetaRated
for _, stest := range sTestSessionSv1 {
t.Run(sSV1RequestType, stest)
@@ -146,9 +137,6 @@ func TestSSv1ItWithPseudoPrepaid(t *testing.T) {
if *utils.DBType == utils.MetaPostgres {
t.SkipNow()
}
if *utils.DBType == utils.MetaInternal {
t.Skip("unfinished, resources solution needed")
}
sSV1RequestType = utils.MetaPseudoPrepaid
for _, stest := range sTestSessionSv1 {
t.Run(sSV1RequestType, stest)

View File

@@ -387,7 +387,6 @@ func testCgrLdrGetStatsProfileAfterLoad(t *testing.T) {
ActivationInterval: &utils.ActivationInterval{
ActivationTime: time.Date(2014, time.July, 29, 15, 0, 0, 0, time.UTC),
},
Stored: true,
}
var replySts *engine.StatQueueProfile
if err := cgrLdrRPC.Call(context.Background(), utils.APIerSv1GetStatQueueProfile,

View File

@@ -2,7 +2,6 @@
"general": {
"log_level": 7,
"reply_timeout": "10s",
},
"data_db": {

View File

@@ -0,0 +1,65 @@
{
// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
// Copyright (C) ITsysCOM GmbH
"general": {
"log_level": 7,
"node_id":"BackupSessionsNode",
},
"data_db": {
"db_type": "*internal",
"opts":{
"internalDBDumpPath": "/tmp/internal_db/datadb",
"internalDBDumpInterval": "-1",
"internalDBRewriteInterval": "1s",
}
},
"stor_db": {
"db_type": "*internal",
"opts":{
"internalDBDumpPath": "/tmp/internal_db/stordb",
"internalDBDumpInterval": "-1",
"internalDBRewriteInterval": "-2", //rewrite on shutdown
}
},
"schedulers": {
"enabled": true,
},
"rals": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*localhost"],
},
"sessions": {
"enabled": true,
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"default_usage":{
"*voice":"4s"
},
"backup_interval": "-1",
},
"attributes": {
"enabled": true,
},
"apiers": {
"enabled": true,
"scheduler_conns": ["*localhost"],
}
}

View File

@@ -0,0 +1,122 @@
{
"general": {
"log_level": 7,
"reply_timeout": "50s"
},
"listen": {
"rpc_json": ":2012",
"rpc_gob": ":2013",
"http": ":2080"
},
"data_db": {
"db_type": "*internal",
"opts":{
"internalDBDumpPath": "/tmp/internal_db/datadb",
"internalDBDumpInterval": "-1"
}
},
"stor_db": {
"db_type": "*internal",
"opts":{
"internalDBDumpPath": "/tmp/internal_db/stordb",
"internalDBDumpInterval": "-1"
}
},
"rals": {
"enabled": true,
"thresholds_conns": ["*internal"],
"max_increments":3000000
},
"schedulers": {
"enabled": true,
"cdrs_conns": ["*internal"],
"stats_conns": ["*localhost"]
},
"cdrs": {
"enabled": true,
"chargers_conns":["*internal"],
},
"attributes": {
"enabled": true,
"stats_conns": ["*localhost"],
"resources_conns": ["*localhost"],
"apiers_conns": ["*localhost"]
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"]
},
"resources": {
"enabled": true,
"store_interval": "-1",
"thresholds_conns": ["*internal"]
},
"stats": {
"enabled": true,
"store_interval": "-1",
"thresholds_conns": ["*internal"]
},
"thresholds": {
"enabled": true,
"store_interval": "-1",
"sessions_conns": ["*internal"],
"apiers_conns": ["*internal"]
},
"routes": {
"enabled": true,
"prefix_indexed_fields":["*req.Destination"],
"stats_conns": ["*internal"],
"resources_conns": ["*internal"],
"rals_conns": ["*internal"]
},
"sessions": {
"enabled": true,
"routes_conns": ["*internal"],
"resources_conns": ["*internal"],
"attributes_conns": ["*internal"],
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"]
},
"apiers": {
"enabled": true,
"scheduler_conns": ["*internal"]
},
"filters": {
"stats_conns": ["*localhost"],
"resources_conns": ["*internal"],
"apiers_conns": ["*internal"]
}
}

View File

@@ -1,2 +1,2 @@
#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],QueueLength[4],TTL[5],MinItems[6],Metrics[7],MetricFilterIDs[8],Stored[9],Blocker[10],Weight[11],ThresholdIDs[12]
cgrates.org,Stat_1,FLTR_STAT_1,2014-07-29T15:00:00Z,100,10s,0,*acd;*tcd;*asr,,true,true,30,*none
cgrates.org,Stat_1,FLTR_STAT_1,2014-07-29T15:00:00Z,100,10s,0,*acd;*tcd;*asr,,false,true,30,*none
1 #Tenant[0] Id[1] FilterIDs[2] ActivationInterval[3] QueueLength[4] TTL[5] MinItems[6] Metrics[7] MetricFilterIDs[8] Stored[9] Blocker[10] Weight[11] ThresholdIDs[12]
2 cgrates.org Stat_1 FLTR_STAT_1 2014-07-29T15:00:00Z 100 10s 0 *acd;*tcd;*asr true false true 30 *none

View File

@@ -1,6 +1,6 @@
#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],QueueLength[4],TTL[5],MinItems[6],Metrics[7],MetricFilterIDs[8],Stored[9],Blocker[10],Weight[11],ThresholdIDs[12]
cgrates.org,Stat_1,FLTR_STAT_1,2014-07-29T15:00:00Z,100,10s,0,*acd;*tcd;*asr,,true,true,30,*none
cgrates.org,Stat_1_1,FLTR_STAT_1_1,2014-07-29T15:00:00Z,100,1s,0,*acd;*tcd;*pdd,,true,true,30,*none
cgrates.org,Stat_1,FLTR_STAT_1,2014-07-29T15:00:00Z,100,10s,0,*acd;*tcd;*asr,,false,true,30,*none
cgrates.org,Stat_1_1,FLTR_STAT_1_1,2014-07-29T15:00:00Z,100,1s,0,*acd;*tcd;*pdd,,false,true,30,*none
cgrates.org,Stat_2,FLTR_STAT_2,2014-07-29T15:00:00Z,100,1s,0,*acd;*tcd;*asr,,false,true,30,*none
cgrates.org,Stat_3,FLTR_STAT_3,2014-07-29T15:00:00Z,100,1s,0,*acd;*tcd;*asr,,false,true,30,*none
cgrates.org,Stat_Supplier1,*string:~*req.StatID:Stat_Supplier1,2014-07-29T15:00:00Z,100,1s,0,*sum#~*req.LoadReq,,true,true,30,*none
1 #Tenant[0] Id[1] FilterIDs[2] ActivationInterval[3] QueueLength[4] TTL[5] MinItems[6] Metrics[7] MetricFilterIDs[8] Stored[9] Blocker[10] Weight[11] ThresholdIDs[12]
2 cgrates.org Stat_1 FLTR_STAT_1 2014-07-29T15:00:00Z 100 10s 0 *acd;*tcd;*asr true false true 30 *none
3 cgrates.org Stat_1_1 FLTR_STAT_1_1 2014-07-29T15:00:00Z 100 1s 0 *acd;*tcd;*pdd true false true 30 *none
4 cgrates.org Stat_2 FLTR_STAT_2 2014-07-29T15:00:00Z 100 1s 0 *acd;*tcd;*asr false true 30 *none
5 cgrates.org Stat_3 FLTR_STAT_3 2014-07-29T15:00:00Z 100 1s 0 *acd;*tcd;*asr false true 30 *none
6 cgrates.org Stat_Supplier1 *string:~*req.StatID:Stat_Supplier1 2014-07-29T15:00:00Z 100 1s 0 *sum#~*req.LoadReq true true 30 *none

View File

@@ -165,7 +165,7 @@ func LoadTariffPlanFromFolder(tpPath, timezone string, dm *DataManager, disable_
return utils.NewErrServerError(err)
}
loader, err := NewTpReader(dm.dataDB, csvStorage, "",
timezone, cacheConns, schedConns, false)
timezone, cacheConns, schedConns)
if err != nil {
return utils.NewErrServerError(err)
}

View File

@@ -300,7 +300,7 @@ func init() {
ActionsCSVContent, ActionPlansCSVContent, ActionTriggersCSVContent, AccountActionsCSVContent,
ResourcesCSVContent, IPsCSVContent, StatsCSVContent, TrendsCSVContent, RankingsCSVContent,
ThresholdsCSVContent, FiltersCSVContent, RoutesCSVContent, AttributesCSVContent,
ChargersCSVContent, DispatcherCSVContent, DispatcherHostCSVContent), testTPID, "", nil, nil, false)
ChargersCSVContent, DispatcherCSVContent, DispatcherHostCSVContent), testTPID, "", nil, nil)
if err != nil {
log.Print("error when creating TpReader:", err)
}

View File

@@ -1071,7 +1071,7 @@ func TestTPReaderLoadDestinationsFiltered(t *testing.T) {
}, []string{"groupId"}, true, "tId")
db.db = tscache
tpr, err := NewTpReader(db, db, "itemId", "local", nil, nil, true)
tpr, err := NewTpReader(db, db, "itemId", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1097,7 +1097,7 @@ func TestTPReaderLoadAll(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(nil, db, "", "local", nil, nil, false)
tpr, err := NewTpReader(nil, db, "", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1188,7 +1188,7 @@ func TestTpReaderIsValid(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(nil, db, "", "local", nil, nil, false)
tpr, err := NewTpReader(nil, db, "", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1241,7 +1241,7 @@ func TestTpReaderLoadAccountActions(t *testing.T) {
t.Error(dErr)
}
db.db = tscache
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1460,7 +1460,7 @@ func TestTpReaderLoadTimingsErr(t *testing.T) {
t.Error(dErr)
}
db.db = tscache
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1498,7 +1498,7 @@ func TestLoadDestinationRatesErr(t *testing.T) {
t.Error(dErr)
}
db.db = tscache
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1556,7 +1556,7 @@ func TestTpReaderLoadRatingPlansFilteredErr(t *testing.T) {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1589,7 +1589,7 @@ func TestLoadRatingProfilesFiltered(t *testing.T) {
t.Error(dErr)
}
db.db = tscache
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "local", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1649,7 +1649,7 @@ func TestTpReaderLoadActionTriggers(t *testing.T) {
t.Error(dErr)
}
db.db = tscache
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1737,7 +1737,7 @@ func TestTpReaderSetDestination(t *testing.T) {
t.Error(dErr)
}
db.db = tscache
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1773,7 +1773,7 @@ func TestTPReaderLoadAccountActionsFilteredErr(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1822,7 +1822,7 @@ func TestTprRemoveFromDatabase(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1884,7 +1884,7 @@ func TestLoadActionPlansErrs(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "tpr", "UTC", nil, nil, true)
tpr, err := NewTpReader(db, db, "tpr", "UTC", nil, nil)
if err != nil {
t.Error(err)
}
@@ -1935,7 +1935,7 @@ func TestLoadRatingPlansFiltered(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil, true)
tpr, err := NewTpReader(db, db, "*prf", "UTC", nil, nil)
if err != nil {
t.Error(err)
}
@@ -2067,7 +2067,7 @@ func TestTPRLoadRatingProfiles(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "RP1", "", nil, nil, false)
tpr, err := NewTpReader(db, db, "RP1", "", nil, nil)
if err != nil {
t.Error(err)
@@ -2133,7 +2133,7 @@ func TestTPRLoadAccountActions(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "", "", nil, nil, false)
tpr, err := NewTpReader(db, db, "", "", nil, nil)
if err != nil {
t.Error(err)
@@ -2163,7 +2163,7 @@ func TestTpReaderRemoveFromDatabase(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "", "", nil, nil, false)
tpr, err := NewTpReader(db, db, "", "", nil, nil)
if err != nil {
t.Error(err)
}
@@ -2229,7 +2229,7 @@ func TestTpReaderRemoveFromDatabaseDspPrf(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "", "", nil, nil, false)
tpr, err := NewTpReader(db, db, "", "", nil, nil)
if err != nil {
t.Error(err)
}
@@ -2273,7 +2273,7 @@ func TestTpReaderRemoveFromDatabaseDspHst(t *testing.T) {
if dErr != nil {
t.Error(dErr)
}
tpr, err := NewTpReader(db, db, "", "", nil, nil, false)
tpr, err := NewTpReader(db, db, "", "", nil, nil)
if err != nil {
t.Error(err)
}
@@ -2318,7 +2318,7 @@ func TestTprLoadAccountActionFiltered(t *testing.T) {
if err != nil {
t.Error(err)
}
tpr, err := NewTpReader(dataDb, storDb, "TP1", "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
tpr, err := NewTpReader(dataDb, storDb, "TP1", "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil)
if err != nil {
t.Error(err)
}
@@ -2492,7 +2492,7 @@ func TestTprLoadRatingPlansFiltered(t *testing.T) {
},
}}
storDb.SetTPRatingPlans([]*utils.TPRatingPlan{rp})
tpr, err := NewTpReader(dataDb, storDb, "TP1", "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
tpr, err := NewTpReader(dataDb, storDb, "TP1", "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil)
if err != nil {
t.Error(err)
}

View File

@@ -149,7 +149,7 @@ func testLoaderITRemoveLoad(t *testing.T) {
t.Fatal(err)
}
loader, err = NewTpReader(dataDbCsv, csvStorage, "", "",
[]string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
[]string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil)
if err != nil {
t.Error(err)
}
@@ -234,7 +234,7 @@ func testLoaderITLoadFromCSV(t *testing.T) {
t.Fatal(err)
}
loader, err = NewTpReader(dataDbCsv, csvStorage, "", "",
[]string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
[]string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil)
if err != nil {
t.Error(err)
}
@@ -564,7 +564,7 @@ func testLoaderITImportToStorDb(t *testing.T) {
// Loads data from storDb into dataDb
func testLoaderITLoadFromStorDb(t *testing.T) {
loader, _ := NewTpReader(dataDbCsv, storDb, utils.TestSQL, "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
loader, _ := NewTpReader(dataDbCsv, storDb, utils.TestSQL, "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil)
if err := loader.LoadDestinations(); err != nil && err.Error() != utils.NotFoundCaps {
t.Error("Failed loading destinations: ", err.Error())
}
@@ -601,7 +601,7 @@ func testLoaderITLoadFromStorDb(t *testing.T) {
}
func testLoaderITLoadIndividualProfiles(t *testing.T) {
loader, _ := NewTpReader(dataDbCsv, storDb, utils.TestSQL, "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
loader, _ := NewTpReader(dataDbCsv, storDb, utils.TestSQL, "", []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil)
// Load ratingPlans. This will also set destination keys
if rps, err := storDb.GetTPRatingPlans(utils.TestSQL, "", nil); err != nil {
t.Fatal("Could not retrieve rating plans")

View File

@@ -64,7 +64,7 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,,,false,false,10`
csvr, err := engine.NewTpReader(dbAcntActs.DataDB(), engine.NewStringCSVStorage(utils.CSVSep, destinations, timings,
rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups,
actions, actionPlans, actionTriggers, accountActions,
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil, false)
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -67,7 +67,7 @@ func TestAuthLoadCsvError(t *testing.T) {
chargerProfiles := ``
csvr, err := engine.NewTpReader(dbAuth.DataDB(), engine.NewStringCSVStorage(utils.CSVSep, destinations, timings, rates, destinationRates,
ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions,
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil, false)
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil)
if err != nil {
t.Error(err)
}
@@ -104,7 +104,7 @@ cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_ANY,`
chargerProfiles := ``
csvr, err := engine.NewTpReader(dbAuth.DataDB(), engine.NewStringCSVStorage(utils.CSVSep, destinations, timings, rates, destinationRates,
ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions,
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil, false)
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -62,7 +62,7 @@ cgrates.org,sms,*any,2012-01-01T00:00:00Z,RP_SMS1,`
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
), utils.EmptyString, utils.EmptyString, nil, nil, false)
), utils.EmptyString, utils.EmptyString, nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -53,7 +53,7 @@ RP_DATA1,DR_DATA_2,TM2,10`
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
),
utils.EmptyString, utils.EmptyString, nil, nil, false)
utils.EmptyString, utils.EmptyString, nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -74,7 +74,7 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
destinationRates, ratingPlans, ratingProfiles,
sharedGroups, actions, actionPlans, actionTriggers, accountActions,
resLimits, ips, stats, trends, rankings, thresholds, filters, suppliers,
attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil, false)
attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -72,7 +72,7 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
csvr, err := engine.NewTpReader(dataDB2.DataDB(), engine.NewStringCSVStorage(utils.CSVSep, destinations, timings,
rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans,
actionTriggers, accountActions, resLimits, ips,
stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil, false)
stats, trends, rankings, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -70,7 +70,7 @@ cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
csvr, err := engine.NewTpReader(dataDB3.DataDB(), engine.NewStringCSVStorage(utils.CSVSep, destinations, timings, rates,
destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers,
accountActions, resLimits, ips, stats, trends, rankings,
thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil, false)
thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, ""), "", "", nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -391,9 +391,16 @@ func testDynThdGetAccountAfterDebit(t *testing.T) {
}
func testDynThdGetThresholdAfterDebit(t *testing.T) {
expThd := &engine.Threshold{
Tenant: "cgrates.org",
ID: "THD_ACNT_1002",
Hits: 1,
}
var result2 *engine.Threshold
if err := dynThdRpc.Call(context.Background(), utils.ThresholdSv1GetThreshold, &utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1002"}}, &result2); err == nil || err.Error() != utils.ErrNotFound.Error() {
if err := dynThdRpc.Call(context.Background(), utils.ThresholdSv1GetThreshold, &utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1002"}}, &result2); err != nil {
t.Error(err)
} else if result2.Snooze = expThd.Snooze; !reflect.DeepEqual(result2, expThd) {
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", utils.ToJSON(expThd), utils.ToJSON(result2))
}
}

View File

@@ -279,7 +279,7 @@ func testExpVerifyStats(t *testing.T) {
},
},
Blocker: true,
Stored: true,
Stored: false,
Weight: 30,
MinItems: 0,
ThresholdIDs: []string{utils.MetaNone},

View File

@@ -369,7 +369,7 @@ func testRpcdrsNewEngineSameDB(t *testing.T) {
tpFiles := map[string]string{
utils.StatsCsv: `#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],QueueLength[4],TTL[5],MinItems[6],Metrics[7],MetricFilterIDs[8],Stored[9],Blocker[10],Weight[11],ThresholdIDs[12]
cgrates.org,STAT_AGG,,2014-07-29T15:00:00Z,0,-1,0,*tcd;*tcc;*sum#1,,true,false,30,*none`,
cgrates.org,STAT_AGG,,2014-07-29T15:00:00Z,0,-1,0,*tcd;*tcc;*sum#1,,false,false,30,*none`,
}
if _, err := engine.StopStartEngine(rpcdrsCfgPath, *utils.WaitRater); err != nil {

View File

@@ -55,7 +55,6 @@ var (
func TestRsV1IT(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
rlsV1ConfDIR = "tutinternal"
case utils.MetaMySQL:
rlsV1ConfDIR = "tutmysql"

View File

@@ -81,7 +81,6 @@ var (
func TestRoutesCaseV1IT(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.Skip("unfinished, resources solution needed")
rtsCaseSv1ConfDIR = "tutinternal"
case utils.MetaMySQL:
rtsCaseSv1ConfDIR = "tutmysql"

View File

@@ -51,7 +51,7 @@ func TestSMSLoadCsvTpSmsChrg1(t *testing.T) {
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString,
utils.EmptyString), utils.EmptyString, utils.EmptyString, nil, nil, false)
utils.EmptyString), utils.EmptyString, utils.EmptyString, nil, nil)
if err != nil {
t.Error(err)
}

View File

@@ -106,8 +106,8 @@ func TestTrendSchedule(t *testing.T) {
cgrates.org,TREND_1,@every 1s,Stats1_1,,-1,-1,1,*last,1,false,Threshold1;Threshold2
cgrates.org,TREND_2,@every 1s,Stats1_2,,-1,-1,1,*last,1,false,*none`,
utils.StatsCsv: `#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],QueueLength[4],TTL[5],MinItems[6],Metrics[7],MetricFilterIDs[8],Stored[9],Blocker[10],Weight[11],ThresholdIDs[12]
cgrates.org,Stats1_1,*string:~*req.Account:1001,,,,,*tcc;*acd;*tcd,,true,,,
cgrates.org,Stats1_2,*string:~*req.Account:1002,,,,,*sum#~*req.Usage;*pdd,,true,,,`,
cgrates.org,Stats1_1,*string:~*req.Account:1001,,,,,*tcc;*acd;*tcd,,false,,,
cgrates.org,Stats1_2,*string:~*req.Account:1002,,,,,*sum#~*req.Usage;*pdd,,false,,,`,
utils.ThresholdsCsv: `#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],MaxHits[4],MinHits[5],MinSleep[6],Blocker[7],Weight[8],ActionIDs[9],Async[10],EeIDs[11]
cgrates.org,Threshold1,*string:~*req.Metrics.*acd.ID:*acd,2024-07-29T15:00:00Z,-1,10,1s,false,10,,true,
cgrates.org,Threshold2,*string:~*req.Metrics.*pdd.ID:*pdd,2024-07-29T15:00:00Z,-1,10,1s,false,10,,true,

View File

@@ -23,6 +23,7 @@ package sessions
import (
"fmt"
"os"
"path"
"testing"
"time"
@@ -94,7 +95,12 @@ var (
func TestSessionsBkup(t *testing.T) {
switch *utils.DBType {
case utils.MetaInternal:
t.SkipNow()
sBkupCfgDIR = "sessions_backup_internal"
defer func() {
if err := os.RemoveAll("/tmp/internal_db"); err != nil {
t.Error(err)
}
}()
case utils.MetaMySQL:
sBkupCfgDIR = "sessions_backup_mysql"
case utils.MetaMongo:
@@ -114,6 +120,14 @@ func testSessionSBkupInitCfg(t *testing.T) {
if sBkupCfg, err = config.NewCGRConfigFromPath(sBkupCfgPath); err != nil {
t.Fatal(err)
}
if *utils.DBType == utils.MetaInternal {
if err := os.MkdirAll(sBkupCfg.DataDbCfg().Opts.InternalDBDumpPath, 0755); err != nil {
t.Fatal(err)
}
if err := os.MkdirAll(sBkupCfg.StorDbCfg().Opts.InternalDBDumpPath, 0755); err != nil {
t.Fatal(err)
}
}
}
// Remove data in both rating and accounting db
@@ -433,7 +447,9 @@ func testSessionSBkupCallBackup2(t *testing.T) {
}
func testSessionSBkupGetBackedupSessions(t *testing.T) {
if *utils.DBType == utils.MetaInternal {
t.SkipNow()
}
if *utils.DBType == utils.MetaMySQL || *utils.DBType == utils.MetaPostgres {
dataDB, err = engine.NewRedisStorage(
fmt.Sprintf("%s:%s", sBkupCfg.DataDbCfg().Host, sBkupCfg.DataDbCfg().Port),
@@ -560,6 +576,9 @@ func testSessionSBkupCallBackup3(t *testing.T) {
}
func testSessionSBkupCheckUpdatedAt(t *testing.T) {
if *utils.DBType == utils.MetaInternal {
t.SkipNow()
}
var getBackSess []*Session
storedSessions, err := dataDB.GetSessionsBackupDrv(sBkupCfg.GeneralCfg().NodeID,
sBkupCfg.GeneralCfg().DefaultTenant)