Skip to content

Added missing provider unit tests#84

Merged
m-olko merged 4 commits intomainfrom
provider_unit_tests
Mar 17, 2026
Merged

Added missing provider unit tests#84
m-olko merged 4 commits intomainfrom
provider_unit_tests

Conversation

@m-olko
Copy link
Contributor

@m-olko m-olko commented Mar 12, 2026

This PR

Adds missing provider structure unit tests. It mostly tests the behavior of init and shutdown with respect to calling resolve during different moments.

How to test

bazelisk test //providers/flagd/tests:provider_test

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 focuses on improving the testability and robustness of the FlagdProvider. By refactoring the provider's constructors to support dependency injection, it enables isolated testing of its core functionalities. The addition of new unit tests validates the provider's lifecycle and ensures correct interaction with its dependencies, leading to a more reliable component.

Highlights

  • Enhanced Testability: Introduced new constructors for FlagdProvider that allow for dependency injection of FlagSync and Evaluator components, significantly improving the testability of the provider.
  • New Unit Tests for FlagdProvider: Added a comprehensive suite of unit tests for the FlagdProvider class, covering its initialization, readiness state, evaluation delegation, and shutdown behavior using Google Test and Google Mock.
  • Code Cleanup: Removed an unnecessary include of <cstdlib> from provider.cpp, contributing to cleaner code.
Changelog
  • providers/flagd/src/provider.cpp
    • Removed unused include for cstdlib.
    • Added two new constructors to FlagdProvider for injecting FlagSync and Evaluator dependencies.
  • providers/flagd/src/provider.h
    • Declared two new constructors for FlagdProvider to support dependency injection.
  • providers/flagd/tests/BUILD
    • Added a new cc_test target named provider_test to build the new unit tests for FlagdProvider.
  • providers/flagd/tests/provider_test.cpp
    • Added a new file containing unit tests for FlagdProvider.
    • Implemented mock classes for FlagSync and Evaluator using gmock.
    • Included tests for metadata, provider readiness before and after initialization, delegation of evaluation calls, and shutdown behavior.
Activity
  • No human activity has been recorded on this pull request yet.
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.

Copy link
Contributor

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

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 unit tests for the FlagdProvider, which is a great addition. To enable testing, new constructors are introduced to allow dependency injection of FlagSync and Evaluator. The tests are well-structured and cover the basic states of the provider (ready, not ready, shutdown). My feedback includes suggestions to make a couple of test assertions more robust and complete.

Signed-off-by: Marcin Olko <molko@google.com>
@m-olko m-olko force-pushed the provider_unit_tests branch from fa3ce2b to 0af7830 Compare March 13, 2026 10:32
m-olko added 3 commits March 13, 2026 13:29
Signed-off-by: Marcin Olko <molko@google.com>
Signed-off-by: Marcin Olko <molko@google.com>
Signed-off-by: Marcin Olko <molko@google.com>
@m-olko m-olko marked this pull request as ready for review March 13, 2026 13:51
@m-olko m-olko requested a review from oxddr March 13, 2026 13:51
@m-olko m-olko merged commit a7955fd into main Mar 17, 2026
3 checks passed
@m-olko m-olko deleted the provider_unit_tests branch March 17, 2026 16:21
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