Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added ability to load spending plans from environment variable.… #3201

Conversation

ebadiere
Copy link
Collaborator

@ebadiere ebadiere commented Oct 31, 2024

Cherry-pick. Added the ability to load spending plans from environment variable.

Issue: #3153

… (#3153)

  • feat: Added ability to load spening plans from environment variable.

  • feat: Now uses one property for either spending plan file or JSON content.

fix: removed .only

fix: Cleaned up file and env var evaluation.

fix: Flaky unit test fix.

feat: Refactored implementation and updated tests.

  • fix: Adding updated package-lock.json

  • fix: Updated global variable reference to the new HBAR_SPENDING_PLANS_CONFIG

fix: Test fix.

fix: Removed irrelevant test since we now use either env var or file for spending plan.

fix: Updated HBAR_SPENDING_PLANS_CONFIG from HBAR_SPENDING_PLANS_CONFIG_FILE

  • fix: Clean up. Updated logging and appropriate tests.

  • fix: Replaced the useInMemoryRedisServer with the start and stop redis in the before and after mocha functions.

  • fix: Test fix. Added the envName back to the loggerService test.

  • Update docs/configuration.md

  • fix: Added back file not found tests.

  • fix: Updated file name in withOverriddenEnvsInMochaTest with existing file.

  • fix: Clear the spending plan repository in a test as in CI it seems to already be populated.

fix: Cleanup.

  • fix: Added more time for the HBar Rate Limiter to update expenses in the background.

  • chore: divided hbar limtier tests into different batches

  • fix: Removed the clearing of the spending plans.

  • chore: divided hbar limtier tests into different batches (chore: divided hbar limtier tests into different batches #3181)

  • chore: divided hbar limtier tests into different batches

  • fix: fixed acceptance.yml


  • Update packages/relay/src/lib/config/hbarSpendingPlanConfigService.ts

  • fix: Restored class comments and corrected HBAR_SPENDING_PLAN_CONFIG.

  • test: fix hbarSpendingPlanConfigService.spec.ts

  • test: remove .only from describe

  • test: disconnect redis client after tests with shared cache


Description:

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

…#3153)

* feat: Added ability to load spening plans from environment variable.

Signed-off-by: ebadiere <[email protected]>

* feat: Now uses one property for either spending plan file or JSON content.

Signed-off-by: ebadiere <[email protected]>

fix: removed .only

Signed-off-by: ebadiere <[email protected]>

fix: Cleaned up file and env var evaluation.

Signed-off-by: ebadiere <[email protected]>

fix: Flaky unit test fix.

Signed-off-by: ebadiere <[email protected]>

feat: Refactored implementation and updated tests.

Signed-off-by: ebadiere <[email protected]>

* fix: Adding updated package-lock.json

Signed-off-by: ebadiere <[email protected]>

* fix: Updated global variable reference to the new HBAR_SPENDING_PLANS_CONFIG

Signed-off-by: ebadiere <[email protected]>

fix: Test fix.

Signed-off-by: ebadiere <[email protected]>

fix: Removed irrelevant test since we now use either env var or file for spending plan.

Signed-off-by: ebadiere <[email protected]>

fix: Updated HBAR_SPENDING_PLANS_CONFIG from HBAR_SPENDING_PLANS_CONFIG_FILE

Signed-off-by: ebadiere <[email protected]>

* fix: Clean up. Updated logging and appropriate tests.

Signed-off-by: ebadiere <[email protected]>

* fix: Replaced the useInMemoryRedisServer with the start and stop redis in the
before and after mocha functions.

Signed-off-by: ebadiere <[email protected]>

* fix: Test fix.  Added the envName back to the loggerService test.

Signed-off-by: ebadiere <[email protected]>

* Update docs/configuration.md

Co-authored-by: Victor Yanev <[email protected]>
Signed-off-by: Eric Badiere <[email protected]>

* fix: Added back file not found tests.

Signed-off-by: ebadiere <[email protected]>

* fix: Updated file name in `withOverriddenEnvsInMochaTest` with existing file.

Signed-off-by: ebadiere <[email protected]>

* fix: Clear the spending plan repository in a test as in CI it seems to already
be populated.

Signed-off-by: ebadiere <[email protected]>

fix: Cleanup.

Signed-off-by: ebadiere <[email protected]>

* fix: Added more time for the HBar Rate Limiter to update expenses in the background.

Signed-off-by: ebadiere <[email protected]>

* chore: divided hbar limtier tests into different batches

Signed-off-by: Logan Nguyen <[email protected]>

* fix: Removed the clearing of the spending plans.

Signed-off-by: ebadiere <[email protected]>

* chore: divided hbar limtier tests into different batches (#3181)

* chore: divided hbar limtier tests into different batches

Signed-off-by: Logan Nguyen <[email protected]>

* fix: fixed acceptance.yml

Signed-off-by: Logan Nguyen <[email protected]>

---------

Signed-off-by: Logan Nguyen <[email protected]>

* Update packages/relay/src/lib/config/hbarSpendingPlanConfigService.ts

Co-authored-by: Nana Essilfie-Conduah <[email protected]>
Signed-off-by: Eric Badiere <[email protected]>

* fix: Restored class comments and corrected HBAR_SPENDING_PLAN_CONFIG.

Signed-off-by: ebadiere <[email protected]>

* test: fix hbarSpendingPlanConfigService.spec.ts

Signed-off-by: Victor Yanev <[email protected]>

* test: remove `.only` from `describe`

Signed-off-by: Victor Yanev <[email protected]>

* test: disconnect redis client after tests with shared cache

Signed-off-by: Victor Yanev <[email protected]>

---------

Signed-off-by: ebadiere <[email protected]>
Signed-off-by: Eric Badiere <[email protected]>
Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Co-authored-by: Victor Yanev <[email protected]>
Co-authored-by: Logan Nguyen <[email protected]>
Co-authored-by: Nana Essilfie-Conduah <[email protected]>
Co-authored-by: Victor Yanev <[email protected]>
@ebadiere ebadiere self-assigned this Oct 31, 2024
@ebadiere ebadiere added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Oct 31, 2024
@ebadiere ebadiere added this to the 0.59.0 milestone Oct 31, 2024
Copy link

sonarcloud bot commented Oct 31, 2024

Copy link

github-actions bot commented Oct 31, 2024

Test Results

 20 files   -   3  256 suites   - 46   34m 4s ⏱️ +43s
604 tests +  3  597 ✅ +  9  4 💤 +1  3 ❌  - 7 
641 runs   - 198  634 ✅  - 192  4 💤 +1  3 ❌  - 7 

For more details on these failures, see this check.

Results for commit d110979. ± Comparison against base commit 1af16a2.

♻️ This comment has been updated with latest results.

@ebadiere ebadiere merged commit 2c4e3dd into release/0.59 Oct 31, 2024
48 of 52 checks passed
@ebadiere ebadiere deleted the 3153-cherry-pick-add-ability-to-load-spending-plan-from-variable branch October 31, 2024 21:48
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 82.76%. Comparing base (1af16a2) to head (d110979).
Report is 1 commits behind head on release/0.59.

Files with missing lines Patch % Lines
...ay/src/lib/config/hbarSpendingPlanConfigService.ts 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release/0.59    #3201      +/-   ##
================================================
- Coverage         83.39%   82.76%   -0.64%     
================================================
  Files                66       69       +3     
  Lines              4283     4451     +168     
  Branches            835      875      +40     
================================================
+ Hits               3572     3684     +112     
- Misses              471      515      +44     
- Partials            240      252      +12     
Flag Coverage Δ
config-service 98.14% <ø> (ø)
relay 85.54% <85.71%> (-0.06%) ⬇️
server 83.52% <ø> (ø)
ws-server 36.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ckages/config-service/src/services/globalConfig.ts 100.00% <ø> (ø)
...kages/relay/src/lib/clients/cache/localLRUCache.ts 98.46% <100.00%> (+4.71%) ⬆️
...ay/src/lib/config/hbarSpendingPlanConfigService.ts 95.49% <84.61%> (-2.60%) ⬇️

... and 12 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants