mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 20:59:53 +05:00
Update integration test to be sync with go 1.10
This commit is contained in:
committed by
Dan Christian Bogos
parent
6f4a0025dd
commit
66c3abfe6a
@@ -486,7 +486,7 @@ func TestDmtAgentSendCCRSMS(t *testing.T) {
|
||||
t.Errorf("Unexpected CDR Usage received, cdr: %+v ", cdrs[0])
|
||||
}
|
||||
if cdrs[0].Cost != 0.6 {
|
||||
t.Errorf("Unexpected CDR Cost received, cdr: %+v ", cdrs[0])
|
||||
t.Errorf("Unexpected CDR Cost received, cdr: %+v ", cdrs[0].Cost)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
cache/cache.go
vendored
2
cache/cache.go
vendored
@@ -168,7 +168,7 @@ func GetCloned(key string) (cln interface{}, err error) {
|
||||
if !hasIt {
|
||||
return nil, utils.NewCGRError(utils.Cache,
|
||||
utils.NotFoundCaps, utils.ItemNotFound,
|
||||
fmt.Sprintf("item with key <%s> was not found in <%s>", key,cln))
|
||||
fmt.Sprintf("item with key <%s> was not found in <%s>", key, cln))
|
||||
} else if origVal == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ func TestCsvITHandleCdr1File(t *testing.T) {
|
||||
fileName := "file1.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent1), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join("/tmp/cdrctests/csvit1/in", fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
@@ -127,7 +127,7 @@ func TestCsvITHandleCdr2File(t *testing.T) {
|
||||
fileName := "file2.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent2), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join("/tmp/cdrctests/csvit2/in", fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
|
||||
@@ -113,16 +113,16 @@ func TestFlatstoreitRpcConn(t *testing.T) {
|
||||
|
||||
func TestFlatstoreitProcessFiles(t *testing.T) {
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", "acc_1.log"), []byte(fullSuccessfull), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", "missed_calls_1.log"), []byte(fullMissed), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", "acc_2.log"), []byte(part1), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", "acc_3.log"), []byte(part2), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
//Rename(oldpath, newpath string)
|
||||
for _, fileName := range []string{"acc_1.log", "missed_calls_1.log", "acc_2.log", "acc_3.log"} {
|
||||
|
||||
@@ -124,7 +124,7 @@ func TestFwvitRpcConn(t *testing.T) {
|
||||
func TestFwvitProcessFiles(t *testing.T) {
|
||||
fileName := "test1.fwv"
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", fileName), []byte(FW_CDR_FILE1), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CdrInDir, fileName)); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -105,7 +105,7 @@ func TestPartcsvITHandleCdr1File(t *testing.T) {
|
||||
fileName := "file1.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(partCsvFileContent1), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join(partcsvCDRCDirIn1, fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
@@ -117,7 +117,7 @@ func TestPartcsvITHandleCdr2File(t *testing.T) {
|
||||
fileName := "file2.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(partCsvFileContent2), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join(partcsvCDRCDirIn1, fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
@@ -129,7 +129,7 @@ func TestPartcsvITHandleCdr3File(t *testing.T) {
|
||||
fileName := "file3.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(partCsvFileContent3), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join(partcsvCDRCDirIn2, fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
|
||||
@@ -94,7 +94,7 @@ func TestXmlITHandleCdr1File(t *testing.T) {
|
||||
fileName := "file1.xml"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(cdrXmlBroadsoft), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join(xmlPathIn1, fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
|
||||
@@ -677,7 +677,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
if CDRs, _, err := cdrStorage.GetCDRs(&utils.CDRsFilter{MaxCost: utils.Float64Pointer(0.0)}, false); err != nil {
|
||||
return fmt.Errorf("testGetCDRs #68, err: %v", err)
|
||||
} else if len(CDRs) != 5 {
|
||||
return fmt.Errorf("testGetCDRs #69, unexpected number of CDRs returned: ", CDRs)
|
||||
return fmt.Errorf("testGetCDRs #69, unexpected number of CDRs returned: %+v", CDRs)
|
||||
} else {
|
||||
for i, cdr := range CDRs {
|
||||
if i == 0 {
|
||||
|
||||
@@ -134,7 +134,7 @@ dbafe9c8614c785a65aabd116dd3959c3c56f7f7,default,*voice,dsafdsag,rated,*out,cgra
|
||||
fileName := "file1.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent1), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join("/tmp/cgrates/cdrc1/in", fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
@@ -149,7 +149,7 @@ func TestMCDRCHandleCdr2File(t *testing.T) {
|
||||
fileName := "file2.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join("/tmp/cgrates/cdrc2/in", fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
@@ -163,7 +163,7 @@ func TestMCDRCHandleCdr3File(t *testing.T) {
|
||||
fileName := "file3.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if err := os.Rename(tmpFilePath, path.Join("/tmp/cgrates/cdrc3/in", fileName)); err != nil {
|
||||
t.Fatal("Error moving file to processing directory: ", err)
|
||||
|
||||
@@ -215,7 +215,7 @@ func TestSMGDataLastUsedMultipleUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
@@ -243,7 +243,7 @@ func TestSMGDataLastUsedMultipleUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
aSessions := make([]*ActiveSession, 0)
|
||||
if err := smgRPC.Call("SMGenericV1.GetActiveSessions", nil, &aSessions); err != nil {
|
||||
@@ -278,13 +278,13 @@ func TestSMGDataLastUsedMultipleUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
if err := smgRPC.Call("SMGenericV1.GetActiveSessions", nil, &aSessions); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(aSessions) != 1 ||
|
||||
aSessions[0].Usage != time.Duration(15360) {
|
||||
t.Errorf("wrong active sessions: %f", aSessions[0].Usage)
|
||||
t.Errorf("wrong active sessions: %v", aSessions[0].Usage)
|
||||
}
|
||||
smgEv = SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
@@ -312,7 +312,7 @@ func TestSMGDataLastUsedMultipleUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
if err := smgRPC.Call("SMGenericV1.GetActiveSessions", nil, &aSessions); err != nil {
|
||||
t.Error(err)
|
||||
@@ -345,13 +345,13 @@ func TestSMGDataLastUsedMultipleUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
if err := smgRPC.Call("SMGenericV1.GetActiveSessions", nil, &aSessions); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(aSessions) != 1 ||
|
||||
aSessions[0].Usage != time.Duration(14336) { // 14MB in use
|
||||
t.Errorf("wrong active sessions: %f", aSessions[0].Usage)
|
||||
t.Errorf("wrong active sessions: %v", aSessions[0].Usage)
|
||||
}
|
||||
smgEv = SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
@@ -376,7 +376,7 @@ func TestSMGDataLastUsedMultipleUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
if err := smgRPC.Call("SMGenericV1.GetActiveSessions",
|
||||
nil, &aSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
@@ -421,7 +421,7 @@ func TestSMGDataTTLExpired(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
@@ -480,7 +480,7 @@ func TestSMGDataTTLExpMultiUpdates(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
@@ -578,7 +578,7 @@ func TestSMGDataMultipleDataNoUsage(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
@@ -740,7 +740,7 @@ func TestSMGDataTTLUsageProtection(t *testing.T) {
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", acntAttrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", totalVal)
|
||||
t.Errorf("Expected: %f, received: %f",eAcntVal, totalVal)
|
||||
}
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
|
||||
Reference in New Issue
Block a user