mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
compiling all tests
This commit is contained in:
@@ -83,7 +83,7 @@ func TestDestManagLoadTariffPlanFromFolderAll(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "alldests")}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -115,7 +115,7 @@ func TestDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "removesome")}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -147,7 +147,7 @@ func TestDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "removesome"), FlushDb: true}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -179,7 +179,7 @@ func TestDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "addback")}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -211,7 +211,7 @@ func TestDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "addone")}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -252,7 +252,7 @@ func TestDestManagCacheWithGetCache(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -274,7 +274,7 @@ func TestDestManagCacheWithGetCache(t *testing.T) {
|
||||
attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -309,7 +309,7 @@ func TestDestManagCacheWithGetCost(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -340,7 +340,7 @@ func TestDestManagCacheWithGetCost(t *testing.T) {
|
||||
attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true}
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if destLoadInst.LoadId == "" {
|
||||
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
|
||||
@@ -407,14 +407,14 @@ func TestRPCITStatusBcastCmd(t *testing.T) {
|
||||
var stats utils.CacheStats
|
||||
if err := rpcRAL1.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil {
|
||||
t.Error(err)
|
||||
} else if stats.LastLoadId != utils.NOT_AVAILABLE {
|
||||
} else if stats.LastRatingLoadID != utils.NOT_AVAILABLE || stats.LastAccountingLoadID != utils.NOT_AVAILABLE {
|
||||
t.Errorf("Received unexpected stats: %+v", stats)
|
||||
}
|
||||
var loadInst utils.LoadInstance
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
if err := rpcRAL1.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if loadInst.LoadId == "" {
|
||||
} else if loadInst.RatingLoadID == "" || loadInst.AccountingLoadID == "" {
|
||||
t.Errorf("Empty loadId received, loadInstance: %+v", loadInst)
|
||||
}
|
||||
var reply string
|
||||
@@ -425,12 +425,14 @@ func TestRPCITStatusBcastCmd(t *testing.T) {
|
||||
}
|
||||
if err := rpcRAL1.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil {
|
||||
t.Error(err)
|
||||
} else if stats.LastLoadId != loadInst.LoadId {
|
||||
} else if stats.LastRatingLoadID != loadInst.RatingLoadID ||
|
||||
stats.LastAccountingLoadID != loadInst.AccountingLoadID {
|
||||
t.Errorf("Received unexpected stats: %+v", stats)
|
||||
}
|
||||
if err := rpcRAL2.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil {
|
||||
t.Error(err)
|
||||
} else if stats.LastLoadId != loadInst.LoadId {
|
||||
} else if stats.LastRatingLoadID != loadInst.RatingLoadID ||
|
||||
stats.LastAccountingLoadID != loadInst.AccountingLoadID {
|
||||
t.Errorf("Received unexpected stats: %+v", stats)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ func TestSTILoadTariffPlanFromFolder(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: *tpDir}
|
||||
if err := stiRpc.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &stiLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if stiLoadInst.LoadId == "" {
|
||||
} else if stiLoadInst.RatingLoadID == "" || stiLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", stiLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -119,7 +119,7 @@ func TestSTICacheStats(t *testing.T) {
|
||||
}
|
||||
var rcvStats *utils.CacheStats
|
||||
expectedStats := &utils.CacheStats{Destinations: 1, RatingPlans: 1, RatingProfiles: 1, DerivedChargers: 1,
|
||||
LastLoadId: stiLoadInst.LoadId, LastLoadTime: stiLoadInst.LoadTime.Format(time.RFC3339)}
|
||||
LastRatingLoadID: stiLoadInst.RatingLoadID, LastAccountingLoadID: stiLoadInst.AccountingLoadID, LastLoadTime: stiLoadInst.LoadTime.Format(time.RFC3339)}
|
||||
var args utils.AttrCacheStats
|
||||
if err := stiRpc.Call("ApierV2.GetCacheStats", args, &rcvStats); err != nil {
|
||||
t.Error("Got error on ApierV2.GetCacheStats: ", err.Error())
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestTpLoadTariffPlanFromFolder(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")}
|
||||
if err := tpRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &tpLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if tpLoadInst.LoadId == "" {
|
||||
} else if tpLoadInst.RatingLoadID == "" || tpLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", tpLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
|
||||
@@ -101,7 +101,7 @@ func TestTutSMGLoadTariffPlanFromFolder(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
if err := tutSMGRpc.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &smgLoadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if smgLoadInst.LoadId == "" {
|
||||
} else if smgLoadInst.RatingLoadID == "" || smgLoadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", smgLoadInst)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -115,7 +115,7 @@ func TestTutSMGCacheStats(t *testing.T) {
|
||||
var rcvStats *utils.CacheStats
|
||||
|
||||
expectedStats := &utils.CacheStats{Destinations: 7, RatingPlans: 4, RatingProfiles: 9, Actions: 8, ActionPlans: 4, SharedGroups: 1, Aliases: 1,
|
||||
DerivedChargers: 1, LcrProfiles: 5, CdrStats: 6, Users: 3, LastLoadId: smgLoadInst.LoadId, LastLoadTime: smgLoadInst.LoadTime.Format(time.RFC3339)}
|
||||
DerivedChargers: 1, LcrProfiles: 5, CdrStats: 6, Users: 3, LastRatingLoadID: smgLoadInst.RatingLoadID, LastAccountingLoadID: smgLoadInst.AccountingLoadID, LastLoadTime: smgLoadInst.LoadTime.Format(time.RFC3339)}
|
||||
var args utils.AttrCacheStats
|
||||
if err := tutSMGRpc.Call("ApierV2.GetCacheStats", args, &rcvStats); err != nil {
|
||||
t.Error("Got error on ApierV2.GetCacheStats: ", err.Error())
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestTutLocalLoadTariffPlanFromFolder(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
if err := tutLocalRpc.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
t.Error(err)
|
||||
} else if loadInst.LoadId == "" {
|
||||
} else if loadInst.RatingLoadID == "" || loadInst.AccountingLoadID == "" {
|
||||
t.Error("Empty loadId received, loadInstance: ", loadInst)
|
||||
}
|
||||
time.Sleep(100*time.Millisecond + time.Duration(*waitRater)*time.Millisecond) // Give time for scheduler to execute topups
|
||||
@@ -116,7 +116,7 @@ func TestTutLocalCacheStats(t *testing.T) {
|
||||
var rcvStats *utils.CacheStats
|
||||
|
||||
expectedStats := &utils.CacheStats{Destinations: 7, RatingPlans: 4, RatingProfiles: 9, Actions: 8, ActionPlans: 4, SharedGroups: 1, Aliases: 1,
|
||||
DerivedChargers: 1, LcrProfiles: 5, CdrStats: 6, Users: 3, LastLoadId: loadInst.LoadId, LastLoadTime: loadInst.LoadTime.Format(time.RFC3339)}
|
||||
DerivedChargers: 1, LcrProfiles: 5, CdrStats: 6, Users: 3, LastRatingLoadID: loadInst.RatingLoadID, LastAccountingLoadID: loadInst.AccountingLoadID, LastLoadTime: loadInst.LoadTime.Format(time.RFC3339)}
|
||||
var args utils.AttrCacheStats
|
||||
if err := tutLocalRpc.Call("ApierV2.GetCacheStats", args, &rcvStats); err != nil {
|
||||
t.Error("Got error on ApierV2.GetCacheStats: ", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user