Fixed tests for the ComputeID case

This commit is contained in:
porosnicuadrian
2021-09-14 16:56:20 +03:00
committed by Dan Christian Bogos
parent 2d36afe34f
commit d9d8df250f

View File

@@ -92,7 +92,7 @@ var (
testV1FIdxComputeDispatcherProfileIndexes,
testV1FIdxSetDispatcherProfile2,
testV1FIdxComputeDispatcherProfileIndexes2,
// special case for ComputeIndexesIDs multiple times
testV1FIdxComputeIndexesMultipleProfilesAndFilters,
testV1FIdxStopEngine,
@@ -453,10 +453,10 @@ func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) {
QueueLength: 10,
TTL: time.Duration(10) * time.Second,
Metrics: []*engine.MetricWithFilters{
&engine.MetricWithFilters{
{
MetricID: utils.MetaSum,
},
&engine.MetricWithFilters{
{
MetricID: utils.MetaACD,
},
},
@@ -556,10 +556,10 @@ func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) {
QueueLength: 10,
TTL: time.Duration(10) * time.Second,
Metrics: []*engine.MetricWithFilters{
&engine.MetricWithFilters{
{
MetricID: "*sum",
},
&engine.MetricWithFilters{
{
MetricID: utils.MetaACD,
},
},
@@ -2141,48 +2141,46 @@ func testV1FIdxComputeIndexesMultipleProfilesAndFilters(t *testing.T) {
}
}
/*
//now we will ComputeFilterIndexes of the remain profile
if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexIDs,
&utils.ArgsComputeFilterIndexIDs{Tenant: "cgrates.org",
ThresholdIDs: []string{"THD_ACNT_1003"}},
&reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Error("Unexpected reply returned")
//now we will ComputeFilterIndexes of the remain profile
if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexIDs,
&utils.ArgsComputeFilterIndexIDs{Tenant: "cgrates.org",
ThresholdIDs: []string{"THD_ACNT_1003"}},
&reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Error("Unexpected reply returned")
}
expectedIDx = []string{"*string:~*req.Account:1001:THD_ACNT_1002",
"*string:~*req.Account:1001:THD_ACNT_1003",
"*string:~*req.Account:1001:THD_ACNT_1001",
"*prefix:~*req.AnswerTime:12:THD_ACNT_1002",
"*prefix:~*req.AnswerTime:33:THD_ACNT_1002",
"*prefix:~*req.AnswerTime:12:THD_ACNT_1001",
"*prefix:~*req.AnswerTime:33:THD_ACNT_1001",
"*string:~*req.Usage:123s:THD_ACNT_1002",
"*string:~*req.Usage:123s:THD_ACNT_1001",
"*string:~*req.Subject:1004:THD_ACNT_1001",
"*string:~*req.Subject:6774:THD_ACNT_1001",
"*string:~*req.Subject:22312:THD_ACNT_1001",
"*string:~*opts.Subsystems:*attributes:THD_ACNT_1001",
"*prefix:~*req.Destinations:+0775:THD_ACNT_1001",
"*prefix:~*req.Destinations:+442:THD_ACNT_1001",
"*string:~*req.Subject:1004:THD_ACNT_1003",
"*string:~*req.Subject:6774:THD_ACNT_1003",
"*string:~*req.Subject:22312:THD_ACNT_1003",
"*string:~*opts.Subsystems:*attributes:THD_ACNT_1003",
"*prefix:~*req.Destinations:+0775:THD_ACNT_1003",
"*prefix:~*req.Destinations:+442:THD_ACNT_1003"}
if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes,
&AttrGetFilterIndexes{Tenant: "cgrates.org", ItemType: utils.MetaThresholds}, &replyIdx); err != nil {
t.Error(err)
} else {
sort.Strings(expectedIDx)
sort.Strings(replyIdx)
if !reflect.DeepEqual(expectedIDx, replyIdx) {
t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expectedIDx), utils.ToJSON(replyIdx))
}
expectedIDx = []string{"*string:~*req.Account:1001:THD_ACNT_1002",
"*string:~*req.Account:1001:THD_ACNT_1003",
"*string:~*req.Account:1001:THD_ACNT_1001",
"*prefix:~*req.AnswerTime:12:THD_ACNT_1002",
"*prefix:~*req.AnswerTime:33:THD_ACNT_1002",
"*prefix:~*req.AnswerTime:12:THD_ACNT_1001",
"*prefix:~*req.AnswerTime:33:THD_ACNT_1001",
"*string:~*req.Usage:123s:THD_ACNT_1002",
"*string:~*req.Usage:123s:THD_ACNT_1001",
"*string:~*req.Subject:1004:THD_ACNT_1001",
"*string:~*req.Subject:6774:THD_ACNT_1001",
"*string:~*req.Subject:22312:THD_ACNT_1001",
"*string:~*opts.Subsystems:*attributes:THD_ACNT_1001",
"*prefix:~*req.Destinations:+0775:THD_ACNT_1001",
"*prefix:~*req.Destinations:+442:THD_ACNT_1001",
"*string:~*req.Subject:1004:THD_ACNT_1003",
"*string:~*req.Subject:6774:THD_ACNT_1003",
"*string:~*req.Subject:22312:THD_ACNT_1003",
"*string:~*opts.Subsystems:*attributes:THD_ACNT_1003",
"*prefix:~*req.Destinations:+0775:THD_ACNT_1003",
"*prefix:~*req.Destinations:+442:THD_ACNT_1003"}
if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes,
&AttrGetFilterIndexes{Tenant: "cgrates.org", ItemType: utils.MetaThresholds}, &replyIdx); err != nil {
t.Error(err)
} else {
sort.Strings(expectedIDx)
sort.Strings(replyIdx)
if !reflect.DeepEqual(expectedIDx, replyIdx) {
t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expectedIDx), utils.ToJSON(replyIdx))
}
}
*/
}
}
func testV1FIdxStopEngine(t *testing.T) {