Skip to content

test(images): improve test coverage#2227

Merged
danilrwx merged 9 commits intomainfrom
fix/vi/unpacked-size
Apr 22, 2026
Merged

test(images): improve test coverage#2227
danilrwx merged 9 commits intomainfrom
fix/vi/unpacked-size

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Apr 16, 2026

Description

Add unit tests that cover unpacked size handling for VirtualImage and ClusterVirtualImage flows backed by PVC.

The tests verify that:

  • VirtualImage created from VirtualDiskSnapshot via PVC reports stored size from PVC capacity and unpacked size from requested PVC storage;
  • the helper that calculates unpacked size prefers requested PVC size and falls back to capacity when needed;
  • ClusterVirtualImage created from VirtualImage on PVC copies size fields correctly.

Why do we need it, and what problem does it solve?

There is already logic around stored and unpacked size propagation for PVC-backed images, but the branch currently changes only tests.

These tests protect the expected behavior from regressions, especially for cases where storage backend capacity differs from the requested PVC size and where size information must be propagated from VirtualImage to ClusterVirtualImage.

What is the expected result?

  1. Run unit tests for VI/CVI PVC-backed source handling.
  2. Verify that a PVC with requested size 10Gi and actual capacity 12Gi produces:
    • status.size.stored = 12Gi;
    • status.size.unpacked = 10Gi.
  3. Verify that ClusterVirtualImage copied from VirtualImage preserves the same size fields.
  4. Verify that unpacked size calculation falls back to PVC capacity when the request is absent.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: test
type: chore
summary: "Add unit tests for PVC-backed VI/CVI unpacked size handling."
impact_level: low

@danilrwx danilrwx force-pushed the fix/vi/unpacked-size branch from 1e387a0 to 3938798 Compare April 16, 2026 14:53
@danilrwx danilrwx added this to the v1.8.0 milestone Apr 16, 2026
@danilrwx danilrwx force-pushed the fix/vi/unpacked-size branch from 3938798 to 8aa7e17 Compare April 20, 2026 15:20
@danilrwx danilrwx changed the title fix(vi): unpacked size test(vi): improve test coverage Apr 20, 2026
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vi/unpacked-size branch from 8aa7e17 to c443065 Compare April 20, 2026 15:22
@danilrwx danilrwx changed the title test(vi): improve test coverage test(images): improve test coverage Apr 20, 2026
@danilrwx danilrwx marked this pull request as ready for review April 20, 2026 15:26
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx merged commit 835f411 into main Apr 22, 2026
27 of 28 checks passed
@danilrwx danilrwx deleted the fix/vi/unpacked-size branch April 22, 2026 09:27
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.

2 participants