Revise integration tests

This commit is contained in:
gezimbll
2023-11-17 06:42:23 -05:00
committed by Dan Christian Bogos
parent 443cb81828
commit 5f801c8b67
2 changed files with 11 additions and 10 deletions

View File

@@ -111,8 +111,14 @@ func TestHttpJsonPoster(t *testing.T) {
} else if len(ev.Events) == 0 {
t.Fatal("Expected at least one event")
}
if !reflect.DeepEqual(jsn, ev.Events[0]) {
t.Errorf("Expecting: %q, received: %q", string(jsn), ev.Events[0])
evBody, cancast := ev.Events[0].(*HTTPPosterRequest)
if !cancast {
t.Error("Can't cast the event ")
}
if string(evBody.Body.([]uint8)) != string(jsn) {
t.Errorf("Expecting: %q, received: %q", utils.ToJSON(evBody.Body), utils.ToJSON(ev.Events[0]))
}
os.Remove(fs[0])
}

View File

@@ -1745,10 +1745,7 @@ func (ms *MongoStorage) SetDispatcherProfileDrv(r *DispatcherProfile) error {
func (ms *MongoStorage) RemoveDispatcherProfileDrv(tenant, id string) error {
return ms.query(func(sctx mongo.SessionContext) error {
dr, err := ms.getCol(ColDpp).DeleteOne(sctx, bson.M{"tenant": tenant, "id": id})
if dr.DeletedCount == 0 {
return utils.ErrNotFound
}
_, err := ms.getCol(ColDpp).DeleteOne(sctx, bson.M{"tenant": tenant, "id": id})
return err
})
}
@@ -1778,10 +1775,8 @@ func (ms *MongoStorage) SetDispatcherHostDrv(r *DispatcherHost) error {
func (ms *MongoStorage) RemoveDispatcherHostDrv(tenant, id string) error {
return ms.query(func(sctx mongo.SessionContext) error {
dr, err := ms.getCol(ColDph).DeleteOne(sctx, bson.M{"tenant": tenant, "id": id})
if dr.DeletedCount == 0 {
return utils.ErrNotFound
}
_, err := ms.getCol(ColDph).DeleteOne(sctx, bson.M{"tenant": tenant, "id": id})
return err
})
}