Skip to content

Fix: wrong arg order of testify/assert#1421

Merged
kmesh-bot merged 1 commit intokmesh-net:mainfrom
brushax:assert-fix
May 23, 2025
Merged

Fix: wrong arg order of testify/assert#1421
kmesh-bot merged 1 commit intokmesh-net:mainfrom
brushax:assert-fix

Conversation

@brushax
Copy link
Copy Markdown
Contributor

@brushax brushax commented May 22, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #1420

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Copilot AI review requested due to automatic review settings May 22, 2025 17:34
@kmesh-bot kmesh-bot added the kind/bug Something isn't working label May 22, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug by correcting the argument order in testify/assert calls in various test files. The changes ensure that the expected value is passed before the actual value, improving test readability and consistency.

  • Fixed argument order in assert.Equal calls.
  • Standardized test assertions across multiple components.
  • Improved test consistency in status, workload, telemetry, ads, and cache modules.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/status/status_server_test.go Updates assert.Equal argument ordering in server metric handlers.
pkg/controller/workload/workload_processor_test.go Updates expected vs. actual order in IP equality assertions.
pkg/controller/workload/cache/waypoint_cache_test.go Standardizes assert.Equal ordering for cache length validations.
pkg/controller/bpfcache/endpoint_test.go Updates assert.Equal ordering for endpoint count verifications.
pkg/controller/telemetry/metric_test.go Corrects assert.Equal ordering for connection metrics checks.
pkg/controller/ads/convert_filter_test.go Changes assert.Equal argument order for cluster name validation.
pkg/controller/ads/ads_processor_test.go Updates assert.Equal ordering for nonce and DNS cluster count checks.
pkg/cache/v2/listener_test.go Fixes assert.Equal argument order for listener API status assertions.
Comments suppressed due to low confidence (1)

pkg/status/status_server_test.go:461

  • The method name 'GetWorklaodMetricTrigger' appears to have a typo. Consider renaming it to 'GetWorkloadMetricTrigger' for clarity.
assert.Equal(t, false, server.xdsClient.WorkloadController.GetWorklaodMetricTrigger())

Signed-off-by: Tom <yusencao@outlook.com>
@codecov
Copy link
Copy Markdown

codecov bot commented May 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.27%. Comparing base (b7848f1) to head (0d31bae).
Report is 24 commits behind head on main.

see 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98facf9...0d31bae. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yp969803
Copy link
Copy Markdown
Contributor

@Flying-Tom have u checked all the asserts.Equal

@yp969803
Copy link
Copy Markdown
Contributor

/lgtm

@brushax
Copy link
Copy Markdown
Contributor Author

brushax commented May 23, 2025

@Flying-Tom have u checked all the asserts.Equal

Most assert.Equal have been walkthroughed (There may be some omissions

@kmesh-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit e5d75c9 into kmesh-net:main May 23, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor bad assert.Equal

5 participants