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

snippet-service: rename resourceUpdater config to resourceAggregate #1348

Merged

Conversation

jkralik
Copy link
Member

@jkralik jkralik commented Jul 12, 2024

No description provided.

@jkralik jkralik requested a review from Danielius1922 July 12, 2024 12:18
Copy link
Contributor

coderabbitai bot commented Jul 12, 2024

Walkthrough

The changes to the snippet-service involve renaming fields and restructuring configurations related to resource handling and cleanup. Key modifications include renaming ResourceUpdater to ResourceAggregate within various files, altering configuration paths, enhancing error handling, and updating test configurations to reflect these changes. Additionally, the creation and management of resource handling have been streamlined, and the configurations now support multiple database types.

Changes

File Path Change Summary
snippet-service/service/config.go Renamed ResourceUpdater to ResourceAggregate in ClientsConfig.
snippet-service/service/config_test.go Updated test functions to reflect the renaming of ResourceUpdater to ResourceAggregate.
snippet-service/service/http/invokeConfiguration_test.go Modified configuration settings within TestRequestHandlerInvokeConfiguration to update paths from ResourceUpdater to Storage.
snippet-service/service/service.go Enhanced New function to include additional parameters, updated error handling, and renamed fields from ResourceUpdater to ResourceAggregate.
snippet-service/service/expiredUpdatesChecker.go Renamed package from updater to service and updated function signature for NewExpiredUpdatesChecker.
snippet-service/service/service_test.go Adjusted configuration settings and renamed fields from ResourceUpdater to ResourceAggregate in test functions.
snippet-service/store/config/config.go Added new fields for cron job configurations and validation logic in Config struct.
snippet-service/store/config/config_test.go Renamed package from updater_test to config_test and updated references to ResourceUpdaterConfig.
snippet-service/test/service.go Renamed MakeResourceUpdaterConfig to MakeResourceAggregateConfig and updated configuration structure to support multiple databases.
snippet-service/updater/config.go Removed fields CleanUpExpiredUpdates and ExtendCronParserBySeconds from ResourceUpdaterConfig.
snippet-service/updater/resourceUpdater.go Removed scheduler field and related logic from ResourceUpdater struct and NewResourceUpdater function.
snippet-service/updater/resourceUpdater_test.go Updated configuration paths from ResourceUpdater to Storage in test functions.

Poem

In the world of code so bright and clear,
Change has come, let's give a cheer!
ResourceUpdater now takes a new name,
ResourceAggregate sets the course, not the same.
Configs and tests all align,
With databases dancing in line.
Cheers to progress, near and far,
In snippets of code, we raise the bar!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5f8588a and e4f884f.

Files ignored due to path filters (3)
  • charts/plgd-hub/templates/snippet-service/config.yaml is excluded by !**/*.yaml
  • charts/plgd-hub/values.yaml is excluded by !**/*.yaml
  • snippet-service/config.yaml is excluded by !**/*.yaml
Files selected for processing (1)
  • snippet-service/service/config.go (1 hunks)

snippet-service/service/config.go Outdated Show resolved Hide resolved
@jkralik jkralik force-pushed the jkralik/fix/snippet-service-clients-resource-aggregate branch from 408c123 to 8b2ac79 Compare July 12, 2024 12:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (5)
snippet-service/service/config_test.go (1)

179-179: Inconsistent Renaming: ResourceUpdater to ResourceAggregate

The renaming from ResourceUpdater to ResourceAggregate is not consistently applied across the codebase. The following instances still use ResourceUpdater:

  • snippet-service/service/config_test.go
  • snippet-service/service/service.go
  • snippet-service/test/service.go
  • snippet-service/service/service_test.go
  • snippet-service/service/config.go
  • snippet-service/updater/resourceUpdater.go
  • snippet-service/service/grpc/server.go
  • snippet-service/updater/config.go
  • snippet-service/updater/config_test.go
  • snippet-service/updater/expiredUpdates.go

Please update all occurrences of ResourceUpdater to ResourceAggregate to maintain consistency.

Analysis chain

LGTM! Ensure consistency across the codebase.

The renaming from ResourceUpdater to ResourceAggregate is correctly reflected here.

However, ensure that this renaming is consistently applied across the entire codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of renaming across the codebase.

# Test: Search for any remaining instances of `ResourceUpdater`.
rg --type go 'ResourceUpdater'

Length of output: 6041

snippet-service/service/service_test.go (4)

111-114: Ensure consistency of CQLDB configuration settings across the codebase.

The following instances of the old CQLDB configuration settings were found and need to be updated to reflect the new structure:

  • snippet-service/test/service.go
  • identity-store/test/config.go
  • identity-store/service/service_test.go
  • certificate-authority/test/service.go

Please update these instances to ensure consistency across the codebase.

Analysis chain

LGTM! Ensure consistency across the codebase.

The CQLDB configuration settings are correctly updated to reflect the new structure.

However, ensure that these changes are consistently applied across the entire codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of CQLDB configuration settings across the codebase.

# Test: Search for any remaining instances of the old CQLDB configuration settings.
rg --type go 'Storage.*CqlDB'

Length of output: 716


195-196: Inconsistent Configuration Settings Detected

The configuration settings CleanUpExpiredUpdates and ExtendCronParserBySeconds are found in multiple files. Ensure these settings are consistently updated across the following locations:

  • snippet-service/updater/resourceUpdater_test.go
  • snippet-service/service/service.go
  • snippet-service/service/http/invokeConfiguration_test.go
  • certificate-authority/service/cleanDatabase_test.go
  • certificate-authority/service/config_test.go

Please review and update these files to maintain consistency.

Analysis chain

LGTM! Ensure consistency across the codebase.

The configuration settings are correctly updated to reflect the new structure.

However, ensure that these changes are consistently applied across the entire codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of configuration settings across the codebase.

# Test: Search for any remaining instances of the old configuration settings.
rg --type go 'Storage.*CleanUpExpiredUpdates'
rg --type go 'Storage.*ExtendCronParserBySeconds'

Length of output: 1509


80-82: Inconsistent Configuration Settings Detected

The new configuration structure has not been consistently applied across the codebase. The following instances still use the old configuration settings and need to be updated:

  • snippet-service/test/service.go: Uses cfg.Clients.Storage.Use == database.CqlDB
  • identity-store/service/service_test.go: Uses cfg.Clients.Storage.Use = config.ACTIVE_DATABASE()
  • identity-store/test/config.go: Uses cfg.Clients.Storage.Use = config.ACTIVE_DATABASE()
  • certificate-authority/test/service.go: Uses cfg.Clients.Storage.Embedded.Use == database.CqlDB

Please update these instances to reflect the new configuration structure.

Analysis chain

LGTM! Ensure consistency across the codebase.

The configuration settings are correctly updated to reflect the new structure.

However, ensure that these changes are consistently applied across the entire codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of configuration settings across the codebase.

# Test: Search for any remaining instances of the old configuration settings.
rg --type go 'Storage.*Use'

Length of output: 377


Script:

#!/bin/bash
# Get context around the identified lines in the mentioned files to verify the configuration settings.

# Context from snippet-service/test/service.go
rg --type go -A 5 -B 5 'cfg.Clients.Storage.Use == database.CqlDB' snippet-service/test/service.go

# Context from identity-store/service/service_test.go
rg --type go -A 5 -B 5 'cfg.Clients.Storage.Use = config.ACTIVE_DATABASE()' identity-store/service/service_test.go

# Context from identity-store/test/config.go
rg --type go -A 5 -B 5 'cfg.Clients.Storage.Use = config.ACTIVE_DATABASE()' identity-store/test/config.go

# Context from certificate-authority/test/service.go
rg --type go -A 5 -B 5 'cfg.Clients.Storage.Embedded.Use == database.CqlDB' certificate-authority/test/service.go

Length of output: 1839


93-98: Ensure Consistency Across MongoDB Configuration Settings

The MongoDB configuration settings are not consistently updated across the codebase. The following files still use the old configuration structure:

  • tools/mongodb/standby-tool/main.go
  • certificate-authority/test/service.go
  • snippet-service/test/service.go
  • identity-store/test/config.go
  • identity-store/service/service_test.go
  • cloud2cloud-connector/test/test.go
  • cloud2cloud-connector/test/cloudOrigin.go
  • cloud2cloud-gateway/service/service.go
  • cloud2cloud-gateway/store/mongodb/subscription_test.go
  • cloud2cloud-connector/service/service.go

Please update these instances to use the new configuration structure: database.Config[*storeMongo.Config, *storeCqlDB.Config].

  • tools/mongodb/standby-tool/main.go: Lines involving c.Clients.Storage.MongoDB.*
  • certificate-authority/test/service.go: Lines involving cfg.Clients.Storage.Embedded.MongoDB
  • snippet-service/test/service.go: Lines involving cfg.Clients.Storage.MongoDB
  • identity-store/test/config.go: Lines involving cfg.Clients.Storage.MongoDB
  • identity-store/service/service_test.go: Lines involving cfg.Clients.Storage.MongoDB
  • cloud2cloud-connector/test/test.go: Lines involving cfg.Clients.Storage.MongoDB
  • cloud2cloud-connector/test/cloudOrigin.go: Lines involving idCfg.Clients.Storage.MongoDB and c2cConnectorCfg.Clients.Storage.MongoDB
  • cloud2cloud-gateway/service/service.go: Lines involving cfg.Clients.Storage.MongoDB
  • cloud2cloud-gateway/store/mongodb/subscription_test.go: Lines involving cfg.Clients.Storage.MongoDB
  • cloud2cloud-connector/service/service.go: Lines involving config.Clients.Storage.MongoDB

Please ensure these changes are made to maintain consistency across the codebase.

Analysis chain

LGTM! Ensure consistency across the codebase.

The MongoDB configuration settings are correctly updated to reflect the new structure.

However, ensure that these changes are consistently applied across the entire codebase.


Let's gather more information to verify if the new MongoDB configuration structure is consistently applied across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of MongoDB configuration settings across the codebase.

# Test: Search for any remaining instances of the old MongoDB configuration settings.
rg --type go 'Storage.*MongoDB'

Length of output: 3597


Script:

#!/bin/bash
# Description: Verify the context of MongoDB configuration settings to ensure they follow the new structure.

# Check context around the instances found in the previous search.
rg --type go -A 5 -B 5 'Storage.*MongoDB' tools/mongodb/standby-tool/main.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' certificate-authority/test/service.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' snippet-service/test/service.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' identity-store/test/config.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' identity-store/service/service_test.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' cloud2cloud-connector/test/test.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' cloud2cloud-connector/test/cloudOrigin.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' cloud2cloud-gateway/service/service.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' cloud2cloud-gateway/store/mongodb/subscription_test.go
rg --type go -A 5 -B 5 'Storage.*MongoDB' cloud2cloud-connector/service/service.go

Length of output: 9006

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e4f884f and 55d43f0.

Files ignored due to path filters (3)
  • charts/plgd-hub/templates/snippet-service/config.yaml is excluded by !**/*.yaml
  • charts/plgd-hub/values.yaml is excluded by !**/*.yaml
  • snippet-service/config.yaml is excluded by !**/*.yaml
Files selected for processing (11)
  • snippet-service/service/config.go (2 hunks)
  • snippet-service/service/config_test.go (1 hunks)
  • snippet-service/service/http/invokeConfiguration_test.go (1 hunks)
  • snippet-service/service/service.go (1 hunks)
  • snippet-service/service/service_test.go (5 hunks)
  • snippet-service/store/config/config.go (1 hunks)
  • snippet-service/test/service.go (2 hunks)
  • snippet-service/updater/config.go (1 hunks)
  • snippet-service/updater/config_test.go (2 hunks)
  • snippet-service/updater/resourceUpdater.go (2 hunks)
  • snippet-service/updater/resourceUpdater_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • snippet-service/updater/config.go
Files skipped from review as they are similar to previous changes (1)
  • snippet-service/service/config.go
Additional comments not posted (12)
snippet-service/updater/config_test.go (1)

19-19: LGTM!

The update to use MakeResourceAggregateConfig reflects the renaming and maintains the validity of the test case.

snippet-service/store/config/config.go (3)

4-5: LGTM!

The imports for fmt and time are necessary for the new validation logic involving cron job scheduling.


14-18: LGTM!

The addition of CleanUpExpiredUpdates and ExtendCronParserBySeconds fields to the Config struct is necessary for configuring cron job settings and extending the cron parser by seconds.


20-43: LGTM!

The added validation logic ensures that the cron job settings are correctly configured and handles errors appropriately.

snippet-service/updater/resourceUpdater_test.go (1)

36-37: LGTM!

The update to the configuration paths from ResourceUpdater to Storage reflects the restructuring of the configuration settings and ensures that the test cases are aligned with the new configuration paths.

snippet-service/test/service.go (2)

44-46: LGTM!

The renaming of MakeResourceUpdaterConfig to MakeResourceAggregateConfig and the update to the function implementation reflect the new naming convention and ensure consistency.


58-81: LGTM!

The updates to the MakeClientsConfig and MakeStoreConfig functions ensure that the helper functions are aligned with the new configuration settings and support the updated structure.

snippet-service/service/service.go (1)

99-99: LGTM! Verify the function usage.

The additional parameters for NewResourceUpdater are correctly passed.

However, ensure that all calls to NewResourceUpdater are updated to match the new signature.

Verification successful

Ensure all calls to NewResourceUpdater are updated.

The search results show that the function definition and one call to NewResourceUpdater match the new signature. To confirm, please verify that there are no other calls to NewResourceUpdater using the old signature.


Verification successful.

All calls to NewResourceUpdater match the new signature.

  • snippet-service/service/service.go
  • snippet-service/updater/resourceUpdater.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `NewResourceUpdater` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go 'NewResourceUpdater'

Length of output: 612


Script:

#!/bin/bash
# Description: Verify all calls to `NewResourceUpdater` match the new signature.

# Test: Search for all function calls to `NewResourceUpdater` and check for the correct signature.
rg --type go 'NewResourceUpdater' -A 3

Length of output: 1145

snippet-service/service/http/invokeConfiguration_test.go (1)

126-127: LGTM! Ensure consistency across the codebase.

The configuration paths are correctly updated to reflect the new structure.

However, ensure that these changes are consistently applied across the entire codebase.

Verification successful

Let's verify the context in snippet-service/service/service.go to ensure that the configuration paths are correctly updated.


Verification Successful: Configuration Paths Consistently Updated

The configuration paths config.Clients.Storage.CleanUpExpiredUpdates and config.Clients.Storage.ExtendCronParserBySeconds have been correctly updated and are consistent across the codebase.

  • snippet-service/service/service.go: Lines where the configuration paths are used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of configuration path updates across the codebase.

# Test: Search for any remaining instances of `CleanUpExpiredUpdates` and `ExtendCronParserBySeconds` under `ResourceUpdater`.
rg --type go 'ResourceUpdater.*CleanUpExpiredUpdates'
rg --type go 'ResourceUpdater.*ExtendCronParserBySeconds'

Length of output: 641


Script:

#!/bin/bash
# Description: Verify the context of configuration path updates in service.go.

# Test: Search for the relevant lines in service.go to confirm the updates.
rg --type go -A 5 'CleanUpExpiredUpdates' snippet-service/service/service.go
rg --type go -A 5 'ExtendCronParserBySeconds' snippet-service/service/service.go

Length of output: 899

snippet-service/service/service_test.go (1)

133-133: LGTM! Ensure consistency across the codebase.

The resource aggregate client configuration settings are correctly updated to reflect the new structure.

However, ensure that these changes are consistently applied across the entire codebase.

Verification successful

Verified Consistency of ResourceUpdaterConfig Changes

The ResourceUpdaterConfig and ResourceUpdater structures are consistently applied across the codebase.

  • The ResourceUpdaterConfig struct is correctly defined and used in various files.
  • The ResourceUpdater struct and its methods are consistent with the new structure.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of resource aggregate client configuration settings across the codebase.

# Test: Search for any remaining instances of the old resource aggregate client configuration settings.
rg --type go 'ResourceUpdater'

Length of output: 6041


Script:

#!/bin/bash
# Description: Extract context around occurrences of ResourceUpdaterConfig and ResourceUpdater to verify consistency.

# Extract context around ResourceUpdaterConfig
rg --type go 'ResourceUpdaterConfig' -A 5 -B 5

# Extract context around ResourceUpdater
rg --type go 'ResourceUpdater' -A 5 -B 5

Length of output: 36026

snippet-service/updater/resourceUpdater.go (2)

Line range hint 40-55:
LGTM!

The code changes are approved.


40-40: Verify the function usage in the codebase.

The function signature has been modified. Ensure that all calls to NewResourceUpdater are updated to match the new signature.

Verification successful

Verification successful.

The function NewResourceUpdater has been updated correctly, and all calls to this function match the new signature.

  • snippet-service/updater/resourceUpdater.go
  • snippet-service/service/service.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewResourceUpdater` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'NewResourceUpdater'

Length of output: 1335

@jkralik jkralik force-pushed the jkralik/fix/snippet-service-clients-resource-aggregate branch from 55d43f0 to 3b3c3b4 Compare July 15, 2024 13:31
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 55d43f0 and 3b3c3b4.

Files ignored due to path filters (3)
  • charts/plgd-hub/templates/snippet-service/config.yaml is excluded by !**/*.yaml
  • charts/plgd-hub/values.yaml is excluded by !**/*.yaml
  • snippet-service/config.yaml is excluded by !**/*.yaml
Files selected for processing (7)
  • snippet-service/service/http/invokeConfiguration_test.go (1 hunks)
  • snippet-service/service/service.go (1 hunks)
  • snippet-service/service/service_test.go (5 hunks)
  • snippet-service/store/config/config.go (1 hunks)
  • snippet-service/test/service.go (2 hunks)
  • snippet-service/updater/config.go (1 hunks)
  • snippet-service/updater/resourceUpdater_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • snippet-service/service/http/invokeConfiguration_test.go
Files skipped from review as they are similar to previous changes (6)
  • snippet-service/service/service.go
  • snippet-service/service/service_test.go
  • snippet-service/store/config/config.go
  • snippet-service/test/service.go
  • snippet-service/updater/config.go
  • snippet-service/updater/resourceUpdater_test.go

@jkralik jkralik force-pushed the jkralik/fix/snippet-service-clients-resource-aggregate branch from 3b3c3b4 to b935749 Compare July 15, 2024 15:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
snippet-service/service/expiredUpdatesChecker.go (1)

1-1: Package name change not fully propagated.

The package name has not been fully updated from updater to service. The following files still reference the updater package and need to be updated:

  • snippet-service/updater/resourceUpdater_test.go
  • snippet-service/updater/resourceUpdater.go
  • snippet-service/updater/updateExecution.go
  • snippet-service/updater/config_test.go
  • snippet-service/updater/config.go

Please ensure all references to the updater package are updated to service to maintain consistency.

Analysis chain

Package name change.

The package name has been changed from updater to service. Ensure all references to this package are updated accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the package `updater` are updated to `service`.

# Test: Search for the package usage. Expect: Only occurrences of `service`.
rg --type go -A 5 $'package updater'

Length of output: 1698

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3b3c3b4 and b935749.

Files ignored due to path filters (3)
  • charts/plgd-hub/templates/snippet-service/config.yaml is excluded by !**/*.yaml
  • charts/plgd-hub/values.yaml is excluded by !**/*.yaml
  • snippet-service/config.yaml is excluded by !**/*.yaml
Files selected for processing (10)
  • snippet-service/service/expiredUpdatesChecker.go (2 hunks)
  • snippet-service/service/http/invokeConfiguration_test.go (1 hunks)
  • snippet-service/service/service.go (6 hunks)
  • snippet-service/service/service_test.go (5 hunks)
  • snippet-service/store/config/config.go (1 hunks)
  • snippet-service/test/service.go (2 hunks)
  • snippet-service/updater/config.go (1 hunks)
  • snippet-service/updater/config_test.go (2 hunks)
  • snippet-service/updater/resourceUpdater.go (4 hunks)
  • snippet-service/updater/resourceUpdater_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (9)
  • snippet-service/service/http/invokeConfiguration_test.go
  • snippet-service/service/service.go
  • snippet-service/service/service_test.go
  • snippet-service/store/config/config.go
  • snippet-service/test/service.go
  • snippet-service/updater/config.go
  • snippet-service/updater/config_test.go
  • snippet-service/updater/resourceUpdater.go
  • snippet-service/updater/resourceUpdater_test.go
Additional comments not posted (4)
snippet-service/service/expiredUpdatesChecker.go (4)

10-10: Error handling for gocron.NewScheduler.

The error handling for gocron.NewScheduler is correct and ensures that any errors in creating the scheduler are properly reported.


15-15: Cron job creation and error handling.

The cron job creation and error handling are correct. The use of gocron.NewTask(onCheckTimeout) ensures that the provided function is correctly scheduled.


15-15: Starting the scheduler.

The scheduler is correctly started with s.Start(). Ensure that this does not lead to any unintended side effects.


10-10: Function signature update.

The function signature has been updated to replace the updater parameter with onCheckTimeout. Ensure all calls to this function are updated accordingly.

Verification successful

Function signature update verified.

All calls to NewExpiredUpdatesChecker have been updated to match the new signature.

  • snippet-service/service/service.go
  • snippet-service/service/expiredUpdatesChecker.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `NewExpiredUpdatesChecker` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'NewExpiredUpdatesChecker'

Length of output: 1219


Script:

#!/bin/bash
# Description: Verify all calls to `NewExpiredUpdatesChecker` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg 'NewExpiredUpdatesChecker'

Length of output: 370

@Danielius1922 Danielius1922 force-pushed the jkralik/fix/snippet-service-clients-resource-aggregate branch from b935749 to e2a56ad Compare July 15, 2024 18:18
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b935749 and e2a56ad.

Files ignored due to path filters (3)
  • charts/plgd-hub/templates/snippet-service/config.yaml is excluded by !**/*.yaml
  • charts/plgd-hub/values.yaml is excluded by !**/*.yaml
  • snippet-service/config.yaml is excluded by !**/*.yaml
Files selected for processing (11)
  • snippet-service/service/config.go (3 hunks)
  • snippet-service/service/config_test.go (3 hunks)
  • snippet-service/service/expiredUpdatesChecker.go (2 hunks)
  • snippet-service/service/http/invokeConfiguration_test.go (1 hunks)
  • snippet-service/service/service.go (6 hunks)
  • snippet-service/service/service_test.go (6 hunks)
  • snippet-service/store/config/config.go (1 hunks)
  • snippet-service/store/config/config_test.go (1 hunks)
  • snippet-service/test/service.go (3 hunks)
  • snippet-service/updater/resourceUpdater.go (4 hunks)
  • snippet-service/updater/resourceUpdater_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • snippet-service/store/config/config_test.go
Files skipped from review as they are similar to previous changes (9)
  • snippet-service/service/config.go
  • snippet-service/service/config_test.go
  • snippet-service/service/expiredUpdatesChecker.go
  • snippet-service/service/http/invokeConfiguration_test.go
  • snippet-service/service/service.go
  • snippet-service/store/config/config.go
  • snippet-service/test/service.go
  • snippet-service/updater/resourceUpdater.go
  • snippet-service/updater/resourceUpdater_test.go
Additional comments not posted (1)
snippet-service/service/service_test.go (1)

79-81: Review of Updated Configurations in Test Cases

The test cases have been updated to reflect the new configuration structures and naming conventions. However, there are several points to consider:

  1. Invalid Configurations Testing: The tests for invalid configurations (lines 79-81, 92-97, 110-113) are correctly set up to expect errors, which is good practice for negative testing.

  2. Expired Updates Checker Config: The configuration for expired updates checker (lines 119-127) uses a hardcoded invalid value for testing error scenarios. This is a good use of testing edge cases.

  3. Resource Aggregate Config: The renaming of ResourceUpdaterConfig to ResourceAggregateConfig (line 141) is consistent with the changes described in the PR. Ensure all references in the codebase are updated to reflect this change.

Overall, the test configurations are well-handled and align with the new system architecture. However, ensure comprehensive coverage of all possible configurations to avoid potential issues in production.

Also applies to: 92-97, 110-113, 119-127, 141-141

snippet-service/service/service_test.go Show resolved Hide resolved
Copy link

@Danielius1922 Danielius1922 merged commit 839b3d2 into main Jul 15, 2024
38 checks passed
@Danielius1922 Danielius1922 deleted the jkralik/fix/snippet-service-clients-resource-aggregate branch July 15, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants