Skip to content

Improved openfeature smoke tests to use newest sdk api#86

Merged
m-olko merged 7 commits intomainfrom
smoke_openfeature_unit_test_improve
Mar 18, 2026
Merged

Improved openfeature smoke tests to use newest sdk api#86
m-olko merged 7 commits intomainfrom
smoke_openfeature_unit_test_improve

Conversation

@m-olko
Copy link
Contributor

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

This PR

Updates existing smoke tests running with cpp-sdk to use the newest api for calling providers, instantiating them etc.

How to test

bazelisk test //providers/flagd/tests/smoke:openfeature

@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 significantly enhances the flagd provider's smoke tests by migrating them to use the OpenFeature SDK's client API. This change ensures that the provider's integration with the SDK is thoroughly validated, reflecting real-world usage patterns. Additionally, a new constructor was added to the FlagdProvider to enable dependency injection of the FlagSync component, which is critical for creating robust and isolated unit tests for the provider's core logic.

Highlights

  • Updated Smoke Tests: The flagd provider's smoke tests were updated to utilize the newest OpenFeature SDK API, transitioning from direct provider evaluation to client-based evaluation for a more realistic testing approach.
  • Enhanced Testability: A new constructor was introduced for the FlagdProvider that allows for the injection of a FlagSync dependency, significantly improving the testability of the provider's core logic.
  • Expanded Test Coverage: The smoke test suite was expanded to include comprehensive tests for various flag types (boolean, string, integer, double, object) and evaluation context targeting, ensuring robust validation of the provider's functionality.
  • Mock Synchronization: A MockSync implementation was added to simulate flag synchronization, enabling isolated and controlled testing of the FlagdProvider's evaluation capabilities.
Changelog
  • providers/flagd/src/provider.cpp
    • Removed the unused header.
    • Added a new constructor for FlagdProvider that accepts a std::shared_ptr and FlagdProviderConfig.
  • providers/flagd/src/provider.h
    • Declared the new FlagdProvider constructor.
  • providers/flagd/tests/smoke/BUILD
    • Added a new dependency on openfeature_cpp_sdk//openfeature:openfeature_api for the smoke tests.
  • providers/flagd/tests/smoke/openfeature.cpp
    • Removed the old ProviderCreation test.
    • Introduced a MockSync class to simulate flag synchronization for testing.
    • Created a FlagdOpenFeatureTest fixture to set up the OpenFeature API with the flagd provider and a client.
    • Added new tests for boolean, string, integer, double, and object flag evaluations.
    • Included a test for evaluation context targeting.
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 significantly improves the smoke tests for the flagd provider by leveraging the OpenFeature SDK API and a mock synchronization mechanism. This allows for more comprehensive testing of flag evaluations for various types and targeting rules. A new constructor has been added to FlagdProvider to facilitate dependency injection for testing purposes. The changes are well-structured and greatly enhance test coverage. I have one suggestion in the test code to prevent a potential crash during test execution.

Signed-off-by: Marcin Olko <molko@google.com>
@m-olko m-olko force-pushed the smoke_openfeature_unit_test_improve branch from 9a91116 to 7c2b82f Compare March 13, 2026 10:32
m-olko and others added 4 commits March 13, 2026 14:41
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Marcin Olko <molko@google.com>
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 14:01
@m-olko m-olko requested review from alichka06 and oxddr March 13, 2026 14:01
m-olko added 2 commits March 18, 2026 09:20
Signed-off-by: Marcin Olko <molko@google.com>
Signed-off-by: Marcin Olko <molko@google.com>
@m-olko m-olko merged commit 8ece069 into main Mar 18, 2026
3 checks passed
@m-olko m-olko deleted the smoke_openfeature_unit_test_improve branch March 18, 2026 09:27
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.

3 participants