Add error handler for Mongo GetCDrs remove

This commit is contained in:
arberkatellari
2023-05-25 07:08:04 -04:00
committed by Dan Christian Bogos
parent 57d5c27f58
commit f6a3af57dd
2 changed files with 17 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ var sTestsCdrIT = []func(t *testing.T){
testCdrITConnect,
testCdrITFlush,
testCdrITMigrateAndMove,
testMongoGetCdrsRemoveErr,
}
func TestCdrITMongo(t *testing.T) {
@@ -188,3 +189,16 @@ func testCdrITMigrateAndMove(t *testing.T) {
// t.Errorf("Expected 1, received: %v", cdrMigrator.stats[utils.CDRs])
// }
}
func testMongoGetCdrsRemoveErr(t *testing.T) {
cdrMigrator.Close()
expErr := "client is disconnected"
if cdrPathIn == "/usr/share/cgrates/conf/samples/tutmongo" {
_, _, err := cdrMigrator.storDBOut.StorDB().GetCDRs(new(utils.CDRsFilter), true)
if err == nil || err.Error() != expErr {
t.Errorf("Expected error <%v>, Received <%v>", expErr, err)
}
}
}