Skip to content

63 expand e2e test coverage#65

Merged
JoseSzycho merged 21 commits into
mainfrom
63-expand-e2e-test-coverage
Jun 29, 2026
Merged

63 expand e2e test coverage#65
JoseSzycho merged 21 commits into
mainfrom
63-expand-e2e-test-coverage

Conversation

@JoseSzycho

@JoseSzycho JoseSzycho commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

PR Title: Expand E2E Test Coverage and Enforce Resource Webhook Validations

Warning

  1. In ownership_webhook.go, the +kubebuilder:webhook comments for the MeterDefinition and MonitoredResourceType ownership validation checks were originally inside function doc comments, causing controller-gen to ignore them. As a result, these webhooks were never actually registered in config/base/webhook/manifests.yaml. We have moved these annotations directly above the ownershipWebhook struct 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.

  2. In meterdefinition.go, we implemented the immutability validation checks for billing.consumedUnit and billing.pricingUnit.

  3. In paymentmethod_webhook.go, we updated the validating webhook annotations to register the delete verb (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, and PaymentMethodClass). 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

  1. Validations & Webhooks:
    • Implemented immutability checks on MeterDefinition for billing.consumedUnit and billing.pricingUnit in Go.
    • Relocated kubebuilder annotations in ownership_webhook.go to properly generate and register validating webhook configurations for resource ownership.
  2. E2E Test Suites:
    • Added validations for billing account payment terms, tax ID formats, and contact info removal.
    • Verified that superseded binding counts correctly decrement.
    • Tested defaulting webhook behavior of PaymentMethod with default classes present/absent.
    • Validated forward-only phase transitions and GVK kind immutability on MonitoredResourceType.
    • Introduced a new E2E test suite under test/e2e/ownership-webhook/ to verify ownership validation rules via user impersonation.

@JoseSzycho JoseSzycho linked an issue Jun 24, 2026 that may be closed by this pull request
12 tasks
@JoseSzycho JoseSzycho marked this pull request as draft June 24, 2026 14:13
…& 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.
@JoseSzycho JoseSzycho marked this pull request as ready for review June 24, 2026 22:12
@JoseSzycho JoseSzycho enabled auto-merge June 24, 2026 22:12
@JoseSzycho JoseSzycho merged commit 06c9236 into main Jun 29, 2026
8 checks passed
@JoseSzycho JoseSzycho deleted the 63-expand-e2e-test-coverage branch June 29, 2026 20:52
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.

Expand E2E Test Coverage

2 participants