Commit Graph

13123 Commits

Author SHA1 Message Date
ionutboangiu
56360e481b Update ltcache dependency to latest version 2024-04-11 18:23:57 +02:00
ionutboangiu
e4dd349c26 Lower chances of scheduler it test failing
By using a referenceTime variable as close as possible to the
time of the request.
2024-04-11 18:23:57 +02:00
ionutboangiu
e488f7f13a Update bleve library to latest version 2024-04-11 18:23:57 +02:00
ionutboangiu
2c1a90c9c6 Optimize and fix unstable tests
Revise backup loop tests to not rely on time.Sleep anymore and remove
unused fields from them.

Removed 3ns TTL from tpreader test dataDB configuration that caused in-
consistent results.

Ensure connManager cache is reloaded in filter tests. Before they could
cause deadlocks.

Remove redundant inits, global vars and setup tests for debit and
accounts tests.

Optimize some analyzers tests.
2024-04-11 18:23:57 +02:00
ionutboangiu
04bff19ced Optimize AgentRequest test (2s->0.03s)
Lowering the cfg cache TTL to 5ms instead of 1s was enough to get
consistent results.
2024-04-11 18:23:57 +02:00
ionutboangiu
2d141c642a Lower the min size we expect from mem/cpuprof files 2024-04-10 12:56:36 +02:00
ionutboangiu
5807b4f4bb Bump actions versions in github workflows 2024-04-10 12:56:36 +02:00
ionutboangiu
5f32a59ac8 Wait for TPs to be loaded in *transfer_balance test 2024-04-10 12:56:36 +02:00
ionutboangiu
cf158a3b40 Revise client init in nats ers test
The usual newRPCClient is not reachable due to its file having
a different build constraint
2024-04-10 12:56:36 +02:00
ionutboangiu
be554bd4fe Revise integration script to return correct exit code
Before it was returning 1 always.
2024-04-10 12:56:36 +02:00
DanB
bddeaff5dd Implementation of janusHTTPjsonDP 2024-04-09 20:33:56 +02:00
ionutboangiu
d8946e73ee Make small revisions to a few integration tests
-update cached filter indexes count
-add the flaky constraint to a couple more tests
-fix unstable cores integration test
-fix unstable filterindexes integration test
2024-04-09 20:24:01 +02:00
gezimbll
a3e3cde958 added janusconn methods for loading from json 2024-04-09 20:22:31 +02:00
DanB
9b87b32abf Adding JanusConn to config 2024-04-09 14:59:00 +02:00
gezimbll
c5c8ca5991 added methods for janusagent configuration 2024-04-09 13:43:43 +02:00
gezimbll
883633732b updated postman api collection 2024-04-09 10:28:07 +02:00
DanB
8db91ca479 Basic service infrastructure for JanusAgent 2024-04-08 20:09:06 +02:00
ionutboangiu
8ba8bfcff4 Revise failing analyzers test
We were sniffing for the wrong method. Also reduced time.Sleep
needed to make sure query is registered from 10s to 10ms.
2024-04-08 17:34:13 +02:00
ionutboangiu
a5d29d5d7b Stop sending BalanceUpdate events to thresholds/stats 2024-04-08 17:34:13 +02:00
ionutboangiu
d6c5ddf08e Remove unused debitUnits and debitMoney funcs
They seem to have been replaced by the more generic debit
2024-04-08 13:15:41 +02:00
ionutboangiu
31842bf3f5 Add possibility to set/overwrite balance Factors through API
Constructor looks inside the params' balance map for the Factors key.
It expects either a string representing a JSON serialized map or the
map itself.

BalanceFilter Clone function has been updated to set a deep copy of
the original Factors map instead of a shallow one.

BalanceFilter getter function for Factors now returns nil instead of
an empty map. It's slightly more memory efficient and assignment to
this map will not be attempted, so it's panic proof.

BalanceFilter.ModifyBalance now updates Factors only if the key is
found in the request params' Balance map. Setting Factors to null is also
possible as long as the Factors key exists and is set to null.

Note: only *set_balance can overwrite the Factors map, all the others
can only set it if the balance does exist prior to sending the request.

Update balance integration tests.
2024-04-08 13:15:41 +02:00
ionutboangiu
3062113a61 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.
2024-04-08 13:14:02 +02:00
ionutboangiu
821b5d05cc Remove unnecessary dependency between tests
Deleted a helper function that was directly calling strings.Trim in
favor of using strings.Trim directly.
2024-04-08 13:14:02 +02:00
ionutboangiu
0d512f64c2 Run integration and flaky scripts separately in workflow
flaky_test.sh failure will be ignored
2024-04-08 13:14:02 +02:00
ionutboangiu
a5ee0c6d6b Add script to specifically run flaky tests
Similar to integration_test.sh.
2024-04-08 13:14:02 +02:00
ionutboangiu
bbf441f83c Add flaky build constrait to unstable tests 2024-04-08 13:14:02 +02:00
ionutboangiu
16eb745f00 Centralize test flags in utils for shared use across tests 2024-04-08 13:14:02 +02:00
gezimbll
77b58257d3 updated postman api collection 2024-04-08 13:12:54 +02:00
gezimbll
6f4ee914f7 revised meprofile &cpuprofile tests 2024-04-08 13:12:54 +02:00
DanB
37388c70f3 Initial JanusAgent struct 2024-04-04 16:00:05 +02:00
ionutboangiu
5d6bcacca6 Add badge for unit tests workflow 2024-04-04 12:31:39 +03:00
ionutboangiu
e56191e390 Add ERs APIs to dispatchers 2024-04-04 12:31:18 +03:00
ionutboangiu
e0ae593949 Set up internal connection to ERs 2024-04-04 12:31:18 +03:00
ionutboangiu
5c1e128f4f Update behaviour of file readers using inotify
Ensure that files already existing in the source path are processed
before the reader starts listening for filesystem change events.
2024-04-04 12:31:18 +03:00
ionutboangiu
a362511d7a Define param struct for ErSv1.RunReader API + refactoring
Rename dir field to sourceDir in file event readers for clarity.
2024-04-04 12:31:18 +03:00
ionutboangiu
3f5956ab1b Use correct subsys const when dispatching to EEs
Before *core was mistakenly used instead of *ees
2024-04-04 12:31:18 +03:00
ionutboangiu
0626b050c1 Add ERs apis to apier package
Now the ErSv1 object methods are registered instead when
starting the ERs service.
2024-04-04 12:31:18 +03:00
ionutboangiu
5116a23f5b Set ChargerProfile through TPs instead of API in tests
Only for agents/ers tests. Done to prevent cyclic imports when
adding ers APIs to apier package.

In case of v2.AttrSetAccount, use a literal struct instead.
2024-04-04 12:31:18 +03:00
ionutboangiu
b9a39e233f Implement ErSv1.ProcessDir api
cores.Server, analyzer object and internal conn channel specific to ERs
are now part of the ERService struct and are passed to its constructor.
2024-04-04 12:31:18 +03:00
ionutboangiu
b924fc9e0c Add method on ERsCfg to retrieve reader by ID 2024-04-04 12:31:18 +03:00
ionutboangiu
b9b07dc561 Remove redundant dir parameter from processFile methods
Applies to both file readers and loader (for loader, the blank statement
was used anyway).

It's redundant because for file readers, the rdr.dir value was always
passed as the parameter when it was already part of the method's object.

Parameter had to also be removed from the WatchDir function and the
functions it depends on.
2024-04-04 12:31:18 +03:00
ionutboangiu
85864ccaa3 Extract common dir processing logic to a func
It will be reused for all file readers.
Rename rdrDir field to dir (redundant prefix).
2024-04-04 12:31:18 +03:00
ionutboangiu
9c004b069d Ignore factors equal to 1 when creating EventCost 2024-04-01 20:48:57 +03:00
ionutboangiu
6db11e87bc Rename Factor to BalanceFactor inside Accounting 2024-04-01 20:48:57 +03:00
ionutboangiu
50d0103c7b Move BalanceFactor value from Increments to Accounting
Retrieve the Accounting BalanceCharge inside a new variable and reuse
that instead of repeatedly indexing the map. It is always assumed that
the BalanceCharge exists in the map and is non-nil. A comment was
added as a reminder.

TotalCost cannot be calculated anymore from ChargingIncrement alone.
The function is not used, so it will not be causing any issues for
now.

BalanceCharge clone function now handles the case where it is nil
to avoid any possible nil pointer dereference.
2024-04-01 20:48:57 +03:00
ionutboangiu
bdbcc1ce58 Use different rates based on ToR in balance tests
TestBalanceFactor will now test refunding to mixed balanced types.

A sleep of 10ms is called before initial acc retrieval to wait for
tps to finish loading.
2024-04-01 20:48:57 +03:00
ionutboangiu
a7ca167039 Add BalanceFactor value to Increments
For both the Increment and ChargingIncrement types.
2024-04-01 20:48:57 +03:00
ionutboangiu
22fb6236b1 Add test for refunding with factors 2024-04-01 20:48:57 +03:00
ionutboangiu
cc72aa92d9 Slightly optimize debit for balances with non-nil Factor
Factor will be computed only once at the start of the function, instead
of doing it on every Increments iteration.

'amount' variable will be updated and rounded only when the computed
balances factor is different from its default value (1).
2024-04-01 20:48:57 +03:00
ionutboangiu
bd4aa99458 Refactor balance's Factor field name with its plural form
Stored balances previous to this commit, that had a non-nil Factors map, will
now have Factors nil due to field name mismatch.
2024-04-01 19:58:04 +03:00