Skip to content

Commit

Permalink
Revise integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gezimbll authored and danbogos committed Nov 30, 2023
1 parent 443cb81 commit 5f801c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 8 additions & 2 deletions ees/poster_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
Expand Down
11 changes: 3 additions & 8 deletions engine/storage_mongo_datadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down Expand Up @@ -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
})
}
Expand Down

0 comments on commit 5f801c8

Please sign in to comment.