Skip to content

Add unit tests for azuremachine_validation#6277

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
mboersma:azuremachine-validation-coverage
May 6, 2026
Merged

Add unit tests for azuremachine_validation#6277
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
mboersma:azuremachine-validation-coverage

Conversation

@mboersma
Copy link
Copy Markdown
Contributor

@mboersma mboersma commented May 5, 2026

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Adds the missing unit-test coverage for internal/webhooks/azuremachine_validation.go called out in the linked issue:

  • TestAzureMachine_ValidateDataDisks gains cases for disk.Lun nil and out-of-range (< 0, > 63).
  • New TestAzureMachine_ValidateDiagnostics covers all branches of ValidateDiagnostics (nil diagnostics, nil boot, the three BootDiagnosticsStorageAccountType values, and missing/empty UserManaged.StorageAccountURI).

After this change, both ValidateDataDisks and ValidateDiagnostics report 100% statement coverage.

The ValidateDataDisksUpdate / validateManagedDisksUpdate cases mentioned in the issue are no longer applicable — those functions were removed during the webhook refactor.

Which issue(s) this PR fixes:
Fixes #3374

Special notes for your reviewer:

None.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels May 5, 2026
@k8s-ci-robot k8s-ci-robot requested review from Jont828 and bryan-cox May 5, 2026 20:21
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.95%. Comparing base (bd1e799) to head (7410779).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6277      +/-   ##
==========================================
+ Coverage   43.88%   43.95%   +0.07%     
==========================================
  Files         289      289              
  Lines       25351    25351              
==========================================
+ Hits        11125    11143      +18     
+ Misses      13448    13435      -13     
+ Partials      778      773       -5     

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

@mboersma mboersma requested review from jackfrancis and willie-yao and removed request for Jont828 May 5, 2026 22:04
@mboersma
Copy link
Copy Markdown
Contributor Author

mboersma commented May 5, 2026

/retest

Copy link
Copy Markdown
Contributor

@willie-yao willie-yao left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 5, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 77e534589aa1e915c20cb8b841abc410f5271b8c

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: willie-yao

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 5, 2026
@k8s-ci-robot k8s-ci-robot merged commit bd0f01b into kubernetes-sigs:main May 6, 2026
22 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone May 6, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in CAPZ Planning May 6, 2026
@mboersma mboersma deleted the azuremachine-validation-coverage branch May 6, 2026 02:33
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add missing test coverage for azuremachine_validation.go

3 participants