Skip to content

Conversation

@MarkoMlakar
Copy link

This PR

  • This PR adds unit tests for the config feature, allowing the config tests to be run withouth requiring a Docker container. This improves the test speed of the config feature.

Related Issues

Fixes #1406

How to test

Run the test suite in the config.spec.ts

@MarkoMlakar MarkoMlakar requested review from a team as code owners November 24, 2025 12:52
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @MarkoMlakar, 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 enhances the testing suite by introducing dedicated unit tests for the configuration feature. The primary goal is to enable faster and more efficient testing of this functionality by eliminating the dependency on Docker containers for test execution.

Highlights

  • Unit Tests for Config Feature: New unit tests have been introduced specifically for the configuration feature.
  • Docker-Free Execution: These tests are designed to run without requiring a Docker container, which significantly improves test execution speed.
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 config feature, which is a great step towards improving test speed and reliability by removing the Docker dependency. My review focuses on ensuring the new tests are robust and maintainable. I've identified a potential for test flakiness due to shared state and environment variable mutation, and also a small improvement for test report readability. I've provided a single suggestion that addresses these points to improve test isolation and maintainability.

@MarkoMlakar MarkoMlakar force-pushed the feat/add-unit-test-config-feature-1406 branch from 6ff30c7 to 125e64e Compare November 25, 2025 12:01
Signed-off-by: Marko Mlakar <marko.mlakar@dynatrace.com>
* Reset env vars and state object in configSteps beforeEach for test isolation
* Added better formatting for the test output

Signed-off-by: Marko Mlakar <marko.mlakar@dynatrace.com>
@MarkoMlakar MarkoMlakar force-pushed the feat/add-unit-test-config-feature-1406 branch from 125e64e to dafd6ba Compare November 25, 2025 12:04
@MarkoMlakar
Copy link
Author

/gemini review

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 introduces unit tests for the config feature, which is a valuable addition for improving test speed and developer workflow by removing the Docker dependency. The implementation is mostly sound, but I've identified a significant issue with how environment variables are managed within the tests. This could lead to test flakiness. My review comments provide detailed feedback and suggestions for creating more robust and isolated tests.

Signed-off-by: Marko Mlakar <marko.mlakar@dynatrace.com>
@MarkoMlakar
Copy link
Author

/gemini review

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 introduces unit tests for the config feature, which is a great addition for improving test speed and reliability. The changes correctly set up test isolation for state and environment variables. I have a couple of suggestions to improve the robustness of the environment variable handling and to adjust the test timeout to a more conventional value for faster feedback.

…meout for the unit test

Signed-off-by: Marko Mlakar <marko.mlakar@dynatrace.com>
@MarkoMlakar
Copy link
Author

/gemini review

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 config feature, which is a great step towards improving test coverage and speed. The changes look good overall, but I've identified a couple of areas for improvement. There's a significant issue with test isolation due to how environment variables are being reset, which could lead to flaky tests. I've also suggested a minor improvement to make the test naming more robust by handling potential duplicate tags. Please see my detailed comments.

Signed-off-by: Marko Mlakar <marko.mlakar@dynatrace.com>
@MarkoMlakar
Copy link
Author

/gemini review

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 config feature, which is a great step towards improving test speed and reliability by removing the Docker dependency. The changes in configSteps.ts to reset state and environment variables before each test are good for test isolation. I have one suggestion regarding the method used to reset process.env, proposing a more robust pattern to avoid potential brittleness in the tests.

state.options = {};
state.config = undefined;
state.events = [];
Object.keys(process.env).forEach((key) => delete process.env[key]);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Deleting all keys from process.env is an aggressive approach that could be brittle. For example, it might fail if the test environment sets read-only properties on process.env. A safer approach is to only remove properties that were added during the test run, which avoids wholesale deletion of all environment variables.

Suggested change
Object.keys(process.env).forEach((key) => delete process.env[key]);
Object.keys(process.env).filter(key => !Object.prototype.hasOwnProperty.call(originalEnv, key)).forEach(key => delete process.env[key]);

Copy link
Member

Choose a reason for hiding this comment

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

Ya I agree with this.

@toddbaert toddbaert requested a review from aepfli November 25, 2025 19:20
@toddbaert toddbaert changed the title feat: Add unit test for config feature feat: Add tests for config feature Nov 25, 2025
events: [],
};
autoBindSteps(
loadFeatures(CONFIG_FEATURE, {
Copy link
Contributor

Choose a reason for hiding this comment

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

The config.feature gherkin file is part of the in-process and rpc tests. In-Process and RPC cover all *.feature files. I don't think there is need for a specific config.spec.ts file.

Copy link
Author

Choose a reason for hiding this comment

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

You are correct :) However the motivation for having a separate config.spec.ts file was to enable the test to run without requiring a container to be started

Copy link
Member

Choose a reason for hiding this comment

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

this test should not be part of the e2e suite, although it uses gherkin steps, it is fast and can be run during normal unit test execution

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.

[flagd] Add unit test for config feature

5 participants