Commit Graph

4143 Commits

Author SHA1 Message Date
ionutboangiu
62619ba3a5 Replace interface{} with any 2023-06-05 10:55:32 +02:00
ionutboangiu
fbfb9fddd0 Revise exporter fields for fwv unit test 2023-06-05 10:55:32 +02:00
gezimbll
de2eaec25a Fixing tpexporter initialization of slices && testing errors for tpexporter 2023-05-31 10:21:02 +02:00
arberkatellari
43daf3efe5 Add error handler for Mongo GetCDrs remove 2023-05-25 11:35:53 +02:00
ionutboangiu
c7914f3bb3 Implement generic OrderedMap to keep track of csv/fwv record order 2023-05-25 08:41:26 +02:00
gezimbll
bda68b7a0d Revert slice initializiation with append 2023-05-24 09:59:41 +02:00
arberkatellari
e3cd50c26d Add case for AsExportMap field types 2023-05-23 08:20:37 +02:00
gezimbll
4e6da29569 Update toExportMap to initialize the slices with make() 2023-05-23 08:19:57 +02:00
gezimbll
a2633a7fd7 Improving coverage test at engine 2023-05-22 07:54:12 +02:00
ionutboangiu
a3a8c5a4a4 Make the FCTmpl.RoundingDecimals field a pointer
The purpose of this is to check whether RoundingDecimals was set from the fields configuration.
If it wasn't, we are going to be using the RoundingDecimals dictated by the general subsection.
2023-05-22 07:53:47 +02:00
ionutboangiu
6a6fefd0cd Improve cost formatting and parsing for CDRs
The FormatCost function in cdr.go now accepts an additional parameter of type *config.RSRParser. This is
then used to extract the value from its path as opposed to always using the value of the Cost field directly.

Improved the unit test for the FormatCost function. Now it has become a table-driven test and it handles
cases when the cost is retrieved from different fields other than  from the CDR.
2023-05-22 07:53:47 +02:00
gezimbll
b357dfa0df Improving coverage test at engine 2023-05-18 19:29:24 +02:00
gezimbll
021c860a81 Improving coverage tests at engine 2023-05-18 19:29:24 +02:00
gezimbll
4bfdebd48f Improving coverage tests at engine 2023-05-18 19:29:24 +02:00
gezimbll
00961123ff Improving coverage tests at engine 2023-05-18 19:29:24 +02:00
gezimbll
dc2741c025 Improving coverage tests 2023-05-10 10:40:13 +02:00
gezimbll
f67c9e2455 Improving coverage tests at engine 2023-05-10 10:40:13 +02:00
ionutboangiu
25fa01fee0 Solve compilation errors after library update 2023-05-07 19:25:19 +02:00
gezimbll
e142f5efd7 Improving coverage tests 2023-05-03 10:03:35 +02:00
gezimbll
f62dea0768 Improving coverage for unit tests 2023-05-03 10:03:35 +02:00
gezimbll
a86d01be6b Improving coverage tests at engine 2023-05-03 10:03:35 +02:00
gezimbll
569c59af53 Improving coverage of unit tests 2023-05-03 10:03:35 +02:00
gezimbll
47e1d470cd Improving coverage of unit test 2023-05-03 10:03:35 +02:00
gezimbll
9f56532a4c Improving coverage of unit tests 2023-05-03 10:03:35 +02:00
gezimbll
c4ca1d1315 Improving coverage of unit test 2023-05-03 10:03:35 +02:00
ionutboangiu
d8464ce023 Update libraries 2023-05-03 10:02:15 +02:00
ionutboangiu
85cc7e03f0 Enable bijson support for SessionSv1 service
Add bidirectional support for sessions while maintaining changing the
current rpc service registration method. Modified methods in
sessionsbirpc.go file to satisfy the birpc.ClientConnector interface
and removed BiRPC prefix before creating the service that's to be
registered.
2023-05-03 10:02:15 +02:00
ionutboangiu
259fb83c47 Add the implementation for Sleep api in sessions/sessions.go
Before the implementation was done directly in the SessionSv1 method. The argument definition
was also moved from apier/v1 to utils.
2023-05-03 10:02:15 +02:00
ionutboangiu
cb7ea790de Update rpcclient library to latest version
Replace all instances of rpcclient.ClientConnector with birpc.ClientConnector.

Pass context, maxReconnectInterval, delayFunc and birpcClient to rpcclient
constructors.

Remove redundant time.Duration conversions (e.g. time.Duration(1*time.Second)
now becomes time.Second.

Add context where needed (context.Background() for tests, context.TODO()
for places where it should be passed from somewhere else).

Implement that functionality of the SessionSv1.Sleep call, in sessions/sessions
instead of apier/v1.

Make changes in utils/server.go (replacing the old rpc2 library with github.com/cgrates/birpc).

Change the way we register birpc methods for sessions in services, using a helper function
defined in engine/libengine.go.
2023-05-03 10:02:15 +02:00
ionutboangiu
3ea21e43d7 Add inline filter validation before writing to database
Implement a function that takes as parameters a list of filters
and it checks only whether the inline filters are valid.

Add it inside the functions that load the profiles inside
the TPReader. This prevents the case where it returns error
after indexing had already started when it is already too
late.

Add unit tests for the implemented function.
2023-04-20 20:05:00 +02:00
ionutboangiu
4cd2dc3de8 Revise CDR rerating
The (*CDRServer).processEvent function is now called processEvents and can
be passed an array of CGREvents instead of only one. This was done because
when calling the RateCDRs API we want to first refund all CDRs before
starting to debit again.

The rerate parameter is now no longer hardcoded to true for the RateCDRs API.If
required, the "*rerate" flag must be provided by the caller.

Now, the refundEventCost function returns an additional boolean, that signals
whether the refund occured or didn't.

If the reRate parameter is set to true, also set refund to true.

In case CostDetails is not populated, retrieve it from StorDB if possible
and add it to the CGREvent before converting to CDRs. Set CostDetails back
to nil once the refund goes through.

Remove the refund logic from within the store block.

Now that the refund happens before the debit, revise the expected values for
the "testV1CDRsProcessEventWithRefund" subtest within the
apier/v1/cdrs_it_test.go file.

Add an integration test for the following scenario:
 -create one account with one balance of 1 free minute and rating for the rest.
 -send one CDR of two minutes with ProcessEvent. This should consume 60s out of
the free balance and charge 60s. The SetupTime in the CDR should be 1 hour after
the second CDR.
 -send the second CDR with an usage of 2m. This should be charged entirely.
 -send a RateCDR API call with OrderBy: "SetupTime". This should rerate the two
CDRs from above and change their order of rating.
2023-04-20 20:05:00 +02:00
gezimbll
5b0bc1d90b Improving coverage of unit tests 2023-04-17 11:23:46 +02:00
gezimbll
ddfded6c05 Improving unit tests coverage 2023-04-17 11:23:46 +02:00
gezimbll
8a6d262521 Improving coverage of unit tests 2023-04-17 11:23:46 +02:00
gezimbll
11d2b10423 Improving coverage of unit tests 2023-04-17 11:23:46 +02:00
gezimbll
ff8b23e93f Improving coverage of unit tests 2023-04-17 11:23:46 +02:00
gezimbll
ae037931d0 Improving coverage tests at engine 2023-04-06 11:49:37 +02:00
gezimbll
68b06d573a Improving Unit Test Coverage for Engine 2023-04-06 11:49:37 +02:00
gezimbll
4673b0023f Improving coverage of unit tests 2023-04-06 11:49:37 +02:00
gezimbll
3ef4dc693e Improving coverage tests at engine 2023-04-06 11:49:37 +02:00
gezimbll
65b07db6da Improving and adding unit tests 2023-03-28 17:59:51 +02:00
gezimbll
454c611b51 Improving unit tests 2023-03-28 17:59:51 +02:00
gezimbll
9e48ba08f9 Improving unit tests at engine 2023-03-28 17:59:51 +02:00
gezimbll
abc1285262 Adding test for ratingprofiles 2023-03-28 17:59:51 +02:00
gezimbll
2b52938bfb Adding and improving unit tests at engine 2023-03-28 17:59:51 +02:00
gezimbll
9adc103dff Improving & Adding unit tests at engine 2023-03-20 17:52:04 +01:00
gezimbll
39393aecb7 Improving coverage for unit tests 2023-03-19 20:48:14 +01:00
gezimbll
35091a5538 Adding unit tests at engine 2023-03-19 20:48:14 +01:00
gezimbll
e822a5ae63 Improving coverage test at engine 2023-03-15 17:44:46 +01:00
gezimbll
c5abf600cf Improving coverage tests at engine 2023-03-15 11:43:43 +01:00