chore(testing): Add tests for Domain Reconciler#646
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #646 +/- ##
==========================================
+ Coverage 28.77% 29.67% +0.89%
==========================================
Files 95 98 +3
Lines 15708 15825 +117
==========================================
+ Hits 4520 4696 +176
+ Misses 10924 10855 -69
- Partials 264 274 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
alex-bezek
approved these changes
May 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This PR aims to help us improve our testing using envtest by creating a persistent mock for the ngrok reserved domains client. Eventually, we'll mock out more of the interfaces so that we do better integration testing of our Controllers and can maintain a list of automated regressions.
How
ngrokapi.DomainClientinterface. This mock persistently holds reserved domains and attempts to accurately return the same response that you would get from an actual client talking to ngrok. I've also added tests so that we can verify the mock behaves as we would expect.DomainReconcilerusing the mockDomainClientto test common scenarios. There is a bit of a TODO here in that we aren't mocking things like transport errors. More work is needed to inject custom errors to test that theDomainReconcilergracefully handles those. However, this is a building block that will allow us to test applying Gateway, Ingress, or Load Balancer Service objects in envtest and validate that the correct items are provisioned handling any intermediate errors.Breaking Changes
No, this is mostly adding better test coverage and allowing us to do better regression testing.