Skip to content

Check DeleteCollection actions in reconciler table tests - #3430

Merged
knative-prow[bot] merged 7 commits into
knative:mainfrom
suntp:suntp/assert-delete-collection-actions
Nov 21, 2026
Merged

knative-prow[bot] merged 7 commits into
knative:mainfrom
suntp:suntp/assert-delete-collection-actions

Conversation

@suntp

@suntp suntp commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

TableRow.Test reads the fake clients’ action log but skips WantDeleteCollections. A row passes both when reconciliation omits an expected collection delete and when it deletes a collection unexpectedly.

Fixes #2455.

Solution

Compare the expected and recorded collection deletes in order, including label/field selectors and available client-go options such as list limits and dry run. Expectations with action metadata check the resource, subresource and namespace. A selector-only expectation checks the row’s namespace and leaves the resource and subresource unspecified. SkipNamespaceValidation applies in both cases.

Validation results

Check Result
Reconciler and webhook packages, go test -race -count=1 ./reconciler/... ./webhook/... 11 packages passed, 3 had no test files
In-process TableRow regressions 24 cases cover counts, order, scope, selectors, options and selector-only expectations
Five mutations covering skipped validation, label/namespace checks and selector-only handling Each mutation failed the regression suite. The restored implementation passed
Downstream net-contour at 51fa035a Reproduced both failing reconciler rows with the previous patch. All 3 packages with tests passed under -race with the updated table code
Style checks on the PR diff golangci-lint 2.11.4 reported zero issues in the changed package. The Go test header matches the repository template

Limitations & follow-ups

This checks the calls made by the reconciler. Simulating deletion of matching objects in the fake tracker is a separate Kubernetes issue. kubernetes/kubernetes#105357

Signed-off-by: suntp <20786998+suntp@users.noreply.github.com>
@knative-prow

knative-prow Bot commented Nov 20, 2026

Copy link
Copy Markdown

Welcome @suntp! It looks like this is your first PR to knative/pkg 🎉

@knative-prow
knative-prow Bot requested review from dprotaso and dsimansk November 20, 2026 11:50
@knative-prow knative-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 20, 2026
@knative-prow

knative-prow Bot commented Nov 20, 2026

Copy link
Copy Markdown

Hi @suntp. Thanks for your PR.

I'm waiting for a knative 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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 20, 2026
return nil
}

func TestTableRowDeleteCollections(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can probably just create your own TableTest/Row test and not require the invocation of a test binary.

I'm assuming there is a precedent already set here

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.

Updated in f1819e3. Matching cases now call TableRow.Test directly, and mismatch cases capture diagnostics from the same row runner in process. All 24 cases pass, and the regression tests catch five deliberate mutations.

I also reproduced the two net-contour failures with selector-only expectations and verified that its full test suite passes locally with this change.

@dprotaso

Copy link
Copy Markdown
Member

/ok-to-test

@knative-prow knative-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 21, 2026
@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.41%. Comparing base (b2f6241) to head (19946e5).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3430      +/-   ##
==========================================
+ Coverage   75.37%   75.41%   +0.04%     
==========================================
  Files         189      189              
  Lines        8368     8371       +3     
==========================================
+ Hits         6307     6313       +6     
+ Misses       1819     1816       -3     
  Partials      242      242              

☔ View full report in Codecov by Harness.
📢 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.

suntp and others added 6 commits November 21, 2026 13:20
Signed-off-by: suntp <20786998+suntp@users.noreply.github.com>
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>

@dprotaso dprotaso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/approve
/lgtm

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 21, 2026
@knative-prow

knative-prow Bot commented Nov 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, suntp

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

@knative-prow knative-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2026
@knative-prow
knative-prow Bot merged commit 6815946 into knative:main Nov 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that 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.

WantDeleteCollections was never implemented in TableTest

2 participants