TPe tests

This commit is contained in:
porosnicuadrian
2022-03-17 15:32:47 +02:00
committed by Dan Christian Bogos
parent b2af60e7e1
commit 0caf4123d1
5 changed files with 15 additions and 29 deletions

View File

@@ -216,7 +216,7 @@ func testCacheSHasItemAttributeProfile(t *testing.T) {
t.Errorf("Unexpected reply result")
}
//also cannot take any itemIDs
// also cannot take any itemIDs
argsIds := &utils.ArgsGetCacheItemIDsWithAPIOpts{
ArgsGetCacheItemIDs: utils.ArgsGetCacheItemIDs{
CacheID: utils.CacheAttributeProfiles,
@@ -264,7 +264,7 @@ func testCacheSHasItemAttributeProfile(t *testing.T) {
ItemID: "cgrates.org:TEST_ATTRIBUTES_IT_TEST",
},
}
//Getting an profile from db will set it in cache
// Getting an profile from db will set it in cache
if err := chcRPC.Call(context.Background(), utils.CacheSv1HasItem,
args, &reply); err != nil {
t.Error(err)
@@ -382,7 +382,7 @@ func testCacheSRemoveItemsAndReloadCache(t *testing.T) {
t.Errorf("Unexpected reply return")
}
//as we removed the items, we cannot take it from cache
// as we removed the items, we cannot take it from cache
if err := chcRPC.Call(context.Background(), utils.CacheSv1GetItemIDs,
argsIds, &result); err == nil || err.Error() != utils.ErrNotFound.Error() {
t.Errorf("Expected %+v, received %+v", utils.ErrNotFound, result)

View File

@@ -65,6 +65,11 @@ var (
testTPeSExportTariffPlanAllTariffPlan,
// export again after we will flush the database
testTPeSInitDataDb,
testTPeSKillEngine,
testTPeSInitCfg,
testTPeSStartEngine,
testTPeSRPCConn,
testTPeSExportAfterFlush,
testTPeSKillEngine,
}
@@ -159,6 +164,7 @@ func testTPeSSetAttributeProfile(t *testing.T) {
} else if reply != utils.OK {
t.Error(err)
}
attrPrf1 := &engine.APIAttributeProfileWithAPIOpts{
APIAttributeProfile: &engine.APIAttributeProfile{
Tenant: utils.CGRateSorg,
@@ -1089,7 +1095,7 @@ func testTPeSExportTariffPlanHalfTariffPlan(t *testing.T) {
},
utils.DispatcherProfilesCsv: {
{"#Tenant", "ID", "FilterIDs", "Weight", "Strategy", "StrategyParameters", "ConnID", "ConnFilterIDs", "ConnWeight", "ConnBlocker", "ConnParameters"},
{"cgrates.org", "Dsp1", "*string:~*req.Account:1001;*ai:~*req.AnswerTime:2014-07-14T14:25:00Z", "20", "*first", "false", "C1", "", "10", "false", "*ratio:2;192.168.54.203"},
{"cgrates.org", "Dsp1", "*string:~*req.Account:1001;*ai:~*req.AnswerTime:2014-07-14T14:25:00Z", "20", "*first", "false", "C1", "", "10", "false", "192.168.54.203"},
},
}
expected[utils.RatesCsv] = csvRply[utils.RatesCsv]
@@ -1223,7 +1229,7 @@ func testTPeSExportTariffPlanAllTariffPlan(t *testing.T) {
},
utils.DispatcherProfilesCsv: {
{"#Tenant", "ID", "FilterIDs", "Weight", "Strategy", "StrategyParameters", "ConnID", "ConnFilterIDs", "ConnWeight", "ConnBlocker", "ConnParameters"},
{"cgrates.org", "Dsp1", "*string:~*req.Account:1001;*ai:~*req.AnswerTime:2014-07-14T14:25:00Z", "20", "*first", "false", "C1", "", "10", "false", "*ratio:2;192.168.54.203"},
{"cgrates.org", "Dsp1", "*string:~*req.Account:1001;*ai:~*req.AnswerTime:2014-07-14T14:25:00Z", "20", "*first", "false", "C1", "", "10", "false", "192.168.54.203"},
{"cgrates.org", "Dsp2", "*string:~*opts.EventType:LoadDispatcher", "10", "*weight", "", "Conn2", "*suffix:~*opts.*answerTime:45T", "0", "false", "*ratio:1"},
},
}
@@ -1297,7 +1303,7 @@ func testTPeSExportAfterFlush(t *testing.T) {
}
// empty exporters, nothing in database to export
if len(csvRply) != 0 {
t.Errorf("Unexpected length, expected to be 0, no exports were nedeed and got zip containing: %v", utils.ToJSON(csvRply))
t.Errorf("Unexpected length, expected to be 0, no exports were nedeed and got zip containing: \n %v", utils.ToJSON(csvRply))
}
}

View File

@@ -20,13 +20,6 @@
"db_type": "*internal"
},
"schedulers": {
"enabled": true,
"cdrs_conns": ["*internal"],
"stats_conns": ["*localhost"]
},
"cdrs": {
"enabled": true,
"chargers_conns":["*internal"]

View File

@@ -21,20 +21,6 @@
"db_port": 27017,
},
"rals": {
"enabled": true,
"thresholds_conns": ["*internal"],
"max_increments":3000000,
},
"schedulers": {
"enabled": true,
"cdrs_conns": ["*internal"],
"stats_conns": ["*localhost"],
},
"cdrs": {
"enabled": true,
"chargers_conns":["*internal"],

View File

@@ -119,9 +119,10 @@ func (tpE *TPeS) V1ExportTariffPlan(ctx *context.Context, args *ArgsExportTP, re
var itemIDs []string
if itemIDs, err = getTariffPlansKeys(ctx, tpE.dm, args.Tenant, subsystem); err != nil {
return
} else if len(itemIDs) != 0 {
// the map e.g. : *filters: {"ATTR_1", "ATTR_1"}
args.ExportItems[subsystem] = itemIDs
}
// the map e.g. : *filters: {"ATTR_1", "ATTR_1"}
args.ExportItems[subsystem] = itemIDs
}
} else {
// else export just the wanted IDs