From 6c67c881b3fbfb8f259c050ec71223b16eaed6fd Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Fri, 16 Apr 2021 12:44:58 +0300 Subject: [PATCH] Change time.Local to time.UTC and cover funcs in engine --- engine/callcost_test.go | 28 ++--- engine/calldesc_test.go | 28 ++--- engine/eventcost_test.go | 224 +++++++++++++++++++++++++++++++++++++-- engine/libstats_test.go | 19 ++-- 4 files changed, 252 insertions(+), 47 deletions(-) diff --git a/engine/callcost_test.go b/engine/callcost_test.go index f597adf6d..6b36f321a 100644 --- a/engine/callcost_test.go +++ b/engine/callcost_test.go @@ -213,14 +213,14 @@ func TestCallcostCallCostToDataCost(t *testing.T) { Timespans: TimeSpans{ { DurationIndex: 10, - TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.Local), - TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.UTC), + TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), ratingInfo: &RatingInfo{ MatchedSubject: "1001", RatingPlanId: "RP_1001", MatchedPrefix: "1001", MatchedDestId: "1002", - ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), RateIntervals: RateIntervalList{ { Weight: 10, @@ -491,14 +491,14 @@ func TestCallcostAsJSON(t *testing.T) { Timespans: TimeSpans{ { DurationIndex: 10, - TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.Local), - TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.UTC), + TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), ratingInfo: &RatingInfo{ MatchedSubject: "1001", RatingPlanId: "RP_1001", MatchedPrefix: "1001", MatchedDestId: "1002", - ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), RateIntervals: RateIntervalList{ { Weight: 10, @@ -611,7 +611,7 @@ func TestCallcostAsJSON(t *testing.T) { }, } - exp := `{"Category":"call","Tenant":"cgrates.org","Subject":"1001","Account":"1001","Destination":"1002","ToR":"*voice","Cost":10,"Timespans":[{"TimeStart":"2021-01-01T10:25:00+02:00","TimeEnd":"2021-01-01T10:30:00+02:00","Cost":15,"RateInterval":{"Timing":{"ID":"ritTimingID","Years":null,"Months":null,"MonthDays":null,"WeekDays":null,"StartTime":"","EndTime":""},"Rating":{"ConnectFee":15,"RoundingMethod":"up","RoundingDecimals":1,"MaxCost":100,"MaxCostStrategy":"*disconnect","Rates":[{"GroupIntervalStart":30000000000,"Value":5,"RateIncrement":60000000000,"RateUnit":60000000000},{"GroupIntervalStart":60000000000,"Value":5,"RateIncrement":1000000000,"RateUnit":60000000000}]},"Weight":10},"DurationIndex":10,"Increments":[{"Duration":24000000000,"Cost":20,"BalanceInfo":{"Unit":{"UUID":"unitUUID2","ID":"1001","Value":10,"DestinationID":"1002","Consumed":20,"ToR":"*voice","RateInterval":{"Timing":{"ID":"","Years":null,"Months":null,"MonthDays":null,"WeekDays":null,"StartTime":"","EndTime":""},"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":null},"Weight":15}},"Monetary":null,"AccountID":""},"CompressFactor":2}],"RoundIncrement":{"Duration":12000000000,"Cost":15,"BalanceInfo":{"Unit":{"UUID":"unitUUID1","ID":"1001","Value":10,"DestinationID":"1002","Consumed":20,"ToR":"*voice","RateInterval":{"Timing":{"ID":"","Years":null,"Months":null,"MonthDays":null,"WeekDays":null,"StartTime":"","EndTime":""},"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":null},"Weight":10}},"Monetary":null,"AccountID":""},"CompressFactor":2},"MatchedSubject":"1001","MatchedPrefix":"1001","MatchedDestId":"1002","RatingPlanId":"RP_1001","CompressFactor":5}],"RatedUsage":0,"AccountSummary":null}` + exp := `{"Category":"call","Tenant":"cgrates.org","Subject":"1001","Account":"1001","Destination":"1002","ToR":"*voice","Cost":10,"Timespans":[{"TimeStart":"2021-01-01T10:25:00Z","TimeEnd":"2021-01-01T10:30:00Z","Cost":15,"RateInterval":{"Timing":{"ID":"ritTimingID","Years":null,"Months":null,"MonthDays":null,"WeekDays":null,"StartTime":"","EndTime":""},"Rating":{"ConnectFee":15,"RoundingMethod":"up","RoundingDecimals":1,"MaxCost":100,"MaxCostStrategy":"*disconnect","Rates":[{"GroupIntervalStart":30000000000,"Value":5,"RateIncrement":60000000000,"RateUnit":60000000000},{"GroupIntervalStart":60000000000,"Value":5,"RateIncrement":1000000000,"RateUnit":60000000000}]},"Weight":10},"DurationIndex":10,"Increments":[{"Duration":24000000000,"Cost":20,"BalanceInfo":{"Unit":{"UUID":"unitUUID2","ID":"1001","Value":10,"DestinationID":"1002","Consumed":20,"ToR":"*voice","RateInterval":{"Timing":{"ID":"","Years":null,"Months":null,"MonthDays":null,"WeekDays":null,"StartTime":"","EndTime":""},"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":null},"Weight":15}},"Monetary":null,"AccountID":""},"CompressFactor":2}],"RoundIncrement":{"Duration":12000000000,"Cost":15,"BalanceInfo":{"Unit":{"UUID":"unitUUID1","ID":"1001","Value":10,"DestinationID":"1002","Consumed":20,"ToR":"*voice","RateInterval":{"Timing":{"ID":"","Years":null,"Months":null,"MonthDays":null,"WeekDays":null,"StartTime":"","EndTime":""},"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":null},"Weight":10}},"Monetary":null,"AccountID":""},"CompressFactor":2},"MatchedSubject":"1001","MatchedPrefix":"1001","MatchedDestId":"1002","RatingPlanId":"RP_1001","CompressFactor":5}],"RatedUsage":0,"AccountSummary":null}` rcv := cc.AsJSON() if rcv != exp { @@ -625,14 +625,14 @@ func TestCallcostUpdateCost(t *testing.T) { Timespans: TimeSpans{ { DurationIndex: 10, - TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.Local), - TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.UTC), + TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), ratingInfo: &RatingInfo{ MatchedSubject: "1001", RatingPlanId: "RP_1001", MatchedPrefix: "1001", MatchedDestId: "1002", - ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), RateIntervals: RateIntervalList{ { Weight: 10, @@ -772,14 +772,14 @@ func TestCallcostGetStartTime(t *testing.T) { Timespans: TimeSpans{ { DurationIndex: 10, - TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.Local), - TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + TimeStart: time.Date(2021, 1, 1, 10, 25, 0, 0, time.UTC), + TimeEnd: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), ratingInfo: &RatingInfo{ MatchedSubject: "1001", RatingPlanId: "RP_1001", MatchedPrefix: "1001", MatchedDestId: "1002", - ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.Local), + ActivationTime: time.Date(2021, 1, 1, 10, 30, 0, 0, time.UTC), RateIntervals: RateIntervalList{ { Weight: 10, @@ -892,7 +892,7 @@ func TestCallcostGetStartTime(t *testing.T) { }, } - exp := time.Date(2021, 1, 1, 10, 25, 0, 0, time.Local) + exp := time.Date(2021, 1, 1, 10, 25, 0, 0, time.UTC) rcv := cc.GetStartTime() if rcv != exp { diff --git a/engine/calldesc_test.go b/engine/calldesc_test.go index e195aeff3..f1d0dee20 100644 --- a/engine/calldesc_test.go +++ b/engine/calldesc_test.go @@ -2126,7 +2126,7 @@ func TestCalldescNewCallDescriptorFromCGREventInvalidAnswerTime(t *testing.T) { utils.Category: "catField", utils.AccountField: "accField", utils.Destination: "destField", - utils.SetupTime: time.Date(2021, 1, 1, 23, 59, 59, 0, time.Local), + utils.SetupTime: time.Date(2021, 1, 1, 23, 59, 59, 0, time.UTC), utils.AnswerTime: 5, }, } @@ -2151,8 +2151,8 @@ func TestCalldescNewCallDescriptorFromCGREventNoUsage(t *testing.T) { utils.Category: "catField", utils.AccountField: "accField", utils.Destination: "destField", - utils.SetupTime: time.Date(2021, 1, 1, 23, 59, 59, 0, time.Local), - utils.AnswerTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + utils.SetupTime: time.Date(2021, 1, 1, 23, 59, 59, 0, time.UTC), + utils.AnswerTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), }, } timezone := "UTC" @@ -2176,8 +2176,8 @@ func TestCalldescNewCallDescriptorFromCGREvent(t *testing.T) { utils.Category: "catField", utils.AccountField: "accField", utils.Destination: "destField", - utils.SetupTime: time.Date(2021, 1, 1, 23, 59, 59, 0, time.Local), - utils.AnswerTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + utils.SetupTime: time.Date(2021, 1, 1, 23, 59, 59, 0, time.UTC), + utils.AnswerTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), utils.Usage: 100, utils.ToR: utils.MetaVoice, }, @@ -2190,8 +2190,8 @@ func TestCalldescNewCallDescriptorFromCGREvent(t *testing.T) { Subject: "accField", Account: "accField", Destination: "destField", - TimeStart: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), - TimeEnd: time.Date(2021, 1, 5, 23, 59, 59, 100, time.Local), + TimeStart: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), + TimeEnd: time.Date(2021, 1, 5, 23, 59, 59, 100, time.UTC), ToR: utils.MetaVoice, Tenant: "cgrates.org", } @@ -2212,8 +2212,8 @@ func TestCalldescAsCGREvent(t *testing.T) { Subject: "accField", Account: "accField", Destination: "destField", - TimeStart: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), - TimeEnd: time.Date(2021, 1, 5, 23, 59, 59, 100, time.Local), + TimeStart: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), + TimeEnd: time.Date(2021, 1, 5, 23, 59, 59, 100, time.UTC), ToR: utils.MetaVoice, Tenant: "cgrates.org", ExtraFields: map[string]string{ @@ -2230,7 +2230,7 @@ func TestCalldescAsCGREvent(t *testing.T) { utils.Subject: "accField", utils.AccountField: "accField", utils.Destination: "destField", - utils.AnswerTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + utils.AnswerTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), utils.Usage: 100 * time.Nanosecond, utils.ToR: utils.MetaVoice, utils.Tenant: "cgrates.org", @@ -2263,7 +2263,7 @@ func TestCalldescAddRatingInfo(t *testing.T) { RatingPlanId: "RP_1001", MatchedPrefix: "1001", MatchedDestId: "1002", - ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), RateIntervals: RateIntervalList{ { Rating: &RIRate{ @@ -2290,7 +2290,7 @@ func TestCalldescAddRatingInfo(t *testing.T) { RatingPlanId: "RP_1002", MatchedPrefix: "1002", MatchedDestId: "1003", - ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), RateIntervals: RateIntervalList{ { Rating: &RIRate{ @@ -2326,7 +2326,7 @@ func TestCalldescAddRatingInfo(t *testing.T) { RatingPlanId: "RP_1001", MatchedPrefix: "1001", MatchedDestId: "1002", - ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), RateIntervals: RateIntervalList{ { Rating: &RIRate{ @@ -2353,7 +2353,7 @@ func TestCalldescAddRatingInfo(t *testing.T) { RatingPlanId: "RP_1002", MatchedPrefix: "1002", MatchedDestId: "1003", - ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.Local), + ActivationTime: time.Date(2021, 1, 5, 23, 59, 59, 0, time.UTC), RateIntervals: RateIntervalList{ { Rating: &RIRate{ diff --git a/engine/eventcost_test.go b/engine/eventcost_test.go index b3f409f03..7050a116d 100644 --- a/engine/eventcost_test.go +++ b/engine/eventcost_test.go @@ -3882,7 +3882,7 @@ func TestECAsRefundIncrementsNoCharges(t *testing.T) { Charges: []*ChargingInterval{}, CGRID: "asdfgh", RunID: "runID", - StartTime: time.Date(2021, 4, 13, 17, 0, 0, 0, time.Local), + StartTime: time.Date(2021, 4, 13, 17, 0, 0, 0, time.UTC), Usage: utils.DurationPointer(time.Hour), Cost: utils.Float64Pointer(10), } @@ -3891,8 +3891,8 @@ func TestECAsRefundIncrementsNoCharges(t *testing.T) { CgrID: "asdfgh", RunID: "runID", ToR: utils.MetaVoice, - TimeStart: time.Date(2021, 4, 13, 17, 0, 0, 0, time.Local), - TimeEnd: time.Date(2021, 4, 13, 18, 0, 0, 0, time.Local), + TimeStart: time.Date(2021, 4, 13, 17, 0, 0, 0, time.UTC), + TimeEnd: time.Date(2021, 4, 13, 18, 0, 0, 0, time.UTC), DurationIndex: time.Hour, } @@ -3922,7 +3922,7 @@ func TestECAsRefundIncrements2(t *testing.T) { }, CGRID: "asdfgh", RunID: "runID", - StartTime: time.Date(2021, 4, 13, 17, 0, 0, 0, time.Local), + StartTime: time.Date(2021, 4, 13, 17, 0, 0, 0, time.UTC), Usage: utils.DurationPointer(time.Hour), Cost: utils.Float64Pointer(10), Accounting: Accounting{ @@ -3954,8 +3954,8 @@ func TestECAsRefundIncrements2(t *testing.T) { CgrID: "asdfgh", RunID: "runID", ToR: utils.MetaVoice, - TimeStart: time.Date(2021, 4, 13, 17, 0, 0, 0, time.Local), - TimeEnd: time.Date(2021, 4, 13, 18, 0, 0, 0, time.Local), + TimeStart: time.Date(2021, 4, 13, 17, 0, 0, 0, time.UTC), + TimeEnd: time.Date(2021, 4, 13, 18, 0, 0, 0, time.UTC), DurationIndex: time.Hour, Increments: Increments{ { @@ -3977,3 +3977,215 @@ func TestECAsRefundIncrements2(t *testing.T) { t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, rcv) } } + +func TestECratingGetIDFromEventCostPause(t *testing.T) { + ec := &EventCost{ + Timings: ChargedTimings{ + utils.MetaPause: &ChargedTiming{}, + }, + RatingFilters: RatingFilters{ + utils.MetaPause: RatingMatchedFilters{}, + }, + Rates: ChargedRates{ + utils.MetaPause: RateGroups{}, + }, + Rating: Rating{ + utils.MetaPause: &RatingUnit{}, + }, + } + oEC := &EventCost{ + Rating: Rating{ + utils.MetaPause: &RatingUnit{ + ConnectFee: 0.4, + RoundingMethod: "*up", + RoundingDecimals: 4, + MaxCost: 100, + MaxCostStrategy: "*disconnect", + TimingID: "TM_NOON", + }, + }, + Timings: ChargedTimings{ + utils.MetaPause: &ChargedTiming{ + Years: utils.Years{2010, 2011}, + Months: utils.Months{1, 2}, + MonthDays: utils.MonthDays{24, 25}, + WeekDays: utils.WeekDays{2}, + StartTime: "00:00:00", + }, + }, + } + oRatingID := utils.MetaPause + + exp := utils.MetaPause + rcv := ec.ratingGetIDFromEventCost(oEC, oRatingID) + + if rcv != exp { + t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, rcv) + } +} + +func TestECaccountingGetIDFromEventCostPause(t *testing.T) { + ec := &EventCost{ + Timings: ChargedTimings{ + utils.MetaPause: &ChargedTiming{}, + }, + RatingFilters: RatingFilters{ + utils.MetaPause: RatingMatchedFilters{}, + }, + Rates: ChargedRates{ + utils.MetaPause: RateGroups{}, + }, + Rating: Rating{ + utils.MetaPause: &RatingUnit{}, + }, + Accounting: Accounting{ + utils.MetaPause: &BalanceCharge{}, + }, + } + oEC := &EventCost{ + Accounting: Accounting{ + utils.MetaPause: &BalanceCharge{ + AccountID: "1001", + BalanceUUID: "asdfg", + RatingID: utils.MetaPause, + Units: 10, + ExtraChargeID: "extra", + }, + }, + Rating: Rating{ + utils.MetaPause: &RatingUnit{ + ConnectFee: 0.4, + RoundingMethod: "*up", + RoundingDecimals: 4, + MaxCost: 100, + MaxCostStrategy: "*disconnect", + TimingID: "TM_NOON", + }, + }, + } + oAccountingID := utils.MetaPause + + exp := utils.MetaPause + rcv := ec.accountingGetIDFromEventCost(oEC, oAccountingID) + + if rcv != exp { + t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, rcv) + } +} + +func TestECappendChargingIntervalFromEventCost(t *testing.T) { + ec := &EventCost{ + Charges: []*ChargingInterval{ + { + RatingID: "RT_ID", + CompressFactor: 1, + }, + }, + } + oEC := &EventCost{ + Charges: []*ChargingInterval{ + {}, + { + RatingID: "RT_ID", + }, + }, + } + + cIlIdx := 1 + + exp := &EventCost{ + Charges: []*ChargingInterval{ + { + RatingID: "RT_ID", + CompressFactor: 2, + }, + }, + } + ec.appendChargingIntervalFromEventCost(oEC, cIlIdx) + + if !reflect.DeepEqual(ec, exp) { + t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, ec) + } +} + +func TestECratingIDForRateIntervalPause(t *testing.T) { + ec := &EventCost{ + RatingFilters: RatingFilters{}, + Rating: Rating{}, + Rates: ChargedRates{}, + } + ri := &RateInterval{ + Rating: &RIRate{ + ConnectFee: 0.4, + RoundingMethod: "*up", + MaxCost: 100, + MaxCostStrategy: "*disconnect", + RoundingDecimals: 4, + Rates: RateGroups{ + { + RateIncrement: 60, + RateUnit: 60, + Value: 10, + GroupIntervalStart: 1, + }, + }, + }, + } + rf := RatingMatchedFilters{ + "key": "filter", + } + + exp := utils.MetaPause + expEC := &EventCost{ + Rating: Rating{ + utils.MetaPause: &RatingUnit{ + ConnectFee: 0.4, + RoundingMethod: "*up", + MaxCost: 100, + MaxCostStrategy: "*disconnect", + RoundingDecimals: 4, + RatesID: utils.MetaPause, + RatingFiltersID: utils.MetaPause, + }, + }, + RatingFilters: RatingFilters{ + utils.MetaPause: RatingMatchedFilters{ + "key": "filter", + }, + }, + Rates: ChargedRates{ + utils.MetaPause: RateGroups{ + { + RateIncrement: 60, + RateUnit: 60, + Value: 10, + GroupIntervalStart: 1, + }, + }, + }, + } + rcv := ec.ratingIDForRateInterval(ri, rf, true) + + if rcv != exp { + t.Fatalf("\nexpected: <%+v>, \nreceived: <%+v>", exp, rcv) + } + + if !reflect.DeepEqual(ec, expEC) { + t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", expEC, ec) + } + +} + +// func TestECAsCallCost4(t *testing.T) { +// ec := &EventCost{} +// tor := "" + +// exp := &CallCost{ +// ToR: utils.MetaVoice, +// } +// rcv := ec.AsCallCost(tor) + +// if !reflect.DeepEqual(rcv, exp) { +// t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, rcv) +// } +// } diff --git a/engine/libstats_test.go b/engine/libstats_test.go index f34b7cbfc..becca2317 100644 --- a/engine/libstats_test.go +++ b/engine/libstats_test.go @@ -966,7 +966,7 @@ func TestLibstatsNewStatQueue(t *testing.T) { func TestLibstatsProcessEventremExpiredErr(t *testing.T) { tnt, evID := "tenant", "eventID" filters := &FilterS{} - expiry := time.Date(2021, 1, 1, 23, 59, 59, 10, time.Local) + expiry := time.Date(2021, 1, 1, 23, 59, 59, 10, time.UTC) evNm := utils.MapStorage{ "key": nil, } @@ -1063,10 +1063,10 @@ func TestLibstatsCompress(t *testing.T) { } ttl := time.Millisecond - expiryTime1 := time.Date(2021, 1, 1, 23, 59, 59, 0, time.Local) - expiryTime2 := time.Date(2021, 1, 2, 23, 59, 59, 0, time.Local) - expiryTime3 := time.Date(2021, 1, 3, 23, 59, 59, 0, time.Local) - expiryTime4 := time.Date(2021, 1, 4, 23, 59, 59, 0, time.Local) + expiryTime1 := time.Date(2021, 1, 1, 23, 59, 59, 0, time.UTC) + expiryTime2 := time.Date(2021, 1, 2, 23, 59, 59, 0, time.UTC) + expiryTime3 := time.Date(2021, 1, 3, 23, 59, 59, 0, time.UTC) + expiryTime4 := time.Date(2021, 1, 4, 23, 59, 59, 0, time.UTC) sq := &StatQueue{ SQItems: []SQItem{ { @@ -1172,7 +1172,7 @@ func TestLibstatsaddStatEventPassErr(t *testing.T) { } } -func TestLibstatsaddStatEvent2(t *testing.T) { +func TestLibstatsaddStatEventNoPass(t *testing.T) { sm, err := NewStatMetric(utils.MetaTCD, 0, []string{"*string:~*req.Account:1001"}) if err != nil { t.Fatal(err) @@ -1224,10 +1224,3 @@ func TestLibstatsaddStatEvent2(t *testing.T) { t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, sq) } } - -// func TestLibstatsLockUnlock(t *testing.T) { -// sq := &StatQueue{} -// sq.lk.Lock() -// sq.ID = "id" -// sq.lk.Unlock() -// }