Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 16, 2025

This PR updates the JmxMetric smoke test to use the new assertion framework introduced in #4141, making the test more readable and maintainable while keeping changes minimal.

Changes Made

1. Updated verifyJmxMetricsSentToBreeze method

  • Replaced manual waitForItems calls with fluent testing.waitAndAssertMetric() calls
  • Added individual metric assertions using the new framework for:
    • NameWithDot - validates value equals 5
    • DefaultJmxMetricNameOverride - validates metric exists
    • BooleanJmxMetric - validates value equals 1.0
    • DotInAttributeNameAsPathSeparator - validates metric exists
    • Loaded Class Count - validates metric exists

2. Extended MetricAssert class

  • Added hasNoInternalAttributes() method to validate that metrics don't contain properties starting with applicationinsights.internal.
  • This replaces the previous verifyNoInternalAttributes() helper method

3. Maintained existing logic

  • Preserved the complex GC metrics and wildcard metric validation logic that requires collecting values to verify the wildcard sum
  • Kept all existing edge case handling for different Java versions (Java 21+ behavior)

Testing

  • ✅ JmxMetric smoke test passes with all 5 test variants (Java 8, 11, 17, 21, 23)
  • ✅ Code formatting applied with spotlessApply
  • ✅ Framework tests pass

The changes maintain backward compatibility while modernizing the assertions to use the new fluent API pattern.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@trask trask closed this Jul 16, 2025
Copilot AI changed the title [WIP] Update the JmxMetric smoke test to use the new assertion framework introduced in @microsoft/ApplicationInsights-Java/pull/4141 Keep changes minimal to make it easier to review. Extend the assertion framework if needed. Run the JmxMetric smoke test af... Update JmxMetric smoke test to use new assertion framework Jul 16, 2025
Copilot AI requested a review from trask July 16, 2025 02:34
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