mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Make sure reply is sorted before comparison for cdre tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
a285a3d497
commit
60929112fa
@@ -227,13 +227,14 @@ func testCDReExportCDRs2(t *testing.T) {
|
||||
Verbose: true,
|
||||
}
|
||||
var rply *RplExportedCDRs
|
||||
expExportedCdrs := []string{"Cdr7", "Cdr5"}
|
||||
expExportedCdrs := []string{"Cdr5", "Cdr7"}
|
||||
if err := cdreRPC.Call(utils.APIerSv1ExportCDRs, attr, &rply); err != nil {
|
||||
t.Error("Unexpected error: ", err.Error())
|
||||
} else if sort.Slice(rply.ExportedCGRIDs, func(i, j int) bool {
|
||||
return i < j
|
||||
}); !reflect.DeepEqual(rply.ExportedCGRIDs, expExportedCdrs) {
|
||||
t.Errorf("Expected CDRs %+v,Received %+v ", expExportedCdrs, rply.ExportedCGRIDs)
|
||||
} else {
|
||||
sort.Strings(rply.ExportedCGRIDs)
|
||||
if !reflect.DeepEqual(rply.ExportedCGRIDs, expExportedCdrs) {
|
||||
t.Errorf("Expected CDRs %+v,Received %+v ", expExportedCdrs, rply.ExportedCGRIDs)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -937,8 +937,11 @@ func testV2ExportCDRsToFile(t *testing.T) {
|
||||
expCgrIds := []string{"879cd5e698af", "9b3cd5e698af94"}
|
||||
if err := cdrsRpc.Call(utils.APIerSv2ExportCdrsToFile, attr, &replyExp); err != nil {
|
||||
t.Error(err)
|
||||
} else if sort.Slice(replyExp.ExportedCgrIds, func(i, j int) bool { return i < j }); !reflect.DeepEqual(expCgrIds, replyExp.ExportedCgrIds) {
|
||||
t.Errorf("Expected CgrsIds %+v,Received %+v", expCgrIds, replyExp.ExportedCgrIds)
|
||||
} else {
|
||||
sort.Strings(replyExp.ExportedCgrIds)
|
||||
if !reflect.DeepEqual(expCgrIds, replyExp.ExportedCgrIds) {
|
||||
t.Errorf("Expected CgrsIds %+v,Received %+v", expCgrIds, replyExp.ExportedCgrIds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user