63 expand e2e test coverage#65
Merged
Merged
Conversation
Closed
12 tasks
…& run `task manifests` Adds the 'delete' verb to the PaymentMethod validation webhook configuration and controller manager setup. This ensures the webhook is invoked on deletion, blocking the deletion of any payment method currently designated as a default.
Adds validation tests to verify that: - Updating 'currencyCode' on an active account is rejected. - Updating contact info with invalid email formats or invalid ISO 3166-1 alpha-2 country codes is rejected.
Introduces E2E tests under 'payment-method-lifecycle' to verify the behavior of PaymentMethods and their interaction with BillingAccounts, specifically: - Correct transitions through 'Pending', 'Active', and 'Failed' phases. - Validation that only 'Active' payment methods can be linked as default. - Validation that the webhook blocks deletion of a payment method designated as a default.
Updates the 'billing-account-binding' test suite to verify that: - Deleting a BillingAccount that has an active BillingAccountBinding is blocked by the validation webhook. - Manually patching a binding to 'Superseded' is respected by the controller (and not reconciled back to Active). - Stale bindings are cleaned up properly at the end of the test execution to ensure a clean namespace teardown.
…unit immutability
… active phase in controller tests
mattdjenkinson
approved these changes
Jun 29, 2026
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.
PR Title: Expand E2E Test Coverage and Enforce Resource Webhook Validations
Warning
In ownership_webhook.go, the
+kubebuilder:webhookcomments for theMeterDefinitionandMonitoredResourceTypeownership validation checks were originally inside function doc comments, causingcontroller-gento ignore them. As a result, these webhooks were never actually registered inconfig/base/webhook/manifests.yaml. We have moved these annotations directly above theownershipWebhookstruct declaration to generate the manifests. Please review whether registering these ownership validation webhooks is part of the intended system logic or if they were meant to be left unregistered.In meterdefinition.go, we implemented the immutability validation checks for
billing.consumedUnitandbilling.pricingUnit.In paymentmethod_webhook.go, we updated the validating webhook annotations to register the
deleteverb (which was previously missing).Description
This Pull Request addresses test and validation coverage gaps across the billing Custom Resource Definitions (
BillingAccount,BillingAccountBinding,MeterDefinition,MonitoredResourceType,PaymentMethod, andPaymentMethodClass). It implements additional validation rules (immutability and phase transitions) and registers the missing ownership webhook configurations, backed by comprehensive end-to-end (E2E) verification suites.Key Changes
MeterDefinitionforbilling.consumedUnitandbilling.pricingUnitin Go.ownership_webhook.goto properly generate and register validating webhook configurations for resource ownership.PaymentMethodwith default classes present/absent.MonitoredResourceType.test/e2e/ownership-webhook/to verify ownership validation rules via user impersonation.