Commit Graph

13270 Commits

Author SHA1 Message Date
ionutboangiu
da4bf0d783 Sync (and update) go version
go.mod had a later version than the one used inside the
role, which caused the deb packaging to fail.

Updated all of them to latest.
2024-07-05 11:20:09 +02:00
ionutboangiu
520451be7e Add precache support for exporters
Additional changes:
- removed unnecessary locking when initializing the exporter
  cache map, as the service itself is responsible for locking.
- separated setupCache method into ClearExporterCache and
  SetupExporterCache methods.
- removed idle ListenAndServe function that was only waiting for the
  stopChan to close. The reload case was unreachable due to the reload
  channel being created in Start instead of being passed down.
- removed Shutdown method on EventExporterS and replaced it with the
  exported ClearExporterCache method as it provided the same
  functionality.
2024-07-05 11:19:36 +02:00
armirveliaj
4260852918 Add new unit tests on agents 2024-07-02 20:01:01 +02:00
ionutboangiu
ed3fa0d294 Add redisPoolPipelineWindow configuration field for datadb
Sets the duration after which internal pipelines are flushed.
0 disabled implicit pipelining.
2024-07-02 19:58:03 +02:00
armirveliaj
8447bbb084 Add new unit tests on engine 2024-07-01 20:37:09 +02:00
armirveliaj
fedacded6e Add new unit tests on agents 2024-07-01 20:37:09 +02:00
arberkatellari
23ae4632fe Add print_config flags to cgr-loader and cgr-migrator 2024-07-01 14:33:24 +02:00
arberkatellari
b88602cdf3 Update rpcclient revising error handling 2024-06-30 17:55:09 +02:00
arberkatellari
dddd34f0db Update general test 2024-06-30 17:55:09 +02:00
ionutboangiu
4d3868aad0 Add support for Git 2.45+ iso-strict date format
Git 2.45+ introduced a backward incompatible change in the iso-strict
date format, showing time in the Zulu timezone with Z suffix instead
of +00:00. This commit adds parsing for the new date format before
falling back to the old format.

Ignore errors for old git versions where %cI is not defined.

Revise GetCGRVersion error messages.
Revise GetCGRVersion unit test.
2024-06-30 17:53:38 +02:00
ionutboangiu
13a0e86a0e Update TestATExportAndTopup integration test
Changed initial *topup action to *topup_reset and increase its weight
to ensure it runs first.
Changed ExpiryTime (inside the *topup_reset action definition) from
*unlimited to +150ms.
Added an extra action trigger to the account to execute ACT_TOPUP_INITIAL
when the balance expires.
Added the following test cases:
  - Execute triggers before balance expiry and verify nothing happens.
  - Wait for the balance to expire (helper now returns balance expiry
  time).
  - Execute triggers again and verify if ACT_TOPUP_INITIAL was executed.
Updated connections from *localhost to *internal.
2024-06-30 17:53:05 +02:00
ionutboangiu
0148e18c05 Update TestATExportAndTopup scenario
Moved to its own file since it has nothing to do with
*transfer_balance anymore.
2024-06-30 17:53:05 +02:00
armirveliaj
e7a2107fa0 Add new unit tests on agents 2024-06-30 17:51:59 +02:00
armirveliaj
9ba8feeb71 Add new unit tests on engine 2024-06-30 17:51:59 +02:00
armirveliaj
c3a2a12089 Add new unit tests on agents 2024-06-30 17:51:59 +02:00
armirveliaj
2fccb98f03 Add new unit tests on agents 2024-06-30 17:51:59 +02:00
armirveliaj
09ec973a92 Add new unit tests on engine 2024-06-30 17:51:59 +02:00
armirveliaj
6c7c54ab58 Add unit tests on engine 2024-06-30 17:51:59 +02:00
armirveliaj
eb11b51c5e Add unit tests on ees 2024-06-30 17:51:59 +02:00
armirveliaj
6df400cc7e Revise and add new unit tests on agents 2024-06-30 17:51:59 +02:00
armirveliaj
37161e8ea4 Add new unit tests on agents 2024-06-30 17:51:59 +02:00
armirveliaj
a945fccad6 Add new unit tests on engine 2024-06-30 17:51:59 +02:00
armirveliaj
d02df49f53 Add new unit tests on agents 2024-06-30 17:51:59 +02:00
gezimbll
777d4f0a28 added caching for sagprofile 2024-06-30 17:45:06 +02:00
gezimbll
dd7e1f9a0c tests for loading sagprofiles from csvreader 2024-06-30 17:45:06 +02:00
gezimbll
0012477d52 added stat aggregator profile,models,tps and apis 2024-06-30 17:45:06 +02:00
ionutboangiu
22cbaa58c7 Optimize Kafka SSL integration test
- ERs sometimes took too long to receive a message.
  Setting kafkaGroupID to "" prevents this.
- Kafka reader took 10s to close (default MaxWait).
  Set MaxWait to 1ms.
- Exporters took 1s each to export due to BatchSize
  not being hit. Set BatchSize to 1 to prevent it.
2024-06-30 16:28:52 +02:00
ionutboangiu
11b96de00a Add kafkaBatchSize configuration field
Avoids the default 1 second delay when the batch doesn't
reach 100 messages within that time.

Useful when the Kafka exporter is not cached, as it would
otherwise encounter that delay. Setting BatchSize to 1
prevents this.
2024-06-30 16:28:52 +02:00
ionutboangiu
9c94fbfe58 Handle logical race condition when caching exporters
- added lock to ensure only one exporter instance is cached.
- marked duplicate instances to be closed after export.
2024-06-30 16:28:52 +02:00
ionutboangiu
02ae2cce79 Revise Kafka exporter implementation
- added extra error return parameter to constructor
- failing to parse PEM certificates returns an error (previously nil
return)
- moved Connect logic inside the constructor*
- removed unnecessary fields from poster structure. Use the
configuration fields directly instead.
- removed mutex from poster structure (kafka writer is thread-safe)
- removed nil writer check. Message is exported directly.
- shortened receiver name
(https://google.github.io/styleguide/go/decisions#receiver-names)

*The Kafka Transport is not a connection but a configuration for the
connection created during the first export. The connection and its
related goroutines stay running until manually closed.
2024-06-30 16:28:52 +02:00
ionutboangiu
36598294a2 Revise Kafka SSL test
- Updated to use the test suite
- Deleted kafka_ssl sample configuration (moved to test file)
- Replaced 'logger' section with 'general' in configuration
- Revised Kafka server SSL setup comment
- Ensured exporters are synchronous to avoid missing errors
- Implemented helper function to create and clean up kafka topics
2024-06-30 16:28:52 +02:00
ionutboangiu
4d8a2d7bdd Format kafka ansible role files 2024-06-30 16:28:52 +02:00
armirveliaj
8f8ff30ff8 Add new unit tests on config 2024-06-18 21:10:00 +02:00
armirveliaj
2d6912657d Add and revise new unit tests on agents 2024-06-18 21:10:00 +02:00
ionutboangiu
d3975b4d2f Update ActionTrigger integration test scenario
Instead of using 2 balances and maintaining them using
*transfer_balance, use only 1 balance.
2024-06-18 16:29:01 +02:00
ionutboangiu
c3524735aa Ensure config path stands out when using print_config flag
Done by using the %q fmt verb instead of %s, which wraps the path
within quotes.
2024-06-17 20:15:29 +02:00
armirveliaj
d4abea91a5 Formatting fsevent_test.go 2024-06-14 18:20:05 +02:00
armirveliaj
00efea25b5 Fixing merge issues 2024-06-14 18:20:05 +02:00
armirveliaj
0688659c54 Add new unit tests on agents 2024-06-14 18:20:05 +02:00
armirveliaj
5dfb49db71 Revise and add new unit tests on agents 2024-06-14 12:16:05 +02:00
ionutboangiu
49f6c5982e Add reference value functionality to *transfer_balance action
The *transfer_balance action can now use a reference value to ensure
the destination balance reaches a specified amount. If the destination
balance exceeds the reference value, the excess is transferred back
to the source balance. If the destination balance is below the
reference value, the required amount is transferred from the source
balance to the destination balance to reach the specified reference
value. An error is returned if the transfer cannot achieve the
specified reference value.

Used by specifying DestinationReferenceValue inside ExtraParameters.

Other *transfer_balance changes:
- used json tags when unmarshaling ExtraParameters in order to be
able to shorten the names of the fields
- lock the destination account only if it's different from the
source account. It is still passed to the Guard function but
without a lock key and with 0 timeout.
- if the transfer happens within the same account, update the
account and execute its ActionTriggers only once.
- moved transfer units validation after retrieving/creating the
destination balance

*cdrlog action has been updated to create cdrs for reference
*transfer_balance actions, although improvements are needed and
the functionality is not completely tested.

APIerSv1.TransferBalance has been updated to take into account the
ReferenceValue parameter.

Added new *transfer_balance action unit tests to account for the
new changes.

Added integration tests (incomplete for now, but functionality
has been tested manually).
2024-06-13 13:56:40 +02:00
armirveliaj
1fd77cafa5 Add new unit tests on agents 2024-06-13 10:45:14 +02:00
arberkatellari
f46b37bdf8 Make minor improvements to sessions backup 2024-06-12 18:21:50 +02:00
arberkatellari
b061770e68 Add asterisk and FS agents session restoration support 2024-06-12 18:21:50 +02:00
arberkatellari
a0f94c6804 Add/Update unit and integration tests adjusting for sessions backup 2024-06-12 18:21:50 +02:00
arberkatellari
f356695f6f Add active sessions backup functionalitiy 2024-06-12 18:21:50 +02:00
gezimbll
7e3b1b7052 increased time.sleep for cache to remove on ttl 2024-06-12 14:53:30 +02:00
gezimbll
1c1d211c7c added config,service for sags 2024-06-12 14:53:30 +02:00
armirveliaj
f707236a37 Add unit test on utils 2024-06-11 18:49:39 +02:00
armirveliaj
bc531f8b5a Add unit test on migrator 2024-06-11 18:49:39 +02:00