Solve struct literal uses unkeyed fields warning

This commit is contained in:
ionutboangiu
2023-07-14 11:01:07 -04:00
committed by Dan Christian Bogos
parent c4e820457b
commit f2214052b6
3 changed files with 16 additions and 7 deletions

View File

@@ -866,7 +866,7 @@ func testV1SplSGetSupplierProfileIDs(t *testing.T) {
"SPL_ACNT_1001", "SPL_LEASTCOST_1", "SPL_WEIGHT_2", "SPL_WEIGHT_1", "SPL_QOS_3", "TEST_PROFILE1", "SPL_LCR"}
var result []string
if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfileIDs,
&utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil {
&utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil {
t.Error(err)
} else if len(expected) != len(result) {
t.Errorf("Expecting : %+v, received: %+v", expected, result)

View File

@@ -381,7 +381,7 @@ func testV1TSGetThresholdsAfterRestart(t *testing.T) {
func testv1TSGetThresholdProfileIDs(t *testing.T) {
expected := []string{"THD_STATS_1", "THD_STATS_2", "THD_STATS_3", "THD_RES_1", "THD_CDRS_1", "THD_ACNT_BALANCE_1", "THD_ACNT_EXPIRED"}
var result []string
if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil {
if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil {
t.Error(err)
} else if len(expected) != len(result) {
t.Errorf("Expecting : %+v, received: %+v", expected, result)

View File

@@ -81,14 +81,23 @@ func (v1ms *mongoStorDBMigrator) renameV1SMCosts() (err error) {
return err
}
return v1ms.mgoDB.DB().RunCommand(v1ms.mgoDB.GetContext(),
bson.D{{"create", utils.SessionCostsTBL}}).Err()
bson.D{{Key: "create", Value: utils.SessionCostsTBL}}).Err()
}
func (v1ms *mongoStorDBMigrator) createV1SMCosts() (err error) {
v1ms.mgoDB.DB().Collection(utils.OldSMCosts).Drop(v1ms.mgoDB.GetContext())
v1ms.mgoDB.DB().Collection(utils.SessionCostsTBL).Drop(v1ms.mgoDB.GetContext())
func (v1ms *mongoStorDBMigrator) createV1SMCosts() error {
err := v1ms.mgoDB.DB().Collection(utils.OldSMCosts).Drop(v1ms.mgoDB.GetContext())
if err != nil {
return err
}
err = v1ms.mgoDB.DB().Collection(utils.SessionCostsTBL).Drop(v1ms.mgoDB.GetContext())
if err != nil {
return err
}
return v1ms.mgoDB.DB().RunCommand(v1ms.mgoDB.GetContext(),
bson.D{{"create", utils.OldSMCosts}, {"size", 1024}, {"capped", true}}).Err()
bson.D{
{Key: "create", Value: utils.OldSMCosts},
{Key: "size", Value: 1024},
{Key: "capped", Value: true}}).Err()
}
// get