Commit Graph

785 Commits

Author SHA1 Message Date
ionutboangiu
3c4f8a6c03 Add test for combined destinations to flaky
fails randomly only for *internal db
2024-09-23 11:20:39 +02:00
arberkatellari
7add01320e Revise balance blockers 2024-09-09 16:43:27 +02:00
arberkatellari
88ff4d9c4f Add active time checker on DebitConnectionFee 2024-09-09 16:43:27 +02:00
ionutboangiu
d510b12d2a add balance blocker functionality test 2024-09-05 20:57:43 +02:00
ionutboangiu
b7b66804b1 add helpers for easier test setup 2024-09-05 20:57:43 +02:00
ionutboangiu
656911e4aa Exclude expired metrics before retrieval
Remove all StatQueue locking methods (unused).
2024-08-09 09:16:36 +02:00
ionutboangiu
0860642d97 Add flaky build constraint to tutorial it tests
Randomly failing with -dbtype=*internal.
2024-07-08 12:11:11 +02:00
gezimbll
6b530e94b7 revising integration tests 2024-06-06 14:33:25 +02:00
ionutboangiu
c0b665a015 Make go vet pass
The rpcclient constructor could not see the centralized
Encoding flag because it didn't have the necessary build
constraints. Added the constraints in lib_test.go files
where it wasn't alone. In all the other cases, it was
moved to the first file where it was needed.

Moved resources cache tests relying on DBType flag value
to a separate integration test file. Before it was getting
skipped for *internal anyway.
2024-06-06 11:13:32 +02:00
ionutboangiu
41c62c1291 Add flaky build constraint to unstable tests 2024-06-06 11:13:32 +02:00
ionutboangiu
454c0552f2 Centralize test flags in utils for shared use across tests 2024-06-06 11:13:32 +02:00
ionutboangiu
43a71dd6d2 Update expected value in kafka it tests 2023-10-26 16:26:52 +02:00
ionutboangiu
2ff7824aa3 Handle test received value instead of printing 2023-10-17 17:41:19 +02:00
ionutboangiu
e7b4d565cd Add reusable func to create/remove dirs for ers 2023-10-16 13:31:14 +03:00
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