From 66c3abfe6a67ccad449f066363f5d194f6d2a4bf Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 19 Feb 2018 09:14:55 -0500 Subject: [PATCH] Update integration test to be sync with go 1.10 --- agents/dmtagent_it_test.go | 2 +- cache/cache.go | 2 +- cdrc/csv_it_test.go | 4 ++-- cdrc/flatstore_it_test.go | 8 ++++---- cdrc/fwv_it_test.go | 2 +- cdrc/partialcsv_it_test.go | 6 +++--- cdrc/xml_it_test.go | 2 +- engine/storage_cdrs_it_test.go | 2 +- general_tests/multiplecdrc_it_test.go | 6 +++--- sessions/data_it_test.go | 24 ++++++++++++------------ 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/agents/dmtagent_it_test.go b/agents/dmtagent_it_test.go index af1497563..9c5f18acc 100644 --- a/agents/dmtagent_it_test.go +++ b/agents/dmtagent_it_test.go @@ -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) } } } diff --git a/cache/cache.go b/cache/cache.go index c209a3e23..cf654e022 100755 --- a/cache/cache.go +++ b/cache/cache.go @@ -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 } diff --git a/cdrc/csv_it_test.go b/cdrc/csv_it_test.go index af74c7f0f..2f94ccb52 100644 --- a/cdrc/csv_it_test.go +++ b/cdrc/csv_it_test.go @@ -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) diff --git a/cdrc/flatstore_it_test.go b/cdrc/flatstore_it_test.go index b2f1f2e60..426c1d44d 100644 --- a/cdrc/flatstore_it_test.go +++ b/cdrc/flatstore_it_test.go @@ -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"} { diff --git a/cdrc/fwv_it_test.go b/cdrc/fwv_it_test.go index c7b726b1a..edcaa2778 100644 --- a/cdrc/fwv_it_test.go +++ b/cdrc/fwv_it_test.go @@ -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) diff --git a/cdrc/partialcsv_it_test.go b/cdrc/partialcsv_it_test.go index 79c1e34bf..dca7edbd7 100644 --- a/cdrc/partialcsv_it_test.go +++ b/cdrc/partialcsv_it_test.go @@ -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) diff --git a/cdrc/xml_it_test.go b/cdrc/xml_it_test.go index 56b9e6f06..80aef8231 100644 --- a/cdrc/xml_it_test.go +++ b/cdrc/xml_it_test.go @@ -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) diff --git a/engine/storage_cdrs_it_test.go b/engine/storage_cdrs_it_test.go index 43cabf57a..b12b05cc7 100644 --- a/engine/storage_cdrs_it_test.go +++ b/engine/storage_cdrs_it_test.go @@ -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 { diff --git a/general_tests/multiplecdrc_it_test.go b/general_tests/multiplecdrc_it_test.go index 0d4d71df0..661902abb 100644 --- a/general_tests/multiplecdrc_it_test.go +++ b/general_tests/multiplecdrc_it_test.go @@ -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) diff --git a/sessions/data_it_test.go b/sessions/data_it_test.go index 9d0c5015b..c8ea6f686 100644 --- a/sessions/data_it_test.go +++ b/sessions/data_it_test.go @@ -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",