Revise integration tests

This commit is contained in:
gezimbll
2023-11-17 11:32:56 -05:00
committed by Dan Christian Bogos
parent 031cf1fe43
commit 3403a91a2b
7 changed files with 18 additions and 20 deletions

View File

@@ -161,14 +161,13 @@ func TestSetGetRemoveConfigSectionsDrvMongo(t *testing.T) {
}
defer db.Close()
sectionIDs := []string{"thresholds", "resources"}
expected := make(map[string][]byte)
// Try to retrieve the values before setting them (should receive an empty map)
if rcv, err := db.GetConfigSectionsDrv(context.Background(), "1234", sectionIDs); err == nil ||
err.Error() != utils.ErrNotFound.Error() {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
} else if !reflect.DeepEqual(rcv, expected) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ToJSON(expected), utils.ToJSON(rcv))
} else if rcv != nil {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", nil, utils.ToJSON(rcv))
}
ms, err := utils.NewMarshaler(utils.JSON)
@@ -267,8 +266,8 @@ func TestSetGetRemoveConfigSectionsDrvMongo(t *testing.T) {
if rcv, err := db.GetConfigSectionsDrv(context.Background(), "1234", sectionIDs); err == nil ||
err.Error() != utils.ErrNotFound.Error() {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
} else if !reflect.DeepEqual(rcv, expected) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ToJSON(expected), utils.ToJSON(rcv))
} else if rcv != nil {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", nil, utils.ToJSON(rcv))
}
}