Skip to content

test: Refactor telemetry tests to follow repository style guidelines - #345

Open
suni72 wants to merge 5 commits into
GoogleCloudPlatform:mainfrom
suni72:telemetry-tests
Open

test: Refactor telemetry tests to follow repository style guidelines#345
suni72 wants to merge 5 commits into
GoogleCloudPlatform:mainfrom
suni72:telemetry-tests

Conversation

@suni72

@suni72 suni72 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

Description

What?

  • Update test names to follow test naming pattern defined in AGENT.md
  • Refactor telemetry tests to follow AAA pattern
  • Remove redundant tests (testLoggingOptionsDefaultValues and testLoggingOptionsCustomValues were similar to loggingTelemetryOptionsDefaultValues)

Checklist

  • PR title follows Conventional Commits (e.g., feat(core): ...)
  • All files include the Apache License 2.0 header
  • Documentation has been updated to reflect changes

Generated/Assisted by Agent? [Yes/No]

@gemini-code-assist

Copy link
Copy Markdown
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 refactoring the telemetry test suite to improve readability and consistency. By updating test method names and adjusting visibility modifiers, the codebase now better adheres to standard Java testing practices while maintaining the existing functional logic.

Highlights

  • Test Method Renaming: Renamed multiple test methods across telemetry modules to remove the 'test' prefix, aligning with modern JUnit 5 naming conventions.
  • Code Cleanup: Removed redundant 'public' modifiers from test classes and methods to improve code conciseness and adhere to package-private visibility standards for tests.
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 the 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 counterproductive. 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.

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
Contributor

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 standardizes test method names across several telemetry test classes by removing the redundant 'test' prefix and updating visibility modifiers to package-private. The review feedback identifies redundant tests in LoggingTelemetryReporterTest that duplicate LoggingTelemetryOptionsTest, and recommends correcting camelCase typos ('fallsback' to 'fallsBack') in two method names.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.14%. Comparing base (096d918) to head (b0a94d5).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #345   +/-   ##
=========================================
  Coverage     98.14%   98.14%           
  Complexity      564      564           
=========================================
  Files            38       38           
  Lines          1779     1779           
  Branches        167      167           
=========================================
  Hits           1746     1746           
  Misses           15       15           
  Partials         18       18           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suni72
suni72 marked this pull request as ready for review July 14, 2026 10:27
@suni72
suni72 requested a review from a team as a code owner July 14, 2026 10:27
@suni72 suni72 changed the title Refactor telemetry tests to follow AAA pattern Refactor telemetry tests to follow repository guidelines Jul 14, 2026
@suni72
suni72 requested a review from dheerajsngh July 14, 2026 10:28
@suni72
suni72 force-pushed the telemetry-tests branch from f20b2a3 to 11082a2 Compare July 14, 2026 10:59
@suni72
suni72 force-pushed the telemetry-tests branch from 11082a2 to ea1e2ce Compare July 29, 2026 11:04
@suni72
suni72 force-pushed the telemetry-tests branch from ea1e2ce to 3ec9992 Compare July 29, 2026 11:06

@Test
void testOpenTelemetryOptionsLoggingProvider() {
void openTelemetryOptionsLoggingProvider() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you also update these names as per following convention:
methodName_stateUnderTest_expectedBehavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you update the names here and above as well.

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.

done

@dheerajsngh dheerajsngh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Update the PR description to also include "style".
Also update hte PR title to include style or test.

@suni72 suni72 changed the title Refactor telemetry tests to follow repository guidelines Refactor telemetry tests to follow repository style guidelines Aug 3, 2026
}

@Test
public void testLoggingOptionsCustomValues() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't this tests is present. We can add this back.

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.

LoggingTelemetryOptions is an AutoValue class so generally we don't need to test the builder. Also testCreateFromOptions_WithAllOptions in LoggingTelemetryOptionsTest.java checks that custom values from options are set correctly.

@dheerajsngh dheerajsngh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update the PR title to include its a style or test change.
test: Refact ....
Other thing looks good.

@suni72 suni72 changed the title Refactor telemetry tests to follow repository style guidelines test: Refactor telemetry tests to follow repository style guidelines Aug 5, 2026
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