Commit Graph

771 Commits

Author SHA1 Message Date
ionutboangiu
90a60c571b Consider the CostDetails cost instead for session rounding test 2023-07-21 09:01:46 +02:00
ionutboangiu
79215c824c Add test for costdetails failed searchreplace scenario 2023-07-12 17:06:16 +02:00
ionutboangiu
1f315c7493 Make small revision to comment structure 2023-07-10 13:58:21 +02:00
ionutboangiu
cfd9610e4a Add integration test for the shared client deadlock issue 2023-07-10 13:58:21 +02:00
ionutboangiu
b7d172f78a Fix misspellings 2023-06-21 11:02:39 +02:00
ionutboangiu
3935a72605 Remove executable bit from .go files 2023-06-16 10:24:13 +02:00
ionutboangiu
69b1e9279a Revise test to check for panic in case of rerate for a 0 cost CDR 2023-06-12 14:18:37 +02:00
ionutboangiu
62619ba3a5 Replace interface{} with any 2023-06-05 10:55:32 +02:00
ionutboangiu
82c13639b0 Revise test after tp update 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
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
ionutboangiu
15b404e8cf Revise randomly failing tests 2023-03-28 17:59:32 +02:00
ionutboangiu
5bf525d4c0 Revise failing integration tests from general_tests
The time it takes to register RPC methods is quite long and sometimes it is causing errors when methods that are not yet registered are being called. Therefore, the 'waitRater' default value has been increased from 100ms to 500ms.

For 'cdrs_onlexp_it_test.go':
- 2 functions have been added that create and delete the kafka topic relevant to the test. This ensures that the topic exists before export and also that it is deleted to avoid the data from within to influence subsequent tests;
- the maximum duration that we are waiting for the amqp messages to be consumed has been increased. Since it usually takes anywhere between 300ms and 1.9s to read a message, it has been increased to 2 seconds;
- amqp queues are now deleted once we are done verifying the exports.

For 'cdrs_post_failover_it_test.go', we now make sure that the failed posts directories exist and are empty before starting the engine.

For 'cdrs_processevent_it_test.go':
- some of the stat queue items were expiring too quickly, causing the test for fail sometimes. In order to solve the issue, I had to modify increase the TTL, but since the 'testit' tariff plan is also used by other tests, I decided to create the .csv files within the test, taking from 'testit' only the relevant information;
- same issue as in the previous test was occuring here. Was fixed in the same way;
- removed some useless calls.
2023-03-19 19:32:25 +01:00
ionutboangiu
50a2bdc505 Add test to compare costs between *prepaid and *postpaid calls 2023-03-01 16:06:36 +01:00
gezimbll
682904ad9d replacing streadway/amqp with rabbitmq/amqp091-go 2023-02-02 17:49:05 +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
b966527cf2 finished all cases in idx test 2022-12-27 18:29:32 +02:00
adi
5a3a3a3e7f Tested all features and different cases 2022-12-20 18:28:20 +02:00
adi
4449e9ffc6 Dispatcher overwrite indx with context 2022-12-20 18:28:20 +02:00
adi
8f0edf5293 Tested the improvement and reverse idx 2022-12-20 18:28:20 +02:00
adi
7496902d93 Dispatcher and resources tests cases 2022-12-20 18:28:20 +02:00
adi
db4912e330 Added supplier filter indexes 2022-12-15 12:05:10 +02:00
adi
721bacdd55 Started tested resources indexes code 2022-12-13 17:10:47 +02:00
adi
4c3d1b60a0 Improved reverse idx code + thresholds implementation and tests 2022-12-12 11:15:43 +02:00
adi
1224073c61 Finished updating indexes for fitlers + tests without computing 2022-12-12 11:15:43 +02:00
adi
5914213c96 Update filters without computing when overwriting + chargers case 2022-12-09 13:27:28 +02:00
adi
4ec5e420b0 Remove reverse filter indexes 2022-12-07 17:32:20 +02:00
adi
a9f0a3244a Multiple filters for a charger + tests on reverse fltrIDx side 2022-12-07 17:32:20 +02:00
adi
aeb1cf349a Reverse filter indexes updates + tests 2022-12-06 11:40:38 +02:00
adi
c9a9857152 Added relevant paratheses 2022-12-02 18:39:29 +02:00
ionutboangiu
1436bac61c Remove unnecessary paranthesis 2022-12-02 14:24:18 +02:00
ionutboangiu
a748ab629e Apply gofmt simplify code 2022-12-02 14:24:18 +02:00
ionutboangiu
82468c580d Replace deprecated ioutil library, remove redundant statements + small optimizations 2022-12-02 14:24:18 +02:00
adi
98a044b3fe Started to add reverse filter indexes 2022-11-30 15:08:57 +02:00
adi
dfd1b3343d Compute indexes when filter is overwritten 2022-11-30 15:08:57 +02:00
adi
f72ff28fd7 Indexes when fltr is overwritten 2022-11-30 15:08:57 +02:00
adi
526903a70b Improved code for indexes of *none type + tests 2022-11-30 15:08:57 +02:00
adi
6285d92f29 Indexes various combination in tests 2022-11-22 13:59:02 +02:00
ionutboangiu
758a94280a Apply project wide fmt 2022-11-16 10:13:44 +01:00
ionutboangiu
6a1ccf26fe Set contexts/subsystems to *any if empty + tests 2022-11-16 10:13:44 +01:00
adi
a6445f641e Displays messages for agents when connect + fixes on call tests 2022-11-11 17:04:59 +01:00
andronache
428cd37b8e Replaced header in multiple places 2021-11-01 13:50:23 +02:00
andronache
39fc35fe30 Added commented config test for now 2021-10-05 21:05:49 +02:00
andronache
a4625e64fe Fixed integration test regadring cdrs ttl internal 2021-10-05 21:05:49 +02:00
andronache
38edad5ca6 Fixed broken tests 2021-10-04 11:33:05 +02:00
Trial97
3db1a7f1cf Updated sessions message handling 2021-09-29 19:18:13 +02:00
porosnicuadrian
d4c35e9905 Fixed calls test 2021-09-28 20:45:26 +02:00
Trial97
0dd7a37f9b Updated EventCost Rounding. Fixes #3018 2021-09-23 11:49:17 +02:00
Trial97
29671396e6 Added test for refunding expired balance 2021-09-01 17:29:41 +03:00