Commit Graph

5487 Commits

Author SHA1 Message Date
armirveliaj
d2d161fcce Add coverage tests on engine 2024-10-05 20:33:33 +02:00
armirveliaj
9321888d3f Add new unit tests for TrendS 2024-10-03 17:43:46 +02:00
ionutboangiu
f26a0c2d0b Reduce client connection attempts to test engine status
200 -> 16

Previously, considering the fibonacci back off strategy, if engine failed to
start it would have tried to attempt connections for 2.862799e+33 years.

Now, the amount of attempts is 16, equivalent to around 2 and a half seconds.
Should be more than enough, considering that usually 6-7 attempts are enough.
2024-09-25 20:58:51 +02:00
ionutboangiu
b5362f89ef Optimize and fix unstable tests
Revise backup loop tests to not rely on time.Sleep anymore and remove
unused fields from them.

Optimize some analyzers tests.
2024-09-25 20:58:51 +02:00
armirveliaj
3d7c5ed201 Add coverage tests on engine 2024-09-24 17:18:55 +02:00
gezimblliku
d20f1a50fd added ees_conns on stats 2024-09-24 10:41:18 +02:00
ionutboangiu
65e8128303 Implement ErSv1.RunReader api 2024-09-23 20:28:26 +02:00
ionutboangiu
e228dda013 Improve test setup helpers
- added hook support (executed after parsing config but before
starting engine)
- made db resets configurable
- merged config parsing helper with the main Setup function
- removed engineDelay parameter
- replaced t.Log with t.Error for engine process kill error
- improved option comments
2024-09-23 20:28:26 +02:00
gezimblliku
0f81b78321 updated trend profile && trends service implementation 2024-09-23 11:48:04 +02:00
ionutboangiu
0063ef3822 Add support for mongodb+srv conn format
Option can be found in db opts under the name 'mongoConnScheme'.
2024-09-05 20:46:40 +02:00
ionutboangiu
169b5500d3 Revise err handling for CSV storage constructor
NewFileCSVStorage() now returns an error besides the storage struct itself, which is
logged and returned instead of calling log.Fatal() which was causing the engine to
crash.

Fixed compilation errors by creating the CSVStorage separately and passing it as an
argument to the TpReader constructor.

Fixes #3962
2024-09-05 20:46:40 +02:00
ionutboangiu
ede004bc44 remove deprecated rand.Seed calls 2024-09-05 20:46:40 +02:00
ionutboangiu
3187bca82e update rpcclient library (#4413) 2024-09-05 20:46:40 +02:00
ionutboangiu
2f387b5a0e chore: remove unnecessary parentheses
gofmt -r '(a) -> a' -w **/*.go
2024-09-05 20:46:40 +02:00
ionutboangiu
fee2712a23 chore: replace interface{} with any 2024-09-05 20:46:40 +02:00
gezimblliku
04f2c69b05 updated dependencies with the latest versions 2024-08-22 20:39:59 +02:00
ionutboangiu
8426892ac6 revise integration tests script 2024-08-21 20:59:10 +02:00
ionutboangiu
0f70af84e9 centralize test flags for shared use across tests 2024-08-15 18:17:33 +02:00
ionutboangiu
9d59e88552 Add the test suite
Similar to the one from v0.11. Has different csv loading logic and passes
context.
2024-08-15 18:17:33 +02:00
ionutboangiu
0dfb3b860d Centralize RPCClient constructor 2024-08-15 18:17:33 +02:00
ionutboangiu
7c5d56c1de Combine csv loader tests
- ensures the tpreader is not eating memory even when tests are
not being run (before it was being constructed in an init())
2024-08-15 18:17:33 +02:00
gezimblliku
73a7590f1c added profiles,configs and services for trend && ranking 2024-08-02 09:37:52 +02:00
arberkatellari
ac96e53c43 Update rpcclient revising error handling 2024-06-30 17:55:59 +02:00
gezimbll
27c4242c52 renamed newservice2 function to newservicewithping 2024-06-07 17:18:23 +02:00
gezimbll
3ff0e6e5a1 revising integration tests 2024-06-07 17:18:23 +02:00
gezimbll
07ea67e638 update threshold to set snooze time after actions 2024-05-09 12:33:32 +02:00
gezimbll
368c046805 added *http filter type 2024-02-09 15:59:00 +01:00
gezimbll
b3956da736 Added new filter *contains 2023-12-19 16:03:35 +01:00
gezimbll
c51122fd20 Moving apis into each subsystem packages 2023-12-13 20:33:09 +01:00
ionutboangiu
555a143b79 Take out cdrID from SetCDR parameters 2023-12-12 10:09:18 +01:00
ionutboangiu
d29f84169c Move cdrs to its own package
Moved engine/cdr.go to utils/cdr.go.
Moved engine/cdrs.go and engine/cdrs_test.go to cdrs package.
Moved api functions from cdrs/cdrs.go to cdrs/apis.go. Same for the
tests.
Deleted CDRsV1 type and its methods.
2023-12-12 10:09:18 +01:00
ionutboangiu
1cec3751e4 Update SetCDR signature to include the cdrID
Updated mongo indexing for cdrs to take into consideration only the
opts.*cdrID field.

Fixed cdrs_it_test.go test.

Before storing CDRs in CDR processEvents, we are now temporarily generating
the *cdrID in APIOpts (until we decide where this should happen).
2023-12-12 10:09:18 +01:00
ionutboangiu
2ccd6ca74d Add context.Context in SetCDR func signature 2023-12-12 10:09:18 +01:00
ionutboangiu
ab26ba2d02 Implement RemoveCDRs for MongoStorage (untested and not optimized) 2023-12-12 10:09:18 +01:00
ionutboangiu
fb6b38850c Update mongo SetCDR method to take into account allowUpdate param 2023-12-12 10:09:18 +01:00
ionutboangiu
560f42bf8d Add store block back inside *CDRServer.processEvents
Added *store and *rerate dynamic opts for cdrs.
2023-12-12 10:09:18 +01:00
gezimbll
3fe5f70dc9 Adding OneEvent functionality for stats 2023-12-07 17:44:33 +01:00
ionutboangiu
f0852b645b Rename composeURI func to composeMongoURI
To reflect that it's used exclusively for MongoDB (for now at least).

Also added a descriptive comment to the function.
2023-12-07 16:56:08 +01:00
ionutboangiu
8909786a4b Revise buildURL function
Renamed to composeURI.

Use simple string concatenation to build URI because there is
no need to keep the Parse call as a validation step. Any issue
would be caught when establishing a connection.
2023-12-07 16:56:08 +01:00
gezimbll
cc07c5366a Revise integration tests 2023-11-29 16:25:18 +01:00
gezimbll
ac32b7ce60 Added function to cast custom map types 2023-11-29 16:25:18 +01:00
gezimbll
3403a91a2b Revise integration tests 2023-11-29 16:25:18 +01:00
ionutboangiu
031cf1fe43 Add rpc caching for ProcessStoredEvents API 2023-11-29 16:22:58 +01:00
ionutboangiu
6826f13cc5 Update CDR processEvent to process multiple CGREvents 2023-11-16 15:38:18 +01:00
ionutboangiu
a817f30c2a Rename PrepareFilters to GetFilters 2023-11-16 15:38:18 +01:00
ionutboangiu
f5d69cb41b Implement ProcessStoredEvents API 2023-11-16 15:38:18 +01:00
ionutboangiu
26cdb571b8 Upgrade MongoDB driver to 1.13
- Set (but comment) serverAPI options (currently distinct api and
create.size BSON field are deprecated + possible others that are untested)
- Remove the custom time decoder used for mongo BSON
datetime values. The custom decoder was only converting these values
into UTC and was not any different from the default time.Time
decoder in the MongoDB driver, which also handles BSON string, int64,
and document values.
- Implement 'buildURL' function to connect to mongo (can also be
used for mysql and postgres)
- Update function names, variable names, and comments for clarity
- Replace 'bsonx.Regex' with the Regex primitive (deprecated since 1.12).
- Use simple concatenation instead of Sprintf
- Declare 'decimalType' locally, replace global 'decimalType'
- Simplify several functions without altering functionality
- Converting directly from a D to an M is deprecated. We are now decoding
  directly in a M.
- Used errors.As and errors.Is for proper error comparison and assertion
- Revised sloppy reassignments and added missing error checks
2023-11-14 18:24:21 +01:00
ionutboangiu
e5ab21def5 Implement AdminSv1 Get/RemoveCDRs APIs for CDRs
Addition of storDB to AdminSv1 was required.
2023-11-09 20:50:36 +01:00
ionutboangiu
d5039b3ce8 Add CDRs CRUD queries back and remove TP functions 2023-11-09 20:50:36 +01:00
ionutboangiu
d7679e2e9a Add negative filters to filter type string sets 2023-11-09 20:50:36 +01:00