mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 05:09:54 +05:00
Merge branch 'master' of https://github.com/cgrates/cgrates
This commit is contained in:
@@ -674,10 +674,10 @@ func cgrRPCAction(account *Account, sq *StatsQueueTriggered, a *Action, acs Acti
|
||||
utils.Logger.Err(fmt.Sprintf("error executing *cgr_rpc template %s:", err.Error()))
|
||||
return err
|
||||
}
|
||||
a.ExtraParameters = buf.String()
|
||||
//utils.Logger.Info("ExtraParameters: " + a.ExtraParameters)
|
||||
processedExtraParam := buf.String()
|
||||
//utils.Logger.Info("ExtraParameters: " + parsedExtraParameters)
|
||||
req := RPCRequest{}
|
||||
if err := json.Unmarshal([]byte(a.ExtraParameters), &req); err != nil {
|
||||
if err := json.Unmarshal([]byte(processedExtraParam), &req); err != nil {
|
||||
return err
|
||||
}
|
||||
params, err := utils.GetRpcParams(req.Method)
|
||||
|
||||
@@ -134,6 +134,17 @@ func (sq *StatsQueue) appendQcdr(qcdr *QCdr, runTrigger bool) {
|
||||
stats := sq.getStats()
|
||||
sq.conf.Triggers.Sort()
|
||||
for _, at := range sq.conf.Triggers {
|
||||
// check is effective
|
||||
if at.IsExpired(time.Now()) || !at.IsActive(time.Now()) {
|
||||
continue
|
||||
}
|
||||
|
||||
if at.Executed {
|
||||
// trigger is marked as executed, so skipp it until
|
||||
// the next reset (see RESET_TRIGGERS action type)
|
||||
continue
|
||||
}
|
||||
|
||||
if at.MinQueuedItems > 0 && len(sq.Cdrs) < at.MinQueuedItems {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -202,9 +202,9 @@ func TestStatsQueueIds(t *testing.T) {
|
||||
t.Error("Errorf getting queue ids: ", err)
|
||||
}
|
||||
result := len(ids)
|
||||
expected := 2
|
||||
expected := 5
|
||||
if result != expected {
|
||||
t.Errorf("Errorf loading stats queues. Expected %v was %v", expected, result)
|
||||
t.Errorf("Errorf loading stats queues. Expected %v was %v (%v)", expected, result, ids)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ func TestStatsAppendCdr(t *testing.T) {
|
||||
t.Error("Error appending cdr to stats: ", err)
|
||||
}
|
||||
t.Log(cdrStats.queues)
|
||||
if len(cdrStats.queues) != 2 ||
|
||||
if len(cdrStats.queues) != 5 ||
|
||||
len(cdrStats.queues["CDRST1"].Cdrs) != 0 ||
|
||||
len(cdrStats.queues["CDRST2"].Cdrs) != 1 {
|
||||
t.Error("Error appending cdr to queue: ", utils.ToIJSON(cdrStats.queues))
|
||||
@@ -280,7 +280,7 @@ func TestStatsReloadQueues(t *testing.T) {
|
||||
t.Error("Error getting queue ids: ", err)
|
||||
}
|
||||
result := len(ids)
|
||||
expected := 2
|
||||
expected := 5
|
||||
if result != expected {
|
||||
t.Errorf("Error loading stats queues. Expected %v was %v: %v", expected, result, ids)
|
||||
}
|
||||
@@ -316,7 +316,7 @@ func TestStatsReloadQueuesWithDefault(t *testing.T) {
|
||||
t.Error("Error getting queue ids: ", err)
|
||||
}
|
||||
result := len(ids)
|
||||
expected := 2
|
||||
expected := 6
|
||||
if result != expected {
|
||||
t.Errorf("Error loading stats queues. Expected %v was %v", expected, result)
|
||||
}
|
||||
@@ -348,7 +348,7 @@ func TestStatsReloadQueuesWithIds(t *testing.T) {
|
||||
t.Error("Error getting queue ids: ", err)
|
||||
}
|
||||
result := len(ids)
|
||||
expected := 2
|
||||
expected := 6
|
||||
if result != expected {
|
||||
t.Errorf("Error loading stats queues. Expected %v was %v", expected, result)
|
||||
}
|
||||
@@ -398,7 +398,7 @@ func TestStatsResetQueues(t *testing.T) {
|
||||
t.Error("Error getting queue ids: ", err)
|
||||
}
|
||||
result := len(ids)
|
||||
expected := 2
|
||||
expected := 6
|
||||
if result != expected {
|
||||
t.Errorf("Error loading stats queues. Expected %v was %v", expected, result)
|
||||
}
|
||||
@@ -430,7 +430,7 @@ func TestStatsResetQueuesWithIds(t *testing.T) {
|
||||
t.Error("Error getting queue ids: ", err)
|
||||
}
|
||||
result := len(ids)
|
||||
expected := 2
|
||||
expected := 6
|
||||
if result != expected {
|
||||
t.Errorf("Error loading stats queues. Expected %v was %v", expected, result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user