Skip to content

Ensure context is configured for ResourceReconciler#Validate#654

Merged
scothis merged 2 commits intoreconcilerio:mainfrom
scothis:validate-context
Sep 29, 2025
Merged

Ensure context is configured for ResourceReconciler#Validate#654
scothis merged 2 commits intoreconcilerio:mainfrom
scothis:validate-context

Conversation

@scothis
Copy link
Member

@scothis scothis commented Sep 27, 2025

With nested validation, other reconcilers need access to the config within the Validate method at test time. At runtime this was managed by SetupWithManager.

Now the context is configured within each public entry point for ResourceReconciler.

Follow up to #652

With nested validation, other reconcilers need access to the config
within the Validate method at test time. At runtime this was managed by
SetupWithManager.

Now the context is configured within each public entry point for
ResourceReconciler.

Signed-off-by: Scott Andrews <scott@andrews.me>
@scothis
Copy link
Member Author

scothis commented Sep 27, 2025

@annismckenzie does this resolve your issue?

@scothis scothis mentioned this pull request Sep 27, 2025
@codecov
Copy link

codecov bot commented Sep 27, 2025

Codecov Report

❌ Patch coverage is 58.82353% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.38%. Comparing base (ec87995) to head (c853fbe).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
testing/subreconciler.go 0.00% 5 Missing ⚠️
reconcilers/resource.go 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #654      +/-   ##
==========================================
+ Coverage   57.28%   57.38%   +0.09%     
==========================================
  Files          39       39              
  Lines        4507     4510       +3     
==========================================
+ Hits         2582     2588       +6     
+ Misses       1811     1808       -3     
  Partials      114      114              

☔ 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.

@scothis scothis requested a review from mamachanko September 27, 2025 14:18
@annismckenzie
Copy link
Contributor

This does fix my integration test but the subreconciler tests are still failing:

=== FAIL: internal/subreconcilers TestDownstreamRecordsChildSetReconciler (0.00s)
panic: config must exist on the context. Check that the context is from a ResourceReconciler or WithConfig [recovered, repanicked]

goroutine 308 [running]:
testing.tRunner.func1.2({0x1068e84e0, 0x14000923150})
        /opt/homebrew/Cellar/go/1.25.1/libexec/src/testing/testing.go:1872 +0x190
testing.tRunner.func1()
        /opt/homebrew/Cellar/go/1.25.1/libexec/src/testing/testing.go:1875 +0x31c
panic({0x1068e84e0?, 0x14000923150?})
        /opt/homebrew/Cellar/go/1.25.1/libexec/src/runtime/panic.go:783 +0x120
reconciler.io/runtime/reconcilers.RetrieveConfigOrDie(...)
        /Users/annismckenzie/git/go/pkg/mod/github.com/scothis/reconcilerio-runtime@v0.0.0-20250927135542-67826b0b8b3b/reconcilers/reconcilers.go:97
reconciler.io/runtime/reconcilers.(*UpdatingObjectManager[...]).Validate(0x106c00520, {0x106bea6f8, 0x1400087cba0?})
        /Users/annismckenzie/git/go/pkg/mod/github.com/scothis/reconcilerio-runtime@v0.0.0-20250927135542-67826b0b8b3b/reconcilers/objectmanager.go:157 +0x164
reconciler.io/runtime/reconcilers.(*ChildSetReconciler[...]).Validate(0x1400084f130, {0x106bea6f8?, 0x1400087cba0})
        /Users/annismckenzie/git/go/pkg/mod/github.com/scothis/reconcilerio-runtime@v0.0.0-20250927135542-67826b0b8b3b/reconcilers/childset.go:298 +0x27c
reconciler.io/runtime/testing.(*SubReconcilerTestCase[...]).Run(0x106bf9c00, 0x14000485dc0, 0x140005a07e0, 0x106bbe2e0)
        /Users/annismckenzie/git/go/pkg/mod/github.com/scothis/reconcilerio-runtime@v0.0.0-20250927135542-67826b0b8b3b/testing/subreconciler.go:250 +0x910
reconciler.io/runtime/testing.SubReconcilerTestSuite[...].Run.func1()
        /Users/annismckenzie/git/go/pkg/mod/github.com/scothis/reconcilerio-runtime@v0.0.0-20250927135542-67826b0b8b3b/testing/subreconciler.go:369 +0x58
testing.tRunner(0x14000485dc0, 0x1400087c540)
        /opt/homebrew/Cellar/go/1.25.1/libexec/src/testing/testing.go:1934 +0xc8
created by testing.(*T).Run in goroutine 307
        /opt/homebrew/Cellar/go/1.25.1/libexec/src/testing/testing.go:1997 +0x364

DONE 105 tests, 9 failures in 0.900s

Does that help? I can also provide more code if needed.

Signed-off-by: Scott Andrews <scott@andrews.me>
@scothis
Copy link
Member Author

scothis commented Sep 28, 2025

@annismckenzie updated. Please try again

Copy link
Contributor

@mamachanko mamachanko left a comment

Choose a reason for hiding this comment

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

lgtm

@annismckenzie
Copy link
Contributor

That fixes it, thanks for the quick turnaround. 🚀

@annismckenzie annismckenzie mentioned this pull request Sep 29, 2025
@scothis scothis merged commit f1a1c5a into reconcilerio:main Sep 29, 2025
4 checks passed
@scothis scothis deleted the validate-context branch September 29, 2025 14:10
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.

3 participants