Skip to content

Conversation

@Kunal1522
Copy link
Contributor

Fixes #3202

What's in the test

Main test function:

  • TestMetadata_Subscriptions - The actual test. Sets up a Broker, deploys two functions (subscriber and producer), fires an event, and checks the subscriber's logs to confirm it received the event through the Broker.
    Helper functions:
  • createBroker(t, namespace, name) - Creates a Knative Broker using kubectl apply. Waits for it to be ready before returning.
  • deleteBroker(t, namespace, name) - Cleanup helper that deletes the Broker when the test finishes.
  • waitForTrigger(t, namespace, functionName) - Waits for the Knative Trigger (created by func subscribe) to reach Ready state. Without this, events might get lost if we send them too early.
    Unused legacy helpers (kept for potential future use):
  • sendEventToBrokerWithRetry - Retry wrapper for sending events (not currently used, test uses direct HTTP instead)
  • sendEventToBrokerInternal - In-cluster event sending using Kubernetes port-forwarding (not currently used, test deploys a Producer function instead)

This test verifies the full Knative Eventing flow using func subscribe:
- Creates a producer function that sends CloudEvents to the broker
- Creates a subscriber function that receives events via a Trigger
- Validates the complete event delivery pipeline

Fixes knative#3202
@knative-prow
Copy link

knative-prow bot commented Jan 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Kunal1522
Once this PR has been reviewed and has the lgtm label, please assign lkingland 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

@knative-prow
Copy link

knative-prow bot commented Jan 2, 2026

Hi @Kunal1522. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 2, 2026
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.42%. Comparing base (039b926) to head (471e485).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3324      +/-   ##
==========================================
- Coverage   55.09%   53.42%   -1.68%     
==========================================
  Files         170      170              
  Lines       19850    19850              
==========================================
- Hits        10937    10605     -332     
- Misses       7845     8230     +385     
+ Partials     1068     1015      -53     
Flag Coverage Δ
e2e 40.03% <ø> (+0.44%) ⬆️
e2e go 35.62% <ø> (ø)
e2e node 31.13% <ø> (ø)
e2e python 35.27% <ø> (-0.09%) ⬇️
e2e quarkus 31.28% <ø> (ø)
e2e rust 30.73% <ø> (ø)
e2e springboot 30.75% <ø> (-0.03%) ⬇️
e2e typescript 31.25% <ø> (ø)
integration ?
unit macos-14 44.96% <ø> (-0.01%) ⬇️
unit macos-latest 44.96% <ø> (ø)
unit ubuntu-24.04-arm 45.07% <ø> (ø)
unit ubuntu-latest 45.86% <ø> (ø)
unit windows-latest 44.98% <ø> (ø)

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The subscribe command doesn't support the -v (verbose) flag that newCmd()
automatically adds when FUNC_E2E_VERBOSE=true. This causes test failures.

Changed to use exec.Command directly for the subscribe call to bypass
the automatic verbose flag addition while keeping it for other commands.
Check for broker-ingress service before running the test to gracefully
skip if Knative Eventing is not installed or not ready yet.
The test was failing in CI because it tried to send events before
the broker-ingress service was registered in DNS. This adds a retry
loop to wait for the service to be available before proceeding.

Fixes timing issues in fresh cluster environments.
@Kunal1522 Kunal1522 marked this pull request as draft January 2, 2026 21:14
@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 2, 2026
@Kunal1522 Kunal1522 marked this pull request as ready for review January 3, 2026 10:21
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2E Subscription Tests

1 participant