Updated tests

This commit is contained in:
Trial97
2021-05-26 09:10:28 +03:00
committed by Dan Christian Bogos
parent fc1c7e8c79
commit c58bb11a60
3 changed files with 76 additions and 76 deletions

View File

@@ -235,7 +235,7 @@ func TestMatchingStatQueuesForEvent(t *testing.T) {
dmSTS.SetStatQueueProfile(context.TODO(), statQueueProfile, true)
}
for _, statQueue := range stqs {
dmSTS.SetStatQueue(context.TODO(),statQueue)
dmSTS.SetStatQueue(context.TODO(), statQueue)
}
//Test each statQueueProfile from cache
for _, sqp := range sqps {
@@ -466,7 +466,7 @@ func TestStatQueuesProcessEvent(t *testing.T) {
dmSTS.SetStatQueueProfile(context.TODO(), statQueueProfile, true)
}
for _, statQueue := range stqs {
dmSTS.SetStatQueue(context.TODO(),statQueue)
dmSTS.SetStatQueue(context.TODO(), statQueue)
}
//Test each statQueueProfile from cache
for _, sqp := range sqps {
@@ -698,7 +698,7 @@ func TestStatQueuesMatchWithIndexFalse(t *testing.T) {
dmSTS.SetStatQueueProfile(context.TODO(), statQueueProfile, true)
}
for _, statQueue := range stqs {
dmSTS.SetStatQueue(context.TODO(),statQueue)
dmSTS.SetStatQueue(context.TODO(), statQueue)
}
//Test each statQueueProfile from cache
for _, sqp := range sqps {
@@ -930,7 +930,7 @@ func TestStatQueuesV1ProcessEvent(t *testing.T) {
dmSTS.SetStatQueueProfile(context.TODO(), statQueueProfile, true)
}
for _, statQueue := range stqs {
dmSTS.SetStatQueue(context.TODO(),statQueue)
dmSTS.SetStatQueue(context.TODO(), statQueue)
}
//Test each statQueueProfile from cache
for _, sqp := range sqps {
@@ -961,7 +961,7 @@ func TestStatQueuesV1ProcessEvent(t *testing.T) {
if err := dmSTS.SetStatQueueProfile(context.TODO(), sqPrf, true); err != nil {
t.Error(err)
}
if err := dmSTS.SetStatQueue(context.TODO(),sq); err != nil {
if err := dmSTS.SetStatQueue(context.TODO(), sq); err != nil {
t.Error(err)
}
if tempStat, err := dmSTS.GetStatQueueProfile(context.TODO(), sqPrf.Tenant,
@@ -1017,29 +1017,29 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
SQMetrics: map[string]StatMetric{utils.MetaTCC: sqm2},
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.RemoveStatQueue(sqp.Tenant, sqp.ID, utils.NonTransactional); err != nil {
if err := dm.RemoveStatQueue(context.Background(), sqp.Tenant, sqp.ID, utils.NonTransactional); err != nil {
t.Fatal(err)
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetStatQueue(sq); err != nil {
if err := dm.SetStatQueue(context.Background(), sq); err != nil {
t.Fatal(err)
}
@@ -1051,7 +1051,7 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
Metrics: []*MetricWithFilters{{MetricID: utils.MetaTCC, FilterIDs: []string{"*string:~*req.Account:1001"}}},
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
@@ -1065,13 +1065,13 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
SQItems: []SQItem{{EventID: "ev1"}},
SQMetrics: map[string]StatMetric{utils.MetaTCC: sqm3},
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetStatQueue(sq); err != nil {
if err := dm.SetStatQueue(context.Background(), sq); err != nil {
t.Fatal(err)
}
@@ -1085,7 +1085,7 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
SQMetrics: map[string]StatMetric{utils.MetaTCC: sqm2},
}
delete(sq.SQMetrics, utils.MetaTCD)
if err := dm.SetStatQueue(sq); err != nil {
if err := dm.SetStatQueue(context.Background(), sq); err != nil {
t.Fatal(err)
}
@@ -1098,16 +1098,16 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
MinItems: 5,
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetStatQueue(sq); err != nil {
if err := dm.SetStatQueue(context.Background(), sq); err != nil {
t.Fatal(err)
}
@@ -1121,17 +1121,17 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
TTL: 10,
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetStatQueue(sq); err != nil {
if err := dm.SetStatQueue(context.Background(), sq); err != nil {
t.Fatal(err)
}
@@ -1145,17 +1145,17 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
MinItems: 5,
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetStatQueue(sq); err != nil {
if err := dm.SetStatQueue(context.Background(), sq); err != nil {
t.Fatal(err)
}
@@ -1169,20 +1169,20 @@ func TestStatQueuesUpdateStatQueue(t *testing.T) {
MinItems: 5,
}
if err := dm.SetStatQueueProfile(sqp, true); err != nil {
if err := dm.SetStatQueueProfile(context.Background(), sqp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.RemoveStatQueueProfile(sqp.Tenant, sqp.ID, utils.NonTransactional, true); err != nil {
if err := dm.RemoveStatQueueProfile(context.Background(), sqp.Tenant, sqp.ID, utils.NonTransactional, true); err != nil {
t.Fatal(err)
}
if _, err := dm.GetStatQueue(sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != utils.ErrNotFound {
if _, err := dm.GetStatQueue(context.Background(), sqp.Tenant, sqp.ID, false, false, utils.NonTransactional); err != utils.ErrNotFound {
t.Fatal(err)
}
}

View File

@@ -529,13 +529,13 @@ func TestThresholdsProcessEvent(t *testing.T) {
}
dmTH.SetFilter(context.TODO(), fltrTh3, true)
for _, th := range tPrfls {
if err = dmTH.SetThresholdProfile(th, true); err != nil {
if err = dmTH.SetThresholdProfile(context.Background(),th, true); err != nil {
t.Errorf("Error: %+v", err)
}
}
//Test each threshold profile from cache
for _, th := range tPrfls {
if temptTh, err := dmTH.GetThresholdProfile(th.Tenant,
if temptTh, err := dmTH.GetThresholdProfile(context.Background(),th.Tenant,
th.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(th, temptTh) {
@@ -543,13 +543,13 @@ func TestThresholdsProcessEvent(t *testing.T) {
}
}
for _, th := range ths {
if err = dmTH.SetThreshold(th); err != nil {
if err = dmTH.SetThreshold(context.Background(),th); err != nil {
t.Errorf("Error: %+v", err)
}
}
//Test each threshold profile from cache
for _, th := range ths {
if temptTh, err := dmTH.GetThreshold(th.Tenant,
if temptTh, err := dmTH.GetThreshold(context.Background(),th.Tenant,
th.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(th, temptTh) {
@@ -721,13 +721,13 @@ func TestThresholdsVerifyIfExecuted(t *testing.T) {
}
dmTH.SetFilter(context.TODO(), fltrTh3, true)
for _, th := range tPrfls {
if err = dmTH.SetThresholdProfile(th, true); err != nil {
if err = dmTH.SetThresholdProfile(context.Background(),th, true); err != nil {
t.Errorf("Error: %+v", err)
}
}
//Test each threshold profile from cache
for _, th := range tPrfls {
if temptTh, err := dmTH.GetThresholdProfile(th.Tenant,
if temptTh, err := dmTH.GetThresholdProfile(context.Background(),th.Tenant,
th.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(th, temptTh) {
@@ -735,7 +735,7 @@ func TestThresholdsVerifyIfExecuted(t *testing.T) {
}
}
for _, th := range ths {
if err = dmTH.SetThreshold(th); err != nil {
if err = dmTH.SetThreshold(context.Background(),th); err != nil {
t.Errorf("Error: %+v", err)
}
}
@@ -934,13 +934,13 @@ func TestThresholdsProcessEvent2(t *testing.T) {
dmTH.SetFilter(context.TODO(), fltrTh3, true)
for _, th := range tPrfls {
if err = dmTH.SetThresholdProfile(th, true); err != nil {
if err = dmTH.SetThresholdProfile(context.Background(),th, true); err != nil {
t.Errorf("Error: %+v", err)
}
}
//Test each threshold profile from cache
for _, th := range tPrfls {
if temptTh, err := dmTH.GetThresholdProfile(th.Tenant,
if temptTh, err := dmTH.GetThresholdProfile(context.Background(),th.Tenant,
th.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(th, temptTh) {
@@ -948,13 +948,13 @@ func TestThresholdsProcessEvent2(t *testing.T) {
}
}
for _, th := range ths {
if err = dmTH.SetThreshold(th); err != nil {
if err = dmTH.SetThreshold(context.Background(),th); err != nil {
t.Errorf("Error: %+v", err)
}
}
//Test each threshold profile from cache
for _, th := range ths {
if temptTh, err := dmTH.GetThreshold(th.Tenant,
if temptTh, err := dmTH.GetThreshold(context.Background(),th.Tenant,
th.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(th, temptTh) {
@@ -981,19 +981,19 @@ func TestThresholdsProcessEvent2(t *testing.T) {
ThresholdIDs: []string{"TH_1", "TH_2", "TH_3", "TH_4"},
CGREvent: argsGetThresholds[0].CGREvent,
}
if err = dmTH.SetThresholdProfile(thPrf, true); err != nil {
if err = dmTH.SetThresholdProfile(context.Background(),thPrf, true); err != nil {
t.Errorf("Error: %+v", err)
}
if temptTh, err := dmTH.GetThresholdProfile(thPrf.Tenant,
if temptTh, err := dmTH.GetThresholdProfile(context.Background(),thPrf.Tenant,
thPrf.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(thPrf, temptTh) {
t.Errorf("Expecting: %+v, received: %+v", th, temptTh)
}
if err = dmTH.SetThreshold(th); err != nil {
if err = dmTH.SetThreshold(context.Background(),th); err != nil {
t.Errorf("Error: %+v", err)
}
if temptTh, err := dmTH.GetThreshold(th.Tenant,
if temptTh, err := dmTH.GetThreshold(context.Background(),th.Tenant,
th.ID, true, false, utils.NonTransactional); err != nil {
t.Errorf("Error: %+v", err)
} else if !reflect.DeepEqual(th, temptTh) {
@@ -1040,30 +1040,30 @@ func TestThresholdsUpdateThreshold(t *testing.T) {
ID: thp.ID,
}
if err := dm.SetThresholdProfile(thp, true); err != nil {
if err := dm.SetThresholdProfile(context.Background(), thp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetThreshold(thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetThreshold(context.Background(), thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.RemoveThreshold(th.Tenant, th.ID, utils.NonTransactional); err != nil {
if err := dm.RemoveThreshold(context.Background(), th.Tenant, th.ID, utils.NonTransactional); err != nil {
t.Fatal(err)
}
if err := dm.SetThresholdProfile(thp, true); err != nil {
if err := dm.SetThresholdProfile(context.Background(), thp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetThreshold(thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetThreshold(context.Background(), thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetThreshold(th); err != nil {
if err := dm.SetThreshold(context.Background(), th); err != nil {
t.Fatal(err)
}
thp = &ThresholdProfile{
@@ -1072,17 +1072,17 @@ func TestThresholdsUpdateThreshold(t *testing.T) {
MaxHits: 1,
}
if err := dm.SetThresholdProfile(thp, true); err != nil {
if err := dm.SetThresholdProfile(context.Background(), thp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetThreshold(thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetThreshold(context.Background(), thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetThreshold(th); err != nil {
if err := dm.SetThreshold(context.Background(), th); err != nil {
t.Fatal(err)
}
thp = &ThresholdProfile{
@@ -1092,17 +1092,17 @@ func TestThresholdsUpdateThreshold(t *testing.T) {
MinHits: 1,
}
if err := dm.SetThresholdProfile(thp, true); err != nil {
if err := dm.SetThresholdProfile(context.Background(), thp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetThreshold(thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetThreshold(context.Background(), thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.SetThreshold(th); err != nil {
if err := dm.SetThreshold(context.Background(), th); err != nil {
t.Fatal(err)
}
thp = &ThresholdProfile{
@@ -1113,19 +1113,19 @@ func TestThresholdsUpdateThreshold(t *testing.T) {
MinSleep: 1,
}
if err := dm.SetThresholdProfile(thp, true); err != nil {
if err := dm.SetThresholdProfile(context.Background(), thp, true); err != nil {
t.Fatal(err)
}
if th, err := dm.GetThreshold(thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
if th, err := dm.GetThreshold(context.Background(), thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(expTh, th) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expTh), utils.ToJSON(th))
}
if err := dm.RemoveThresholdProfile(thp.Tenant, thp.ID, utils.NonTransactional, true); err != nil {
if err := dm.RemoveThresholdProfile(context.Background(), thp.Tenant, thp.ID, utils.NonTransactional, true); err != nil {
t.Fatal(err)
}
if _, err := dm.GetThreshold(thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != utils.ErrNotFound {
if _, err := dm.GetThreshold(context.Background(), thp.Tenant, thp.ID, false, false, utils.NonTransactional); err != utils.ErrNotFound {
t.Fatal(err)
}
}

View File

@@ -3246,7 +3246,7 @@ func TestResourcesStoreResourceOK(t *testing.T) {
// dirty: utils.BoolPointer(true),
// }
// err := rS.StoreResource(r)
// err := rS.StoreResource(context.Background(),r)
// if err != nil {
// t.Errorf("\nexpected nil, received %+v", err)
@@ -3504,31 +3504,31 @@ func TestResourcesUpdateResource(t *testing.T) {
ID: res.ID,
Usages: make(map[string]*ResourceUsage),
}
if err := dm.SetResourceProfile(res, true); err != nil {
if err := dm.SetResourceProfile(context.Background(), res, true); err != nil {
t.Fatal(err)
}
if r, err := dm.GetResource(res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
if r, err := dm.GetResource(context.Background(), res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(r, expR) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expR), utils.ToJSON(r))
}
if err := dm.RemoveResource(r.Tenant, r.ID, utils.NonTransactional); err != nil {
if err := dm.RemoveResource(context.Background(), r.Tenant, r.ID, utils.NonTransactional); err != nil {
t.Fatal(err)
}
if err := dm.SetResourceProfile(res, true); err != nil {
if err := dm.SetResourceProfile(context.Background(), res, true); err != nil {
t.Fatal(err)
}
if r, err := dm.GetResource(res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
if r, err := dm.GetResource(context.Background(), res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(r, expR) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expR), utils.ToJSON(r))
}
if err := dm.SetResource(r); err != nil {
if err := dm.SetResource(context.Background(), r); err != nil {
t.Fatal(err)
}
@@ -3539,16 +3539,16 @@ func TestResourcesUpdateResource(t *testing.T) {
Limit: 5,
Stored: true,
}
if err := dm.SetResourceProfile(res, true); err != nil {
if err := dm.SetResourceProfile(context.Background(), res, true); err != nil {
t.Fatal(err)
}
if r, err := dm.GetResource(res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
if r, err := dm.GetResource(context.Background(), res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(r, expR) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expR), utils.ToJSON(r))
}
if err := dm.SetResource(r); err != nil {
if err := dm.SetResource(context.Background(), r); err != nil {
t.Fatal(err)
}
@@ -3559,16 +3559,16 @@ func TestResourcesUpdateResource(t *testing.T) {
Limit: 5,
Stored: true,
}
if err := dm.SetResourceProfile(res, true); err != nil {
if err := dm.SetResourceProfile(context.Background(), res, true); err != nil {
t.Fatal(err)
}
if r, err := dm.GetResource(res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
if r, err := dm.GetResource(context.Background(), res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(r, expR) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expR), utils.ToJSON(r))
}
if err := dm.SetResource(r); err != nil {
if err := dm.SetResource(context.Background(), r); err != nil {
t.Fatal(err)
}
@@ -3579,20 +3579,20 @@ func TestResourcesUpdateResource(t *testing.T) {
Limit: 5,
Stored: false,
}
if err := dm.SetResourceProfile(res, true); err != nil {
if err := dm.SetResourceProfile(context.Background(), res, true); err != nil {
t.Fatal(err)
}
if r, err := dm.GetResource(res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
if r, err := dm.GetResource(context.Background(), res.Tenant, res.ID, false, false, utils.NonTransactional); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(r, expR) {
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expR), utils.ToJSON(r))
}
if err := dm.RemoveResourceProfile(res.Tenant, res.ID, utils.NonTransactional, true); err != nil {
if err := dm.RemoveResourceProfile(context.Background(), res.Tenant, res.ID, utils.NonTransactional, true); err != nil {
t.Fatal(err)
}
if _, err := dm.GetResource(res.Tenant, res.ID, false, false, utils.NonTransactional); err != utils.ErrNotFound {
if _, err := dm.GetResource(context.Background(), res.Tenant, res.ID, false, false, utils.NonTransactional); err != utils.ErrNotFound {
t.Fatal(err)
}
}