Skip to content

Unit tests for FeatureProviderStatusManager..#39

Merged
NeaguGeorgiana23 merged 6 commits into
mainfrom
status_manager_test
Dec 9, 2025
Merged

Unit tests for FeatureProviderStatusManager..#39
NeaguGeorgiana23 merged 6 commits into
mainfrom
status_manager_test

Conversation

@NeaguGeorgiana23

Copy link
Copy Markdown
Contributor

This PR

Adds unit-tests for FeatureProviderStatusManager.

@NeaguGeorgiana23 NeaguGeorgiana23 requested review from a team as code owners December 8, 2025 07:49
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @NeaguGeorgiana23, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test coverage for the FeatureProviderStatusManager by adding a dedicated suite of unit tests. These tests validate the manager's lifecycle, including its creation, initialization, shutdown, and status transitions, utilizing a newly implemented mock for the FeatureProvider interface to isolate the component under test.

Highlights

  • Unit Tests Added: Comprehensive unit tests have been introduced for the FeatureProviderStatusManager to ensure its correct functionality across various states and operations.
  • Mocking Infrastructure: A new MockFeatureProvider class has been added using Google Mock, enabling isolated and controlled testing of components that depend on the FeatureProvider interface.
  • Build System Updates: The test/BUILD file has been updated to include the new mock library and the FeatureProviderStatusManager unit test, integrating them into the build process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds comprehensive unit tests for FeatureProviderStatusManager, including a mock for FeatureProvider and the necessary BUILD file configurations. The tests are well-structured, using GTest fixtures and parameterized tests to cover various scenarios like initialization, shutdown, and status management. My review includes a couple of suggestions: one to correct a dependency in the BUILD file for the mock library, and another to enhance test coverage by including all possible provider statuses in one of the tests. Overall, this is a great addition to improve the project's test coverage and reliability.

Comment thread test/BUILD Outdated
Comment thread test/feature_provider_status_manager_test.cpp Outdated
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Comment thread test/BUILD Outdated
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Comment thread test/feature_provider_status_manager_test.cpp Outdated
Comment thread test/feature_provider_status_manager_test.cpp Outdated
protected:
void SetUp() override {
mock_provider = std::make_shared<MockFeatureProvider>();
auto result = FeatureProviderStatusManager::Create(mock_provider);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is FeatureProviderStatusManager needed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, since we need the result to initialize the manager_ . We first need this line to check the status returned is ok and only then init the manager_ with the value.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should be able to just call Create(mock_provider) since FeatureProviderStatusManager is in the header you are testing and the tests are in the same namespace

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can't use jus Create(mock_provider) because this is a static function: static absl::StatusOr<std::unique_ptr<FeatureProviderStatusManager>> Create( std::shared_ptr<FeatureProvider> provider);.

We used a static function to follow the Factory Method pattern so we can also return a StatusOr instead of having a throw in a regular constructor.

Comment thread test/feature_provider_status_manager_test.cpp Outdated
@NeaguGeorgiana23 NeaguGeorgiana23 merged commit 2eed659 into main Dec 9, 2025
2 checks passed
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.

4 participants