Skip to content

test: add MCS controller event assertions in E2E#7313

Open
Denyme24 wants to merge 2 commits intokarmada-io:masterfrom
Denyme24:mcs-event-coverage-7252
Open

test: add MCS controller event assertions in E2E#7313
Denyme24 wants to merge 2 commits intokarmada-io:masterfrom
Denyme24:mcs-event-coverage-7252

Conversation

@Denyme24
Copy link
Copy Markdown

@Denyme24 Denyme24 commented Mar 21, 2026

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR improves E2E coverage for Karmada controller events in the existing MCS test flows.

as of now, the MCS E2E suite validates functional behavior such as ServiceExport/ServiceImport connectivity, derived service creation, and EndpointSlice propagation, but it does not verify the controller events emitted during those workflows. This PR adds inline event assertions to the current MCS scenarios so we also validate that the expected controller events are produced when reconciliation succeeds.

Specifically, this PR:

  • adds checks for SyncDerivedServiceSucceed in the existing ServiceImport flows
  • adds checks for SyncServiceSucceed and DispatchEndpointSliceSucceed in the existing CrossCluster MultiClusterService flow
  • adds a deterministic negative scenario to verify the ClusterNotFound warning event on MultiClusterService

We need this to improve E2E event coverage for MCS-related controllers without introducing standalone event-only tests, keeping the assertions close to the user-observable workflows they belong to.

Which issue(s) this PR fixes:

Part of #7252

Special notes for your reviewer:

This patch focuses on deterministic event coverage that fits naturally into the existing MCS E2E flows.

SyncDerivedServiceFailed, SyncServiceFailed, and DispatchEndpointSliceFailed were not included in this PR because they are harder to trigger reliably in the current E2E environment without introducing artificial failures or making the tests more brittle. APIIncompatible was also left out because the E2E clusters are created with a consistent environment, so reproducing an actual API compatibility mismatch is not straightforward in a stable CI-friendly way.

To keep this change aligned with the selected inline-assertion approach, this PR adds coverage for the success-path events that are already exercised by existing MCS scenarios, plus a deterministic negative case for ClusterNotFound.

Does this PR introduce a user-facing change?:

NONE

…ound event

Signed-off-by: Denyme24 <namanraj24@outlook.com>
Copilot AI review requested due to automatic review settings March 21, 2026 15:01
@karmada-bot
Copy link
Copy Markdown
Contributor

@Denyme24: The label(s) kind/test cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind test

What this PR does / why we need it:

This PR improves E2E coverage for Karmada controller events in the existing MCS test flows.

as of now, the MCS E2E suite validates functional behavior such as ServiceExport/ServiceImport connectivity, derived service creation, and EndpointSlice propagation, but it does not verify the controller events emitted during those workflows. This PR adds inline event assertions to the current MCS scenarios so we also validate that the expected controller events are produced when reconciliation succeeds.

Specifically, this PR:

  • adds checks for SyncDerivedServiceSucceed in the existing ServiceImport flows
  • adds checks for SyncServiceSucceed and DispatchEndpointSliceSucceed in the existing CrossCluster MultiClusterService flow
  • adds a deterministic negative scenario to verify the ClusterNotFound warning event on MultiClusterService

We need this to improve E2E event coverage for MCS-related controllers without introducing standalone event-only tests, keeping the assertions close to the user-observable workflows they belong to.

Which issue(s) this PR fixes:

Part of #7252

Special notes for your reviewer:

This patch focuses on deterministic event coverage that fits naturally into the existing MCS E2E flows.

SyncDerivedServiceFailed, SyncServiceFailed, and DispatchEndpointSliceFailed were not included in this PR because they are harder to trigger reliably in the current E2E environment without introducing artificial failures or making the tests more brittle. APIIncompatible was also left out because the E2E clusters are created with a consistent environment, so reproducing an actual API compatibility mismatch is not straightforward in a stable CI-friendly way.

To keep this change aligned with the selected inline-assertion approach, this PR adds coverage for the success-path events that are already exercised by existing MCS scenarios, plus a deterministic negative case for ClusterNotFound.

Does this PR introduce a user-facing change?:

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@karmada-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xishanyongye-chang for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@gemini-code-assist
Copy link
Copy Markdown

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 robustness of Karmada's MultiClusterService E2E tests by integrating comprehensive event assertions directly into existing workflows. The changes ensure that critical controller events, indicating successful operations and specific failure conditions like ClusterNotFound, are properly emitted and validated, thereby improving the reliability and observability of the MCS feature without introducing separate event-only tests.

Highlights

  • Enhanced E2E Event Coverage: Improved End-to-End test coverage for Karmada controller events within existing MultiClusterService (MCS) test flows by adding inline event assertions.
  • ServiceImport Event Checks: Added checks for the SyncDerivedServiceSucceed event in existing ServiceImport scenarios to validate successful derived service synchronization.
  • CrossCluster MultiClusterService Event Checks: Incorporated checks for SyncServiceSucceed and DispatchEndpointSliceSucceed events in the CrossCluster MultiClusterService flow, ensuring proper service and endpoint slice propagation.
  • ClusterNotFound Event Verification: Introduced a new deterministic negative test scenario to verify the ClusterNotFound warning event on MultiClusterService when a non-existent cluster is configured.
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.

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.

@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 21, 2026
@Denyme24 Denyme24 changed the title test: add event checks for MultiClusterService and handle ClusterNotFound event test: add MCS controller event assertions in E2E Mar 21, 2026
Copy link
Copy Markdown

@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 is a valuable addition, enhancing the E2E test coverage for MultiClusterService (MCS) controller events. The new tests for success-path events and the deterministic negative case for ClusterNotFound are well-implemented and improve confidence in the MCS controllers' behavior. The overall approach of adding inline event assertions to existing workflows is clean and effective. I have one suggestion to further improve the consistency of the new test helpers.

Copy link
Copy Markdown
Contributor

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 extends the existing MultiClusterService (MCS) E2E flows to also assert that expected Karmada controller events are emitted during successful reconciliation, and adds a deterministic negative case to validate ClusterNotFound warnings.

Changes:

  • Add event assertions for SyncDerivedServiceSucceed in existing ServiceImport flows.
  • Add event assertions for SyncServiceSucceed and DispatchEndpointSliceSucceed in the CrossCluster MultiClusterService flow.
  • Add a new negative CrossCluster scenario to assert the ClusterNotFound warning event, plus a small helper for event-reason checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 21, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.04%. Comparing base (3424bc7) to head (30fbd0c).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7313   +/-   ##
=======================================
  Coverage   42.03%   42.04%           
=======================================
  Files         874      874           
  Lines       53551    53551           
=======================================
+ Hits        22511    22516    +5     
+ Misses      29349    29346    -3     
+ Partials     1691     1689    -2     
Flag Coverage Δ
unittests 42.04% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Signed-off-by: Denyme24 <namanraj24@outlook.com>
@Denyme24
Copy link
Copy Markdown
Author

hey @XiShanYongYe-Chang, added E2E test coverage for Karmada controller events in the existing MCS test flows. PTAL.
thanks

@XiShanYongYe-Chang
Copy link
Copy Markdown
Member

Thanks~
/assign
Before starting the review, I might wait for the review of the 7300 first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants