Commit Graph

4115 Commits

Author SHA1 Message Date
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
gezimbll
51af0635b0 Improving coverage test at engine 2023-03-15 11:43:43 +01:00
gezimbll
67d9c634f6 Improving coverage tests engine 2023-03-10 14:14:16 +01:00
ionutboangiu
d264dd1c5a Move Unguard one level up to avoid deadlock on the continue case 2023-03-10 14:07:59 +01:00
gezimbll
0f6ef42c2d improving coverage test at engine 2023-03-08 19:14:24 +01:00
gezimbll
8d2450ecea improving coverage tests at engine 2023-03-08 19:14:24 +01:00
gezimbll
7dcbd09a1f replacing non-meta constants for storage types 2023-03-08 19:14:24 +01:00
gezimbll
c5acb15d4a improving coverage tests at engine 2023-03-01 17:09:47 +01:00
gezimbll
951595d55d improving coverage tests at engine 2023-03-01 17:09:47 +01:00
ionutboangiu
db8f2e4826 Compare GetStorageType() output to the correct constant 2023-03-01 16:06:36 +01:00
ionutboangiu
dbd497c4d4 Update to latest amqp 1.0 package version and fix compilation errors 2023-02-22 18:19:47 +01:00
arberkatellari
8bef5ca2e4 Improved testing 2023-02-21 18:28:13 +01:00
ionutboangiu
edcb7d6e6b Update amqpv1 library and fix compilation errors 2023-02-21 18:26:01 +01:00
ionutboangiu
39d50fd211 Revise kafka writer definition 2023-02-20 19:45:08 +01:00
gezimbll
682904ad9d replacing streadway/amqp with rabbitmq/amqp091-go 2023-02-02 17:49:05 +01:00
gezimbll
795706b73c improving coverage at engine 2023-02-02 17:49:05 +01:00
gezimbll
46c4a22825 improving coverage at engine 2023-02-02 09:39:36 +01:00
gezimbll
2a1b696bf3 improving coverage at engine 2023-01-30 08:12:30 +01:00
adi
a551488cab Updated internal drv 2023-01-13 16:27:10 +01:00
adi
132d206266 Finished updates for mongo driver and tests 2023-01-07 17:49:13 +01:00
adi
5890d11279 Updated mongo driver and it tests 2023-01-07 17:49:13 +01:00
adi
c94ed8d123 Improved soME tests and driver 2022-12-27 18:29:32 +02:00
adi
be0caaa2ed No more unused loggers 2022-12-27 18:29:32 +02:00
adi
7914143f5e Remove oldIDx wden ctx is *any when overwriting 2022-12-20 18:28:20 +02:00
adi
a892ae4986 Improved constant in ComputeResourcesIdx 2022-12-20 18:28:20 +02:00
adi
74d2735e3b Remove old reverse idx when overwriting 2022-12-20 18:28:20 +02:00
adi
661e45d70b Improved compute idx code and remove filter 2022-12-20 18:28:20 +02:00
adi
d857079890 Dispatcher reverse filter indexes 2022-12-20 18:28:20 +02:00
adi
7ea41a6bc7 Added reverse filter indexes for attributes 2022-12-15 12:05:10 +02:00