Commit Graph

12894 Commits

Author SHA1 Message Date
gezimbll
16a9c7033f Remove unreachable err cases from HandleJSONErr
json.UnmarshalError happens only when we pass a non-nil pointer, which
is not the case for us. Usage of go vet helps us make sure it also
won't be happening in the future.
2023-10-26 15:52:06 +02:00
gezimbll
9df5f2e02e Added EventCost FieldAsString tests 2023-10-26 15:52:06 +02:00
arberkatellari
5872b810ec Change default storedb password 2023-10-25 10:16:07 +02:00
ionutboangiu
c4664c69c4 Replace nightly with master for deb install 2023-10-19 17:20:00 +02:00
ionutboangiu
6e182f64c1 Update kafka handler to run with sudo 2023-10-19 17:20:00 +02:00
ionutboangiu
1c0ca857ee Update libraries and fix compilation errors 2023-10-17 17:40:43 +02:00
ionutboangiu
7cc5dfb26d Update test for XmlProvider String() func 2023-10-17 17:40:43 +02:00
ionutboangiu
37ac937f97 Handle kafka topic creation/deletion within test 2023-10-17 17:40:43 +02:00
ionutboangiu
5ce0e8dfa5 Update kafka ansible role
- use kraft instead of zookeeper
- add handlers in case of cfg changes
- create a separate user for the kafka service
- bump kafka version
- make the role more configurable
2023-10-17 17:40:43 +02:00
ionutboangiu
1d8d9823fe Delete irrelevant test after xml update 2023-10-17 17:40:43 +02:00
ionutboangiu
63e06dd86a Update XmlProvider String() func
The comment specifies that it should display the already parsed values
out of cache.
2023-10-17 17:40:43 +02:00
ionutboangiu
889ec93288 Rename prefix to isAbsolute inside HP.AsString() 2023-10-17 17:40:43 +02:00
ionutboangiu
12779560ca Handle empty relative path case in HP.AsString()
Return '.' when HierarchyPath is empty and prefix is false.
2023-10-17 17:40:43 +02:00
ionutboangiu
36bbcbc2e1 Update rabbitmq role for latest debian/ubuntu compatibility 2023-10-16 18:57:48 +03:00
ionutboangiu
55c3730cda Update AMQP message processing loop
Previously, msg.Ack(true) was used, which is mostly used for batch
processing. It mistakenly acknowledged all previously unacknowledged
messages, causing errors from the AMQP server. Now, messages are
acknowledged individually after each one is processed.

Messages that ERs failed to process are now rejected and requeued
for future processing attempts.

The reader is now closed immediately if the message delivery
channel closes. Therefore, it prevents an endless loop by avoiding
continuous consumption from empty or closed channels.

Addresses: #4146
2023-10-16 18:04:17 +03:00
arberkatellari
d7aabe20e3 Continue test for rerating through ers 2023-10-16 13:35:30 +03:00
arberkatellari
e3915b2009 Correct test and add test for rerating CDRs using ERs 2023-10-16 13:35:30 +03:00
gezimbll
d560152d55 Improving internal storage coverage tests 2023-10-16 13:34:55 +03:00
ionutboangiu
4245740b31 Update github workflows to use correct go version 2023-10-16 13:18:12 +03:00
ionutboangiu
6c41ebe0de Add sanity check to prevent xml reader panic
HierarchyPath parser now returns nil when
the path is empty (instead of a string slice with one
EmptyString element).

If the prefix is set to true, when calling the AsString
method on a nil HierarchyPath, only the separator will
be returned. This avoids a nil expr error coming from
the xmlquery library.

Use the Query and QueryAll functions from the xmlquery
package to be able to handle the errors ourselves and
avoid panics.

Remove config default value for xml_root_path. The field
will remain commented in config_defaults for reference.

Add tests for HierarchyPath.AsString function.

Add comments for XmlProvider and xml_root_path opt.
2023-10-16 13:18:12 +03:00
gezimbll
405f29ca00 added internal storage tests 2023-10-12 15:06:04 +02:00
ionutboangiu
27c6d503a5 Bump go version and update checksum 2023-10-12 11:10:01 +02:00
arberkatellari
47e75fab13 Update radigo, add multiple folder functionality 2023-10-11 11:18:32 +02:00
gezimbll
055578b642 Added tests for dataconverters on attributes 2023-10-10 19:58:17 +02:00
ionutboangiu
947fc13e01 Update deb_packages ansible playbook
Adjusted rng-tools binary path.
Removed redundant distribution, since we can just use the branch
directly.
2023-10-09 21:09:27 +02:00
ionutboangiu
84cdf743bd Bump go version 2023-10-09 21:09:27 +02:00
ionutboangiu
da6a2ee92f Pass clnt as a parameter to the goroutine in syncSessions
This prevents the clnt loop variable to be captured by the
func literal.
2023-10-09 21:09:27 +02:00
ionutboangiu
6cfb934c9b Update *strip converter implementation and its tests
Added in-depth comments to the constructor.
Added test cases for most edge cases (if not all).
Updated the test to verify not only if an error occurs, but to also
check whether it matches the one we expect.
Added 3 more sanity checks that were missed.
2023-10-09 21:09:27 +02:00
arberkatellari
36e43beca8 Ensure RadiusAgent starts properly without session connections 2023-10-09 21:06:23 +02:00
gezimbll
e52778794c Coverage tests for internal storage 2023-10-09 21:05:42 +02:00
ionutboangiu
3678c620d6 Add constants for *nil, *space and *char 2023-10-06 18:51:35 +02:00
ionutboangiu
f0fea43a41 Update to new *strip data converter 2023-10-06 09:38:08 +02:00
ionutboangiu
3e56a5aac7 Implement *strip data converter 2023-10-06 09:38:08 +02:00
arberkatellari
4a812a294b Correct addition of vendor at radReplyAppendAttributes & IT test for it 2023-10-05 17:24:08 +02:00
ionutboangiu
1429445bde Update failing versions it test 2023-10-05 17:23:26 +02:00
arberkatellari
66c6668bd2 Add case with error and blocker for radius config 2023-10-04 20:59:11 +02:00
gezimbll
c887cfd985 Fixed TestCGRConfig 2023-10-04 20:58:25 +02:00
gezimbll
37e5a54ea9 Fixed config tests & added new stordb tests 2023-10-04 20:58:25 +02:00
ionutboangiu
d003b8c2ae Update deb_packages ansible playbook
Replaced the 'nightly' distribution configuration with  'master'. This
change may trigger an unused database error. Resolve it by either
running `reprepro clearvanished` (removing 'nightly' completely) or
re-adding and maintaining the 'nightly' configuration alongside
'master'.
2023-10-02 21:04:00 +02:00
ionutboangiu
d396da9214 Remove deprecated rand.Seed function 2023-10-02 21:04:00 +02:00
ionutboangiu
29fccbb6c7 Add test for handling escaped characters via api 2023-10-02 21:04:00 +02:00
DanB
a0a508d667 SessionS - adding stale_chan_max_extra_usage configuration to randomize the usage of stale sessions 2023-10-01 13:32:09 +02:00
gezimbll
e18f60cea1 Added nfs server ansible role 2023-09-29 20:28:37 +02:00
gezimbll
0ada2d1d0e Creating roles and playbook for k8s cluster setup 2023-09-29 20:28:37 +02:00
ionutboangiu
a80fe9b96e Remove redundant prefixes/suffixes from rOpts field names 2023-09-28 20:48:07 +02:00
ionutboangiu
bac73aa2c6 Migrate to new jetstream API
Updated ees/ers implementation to use the jetstream package which
separates the jetstream context from Core NATS.

Removed the jsOpts fields from the NatsEE struct. We are now using the
jetStreamMaxWait option directly through a timeout context.

Added streamName option for NATS reader since it is now required to be
specified when creating a consumer (it is not inferred based on subject
anymore).

Updated nats ers integration test.

Removed deprecated birpc unit test.

Updated tests to also use the new jetstream package.

Updated tests to start the nats-server using their official driver
instead of using the std go exec package. time.Sleeps are now not
required anymore to wait for the server.

In test configurations for nats readers, made sure that natsStreamName
option is populated. It is now required for consumers to know where to
subscribe.

Fixed potential panic that happened when jetstreamMaxWait option would
not be set.
2023-09-28 20:48:07 +02:00
arberkatellari
5f7bc44790 Show proper value to radAgent reply when using *log 2023-09-28 20:47:07 +02:00
arberkatellari
0d38bf8551 Improve functionality for Drone CI 2023-09-26 21:33:40 +02:00
ionutboangiu
b1d68b6cfe Upgrade NATS driver version and implementation
Upgraded NATS server version in ansible role.

upgraded go.mod nats version due to an issue caused by version mismatch
between driver and server (uncertain).

Increased amount of sleep in tests after starting a NATS server with
jetstream enabled from 50ms to 100ms.

## *NatsER.Serve

- Replaced ChanQueueSubscribe with QueueSubscribe for Core NATS consumer
to handle the message processing directly.

- Since QueueSubscribe is now used regardless of jetstream status, the
message handler has been assigned to a separate variable that can be
reused.

-  The message handler is now dealing with the message processing
directly, therefore the select case listening for the channel which is
feeding NATS messages can be removed together with the channel itself
and the select. Currently, the goroutine within Serve only has to block
until the rdrExit chan is closed.

- Moved the resource check inside the handler right before starting the
message processing goroutine.

## ers.getProcessedOptions

- Renamed function from getProcessOptions to getProcessedOptions.

- Initially, the EventExporterOpts struct was always initialized to be
non-nil which meant exporting processed messages by the reader was
always enabled by force. Function has been updated to initialize it
only once when the first Processed option that was set is found.

- Created init function for all types of opts structs to avoid
repetition.

## *NatsEE.parseOpts

- Renamed function from parseOpt to parseOpts.

- Updated function to return early in case of nil opts struct to reduce
nesting.

- The nested jetstream status and maxwait conditions nil verification
have been merged into one condition.

- Handled the error coming from GetNatsOpts function.

- NATS Subject assignment has been removed. It was redundant, since it
had already been set from before this function was called.

## *NatsEE.Connect

- Updated function to return early in case of non-nil nats.Conn value
to reduce nesting.

## *NatsEE.ExportEvent

- Use defer to release resources and RUnlock.

## *NatsEE.Close

- Use defer to Unlock.

- Update function to return early in case of nil nats.Conn value to
reduce nesting.

## ees.GetNatsOpts

- Chose switch over if else when parsing client certificate and keys
opts.

- Updated function to return the errors directly instead of assigning
them to a separate variable right before returning.

## ers.GetNatsOpts

- Passed the NATSROpts struct directly to the function.

- Chose switch over if else when parsing client certificate and keys
opts.

- Updated function to return the errors directly instead of assigning
them to a separate variable right before returning.

Removed tab from commented natsJetStreamMaxWaitProcessed option
value in config_defaults.go under ers section.

Removed redundant NATS prefix from config.NATSROpts type field names.

Added function in ers/lib_test.go to create a config file in /tmp
based on a config string.

Added integration test for ERs NATS.
2023-09-26 21:29:52 +02:00
NikolasPetriti
5d75b0e096 Add coverage tests for utils 2023-09-12 18:10:02 +02:00