Fix failing tests after removal of ActivationInterval from Thresholds

This commit is contained in:
ionutboangiu
2021-05-17 11:16:25 +03:00
committed by Dan Christian Bogos
parent 563314ecb0
commit 7fe6723ded
4 changed files with 30 additions and 11 deletions

View File

@@ -271,7 +271,7 @@ func TestLoadThresholdProfiles(t *testing.T) {
TPid: testTPID,
Tenant: "cgrates.org",
ID: "Threshold1",
FilterIDs: []string{"*string:~*req.Account:1001", "*string:~*req.RunID:*default", "*ai:~*req.AnswerTime:2014-07-29T15:00:00Z"},
FilterIDs: []string{"*string:~*req.Account:1001", "*string:~*req.RunID:*default"},
MaxHits: 12,
MinHits: 10,
MinSleep: "1s",

View File

@@ -587,7 +587,7 @@ func TestTPThresholdsAsTPThreshold(t *testing.T) {
{
TPid: tps[0].Tpid,
ID: tps[0].ID,
FilterIDs: []string{"FilterID1", "FilterID2", "*ai:~*req.AnswerTime:2014-07-29T15:00:00Z"},
FilterIDs: []string{"*ai:~*req.AnswerTime:2014-07-29T15:00:00Z", "FilterID1", "FilterID2"},
MinSleep: tps[0].MinSleep,
MaxHits: tps[0].MaxHits,
MinHits: tps[0].MinHits,
@@ -598,7 +598,7 @@ func TestTPThresholdsAsTPThreshold(t *testing.T) {
{
TPid: tps[0].Tpid,
ID: tps[0].ID,
FilterIDs: []string{"FilterID2", "FilterID1", "*ai:~*req.AnswerTime:2014-07-29T15:00:00Z"},
FilterIDs: []string{"*ai:~*req.AnswerTime:2014-07-29T15:00:00Z", "FilterID2", "FilterID1"},
MinSleep: tps[0].MinSleep,
MaxHits: tps[0].MaxHits,
MinHits: tps[0].MinHits,
@@ -642,7 +642,7 @@ func TestAPItoModelTPThreshold(t *testing.T) {
Tpid: "TP1",
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: "FilterID1;*ai:~*req.AnswerTime:2014-07-14T14:35:00Z",
FilterIDs: "FilterID1",
MaxHits: 12,
MinHits: 10,
MinSleep: "1s",
@@ -650,6 +650,12 @@ func TestAPItoModelTPThreshold(t *testing.T) {
Weight: 20.0,
ActionIDs: "WARN3",
},
{
Tpid: "TP1",
ID: "TH_1",
Tenant: "cgrates.org",
FilterIDs: "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z",
},
}
rcv := APItoModelTPThreshold(th)
if !reflect.DeepEqual(models, rcv) {
@@ -675,7 +681,7 @@ func TestAPItoModelTPThreshold2(t *testing.T) {
Tpid: "TP1",
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: "FLTR_1;*ai:~*req.AnswerTime:2014-07-14T14:35:00Z",
FilterIDs: "FLTR_1",
MaxHits: 12,
MinHits: 10,
MinSleep: "1s",
@@ -689,6 +695,12 @@ func TestAPItoModelTPThreshold2(t *testing.T) {
ID: "TH_1",
FilterIDs: "FLTR_2",
},
{
Tpid: "TP1",
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z",
},
}
rcv := APItoModelTPThreshold(th)
if !reflect.DeepEqual(models, rcv) {
@@ -714,7 +726,7 @@ func TestAPItoModelTPThreshold3(t *testing.T) {
Tpid: "TP1",
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: "FLTR_1;*ai:~*req.AnswerTime:2014-07-14T14:35:00Z",
FilterIDs: "FLTR_1",
MaxHits: 12,
MinHits: 10,
MinSleep: "1s",
@@ -727,6 +739,7 @@ func TestAPItoModelTPThreshold3(t *testing.T) {
Tenant: "cgrates.org",
ID: "TH_1",
ActionIDs: "LOG",
FilterIDs: "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z",
},
}
rcv := APItoModelTPThreshold(th)
@@ -4276,7 +4289,7 @@ func TestModelHelpersAPItoModelTPThresholdExpTime2(t *testing.T) {
Tpid: "TP1",
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: "FilterID1;*ai:~*req.AnswerTime:2014-07-14T14:35:00Z|2014-07-15T14:35:00Z",
FilterIDs: "FilterID1",
MaxHits: 12,
MinHits: 10,
MinSleep: "1s",
@@ -4284,6 +4297,12 @@ func TestModelHelpersAPItoModelTPThresholdExpTime2(t *testing.T) {
Weight: 20.0,
ActionIDs: "WARN3",
},
{
Tpid: "TP1",
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z|2014-07-15T14:35:00Z",
},
}
result := APItoModelTPThreshold(testStruct)

View File

@@ -191,7 +191,7 @@ func TestThresholdsmatchingThresholdsForEvent(t *testing.T) {
{
Tenant: "cgrates.org",
ID: "TH_1",
FilterIDs: []string{"FLTR_TH_1", "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z"},
FilterIDs: []string{"FLTR_TH_1", "*ai:*now:2014-07-14T14:35:00Z"},
MaxHits: 12,
Blocker: false,
Weight: 20.0,
@@ -201,7 +201,7 @@ func TestThresholdsmatchingThresholdsForEvent(t *testing.T) {
{
Tenant: "cgrates.org",
ID: "TH_2",
FilterIDs: []string{"FLTR_TH_2", "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z"},
FilterIDs: []string{"FLTR_TH_2", "*ai:*now:2014-07-14T14:35:00Z"},
MaxHits: 12,
MinSleep: 5 * time.Minute,
Blocker: false,
@@ -212,7 +212,7 @@ func TestThresholdsmatchingThresholdsForEvent(t *testing.T) {
{
Tenant: "cgrates.org",
ID: "TH_3",
FilterIDs: []string{"FLTR_TH_3", "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z"},
FilterIDs: []string{"FLTR_TH_3", "*ai:*now:2014-07-14T14:35:00Z"},
MaxHits: 12,
MinSleep: 5 * time.Minute,
Blocker: false,

View File

@@ -571,7 +571,7 @@ func TestLoaderProcessThresholds(t *testing.T) {
eTh1 := &engine.ThresholdProfile{
Tenant: "cgrates.org",
ID: "Threshold1",
FilterIDs: []string{"*string:~*req.Account:1001", "*string:~*req.RunID:*default", "*ai:~*req.AnswerTime:2014-07-29T15:00:00Z"},
FilterIDs: []string{"*string:~*req.Account:1001", "*string:~*req.RunID:*default"},
MaxHits: 12,
MinHits: 10,
MinSleep: time.Second,