mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fix missing imports in tests
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -68,8 +67,10 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,,,,false,false,10`
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
|
||||
cache.Flush()
|
||||
dbAcntActs.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
engine.Cache.Clear(nil)
|
||||
dbAcntActs.LoadDataDBCache(nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
expectAcnt := &engine.Account{ID: "cgrates.org:1"}
|
||||
if acnt, err := dbAcntActs.DataDB().GetAccount("cgrates.org:1"); err != nil {
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -79,19 +78,21 @@ RP_ANY,DR_ANY_1CNT,*any,10`
|
||||
t.Error("No account saved")
|
||||
}
|
||||
|
||||
cache.Flush()
|
||||
dbAuth.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
engine.Cache.Clear(nil)
|
||||
dbAuth.LoadDataDBCache(nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := cache.CountEntries(utils.DESTINATION_PREFIX); cachedDests != 0 {
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
}
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 2 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 2 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
if cachedActions := cache.CountEntries(utils.ACTION_PREFIX); cachedActions != 0 {
|
||||
if cachedActions := len(engine.Cache.GetItemIDs(utils.CacheActions, "")); cachedActions != 0 {
|
||||
t.Error("Wrong number of cached actions found", cachedActions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package general_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -73,13 +72,15 @@ RP_SMS1,DR_SMS_1,ALWAYS,10`
|
||||
t.Fatal(err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
cache.Flush()
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 3 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 3 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -60,13 +59,15 @@ RP_DATA1,DR_DATA_2,TM2,10`
|
||||
t.Fatal(err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
cache.Flush()
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 1 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 1 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/scheduler"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -117,20 +116,22 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
|
||||
} else if acnt == nil {
|
||||
t.Error("No account saved")
|
||||
}
|
||||
cache.Flush()
|
||||
engine.Cache.Clear(nil)
|
||||
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := cache.CountEntries(utils.DESTINATION_PREFIX); cachedDests != 0 {
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
}
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 2 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 2 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
if cachedActions := cache.CountEntries(utils.ACTION_PREFIX); cachedActions != 0 {
|
||||
if cachedActions := len(engine.Cache.GetItemIDs(utils.CacheActions, "")); cachedActions != 0 {
|
||||
t.Error("Wrong number of cached actions found", cachedActions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/scheduler"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -115,19 +114,21 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
|
||||
} else if acnt == nil {
|
||||
t.Error("No account saved")
|
||||
}
|
||||
cache.Flush()
|
||||
dataDB2.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB2.LoadDataDBCache(nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := cache.CountEntries(utils.DESTINATION_PREFIX); cachedDests != 0 {
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
}
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 2 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 2 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
if cachedActions := cache.CountEntries(utils.ACTION_PREFIX); cachedActions != 0 {
|
||||
if cachedActions := len(engine.Cache.GetItemIDs(utils.CacheActions, "")); cachedActions != 0 {
|
||||
t.Error("Wrong number of cached actions found", cachedActions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/scheduler"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -113,19 +112,21 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
|
||||
} else if acnt == nil {
|
||||
t.Error("No account saved")
|
||||
}
|
||||
cache.Flush()
|
||||
dataDB3.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB3.LoadDataDBCache(nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := cache.CountEntries(utils.DESTINATION_PREFIX); cachedDests != 0 {
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
}
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 2 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 2 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
if cachedActions := cache.CountEntries(utils.ACTION_PREFIX); cachedActions != 0 {
|
||||
if cachedActions := len(engine.Cache.GetItemIDs(utils.CacheActions, "")); cachedActions != 0 {
|
||||
t.Error("Wrong number of cached actions found", cachedActions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/cache"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -58,13 +57,13 @@ func TestSMSLoadCsvTpSmsChrg1(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
cache.Flush()
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedRPlans := cache.CountEntries(utils.RATING_PLAN_PREFIX); cachedRPlans != 1 {
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 1 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
}
|
||||
if cachedRProfiles := cache.CountEntries(utils.RATING_PROFILE_PREFIX); cachedRProfiles != 0 {
|
||||
if cachedRProfiles := len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, "")); cachedRProfiles != 0 {
|
||||
t.Error("Wrong number of cached rating profiles found", cachedRProfiles)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
func TestRCacheSetGet(t *testing.T) {
|
||||
rc := NewResponseCache(5 * time.Second)
|
||||
rc.Cache("test", &CacheItem{Value: "best"})
|
||||
rc.Cache("test", &ResponseCacheItem{Value: "best"})
|
||||
v, err := rc.Get("test")
|
||||
if err != nil || v.Value.(string) != "best" {
|
||||
t.Error("Error retriving response cache: ", v, err)
|
||||
|
||||
Reference in New Issue
Block a user