Skip to content

test: add footprint tests for container, wsl & vm-base image#18112

Open
bhagyapathak wants to merge 1 commit into
4.0from
bhagya/footprint-container-tests
Open

test: add footprint tests for container, wsl & vm-base image#18112
bhagyapathak wants to merge 1 commit into
4.0from
bhagya/footprint-container-tests

Conversation

@bhagyapathak

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 24, 2026 07:11
@bhagyapathak
bhagyapathak requested a review from a team as a code owner July 24, 2026 07:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds image-footprint validation for container, VM-base, and WSL artifacts.

Changes:

  • Adds installed-package and artifact-size thresholds.
  • Adds RPM size querying and WSL extraction support.
  • Extends pytest fixtures and image-type detection for WSL.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
base/images/tests/utils/pytest_plugin.py Recognizes WSL image artifacts.
base/images/tests/utils/parsers.py Queries installed RPM sizes.
base/images/tests/utils/extract.py Adds WSL extraction and cleanup.
base/images/tests/README.md Documents the package-size fixture.
base/images/tests/conftest.py Exposes WSL and package-size fixtures.
base/images/tests/cases/static/test_footprint.py Adds footprint threshold tests.
Comments suppressed due to low confidence (5)

base/images/tests/cases/static/test_footprint.py:116

  • This bare assertion also triggers Ruff S101 under the repository-wide select = ["ALL"] configuration. Convert it to an explicit failure.
    assert not negative, f"packages with negative reported size: {sorted(negative)}"

base/images/tests/cases/static/test_footprint.py:119

  • This bare assertion triggers Ruff S101 and will prevent the new test file from passing repository lint.
    assert total > 0, "total installed footprint is zero"

base/images/tests/cases/static/test_footprint.py:133

  • This threshold assertion is another Ruff S101 violation. Express the failure explicitly so lint can pass.
    assert total <= cap, (
        f"installed footprint {total / _BYTES_PER_MB:.1f} MB exceeds the "
        f"{cap / _BYTES_PER_MB:.0f} MB cap for image '{image_name}'"
    )

base/images/tests/cases/static/test_footprint.py:162

  • This bare assertion triggers Ruff S101 under the root lint configuration. Use pytest.fail(...) for the explicit value check.
    assert size_bytes > 0, f"image artifact is empty: {image_path}"

base/images/tests/cases/static/test_footprint.py:166

  • This final assertion also violates Ruff S101, so the file remains unlintable even after converting the earlier checks.
    assert size_bytes <= cap, (
        f"image artifact {size_bytes / _BYTES_PER_MB:.1f} MB exceeds the "
        f"{cap / _BYTES_PER_MB:.0f} MB cap for image '{image_name}'"
    )

Comment thread base/images/tests/cases/static/test_footprint.py Outdated
Comment thread base/images/tests/cases/static/test_footprint.py Outdated
Comment thread base/images/tests/utils/extract.py Outdated
Copilot AI review requested due to automatic review settings July 24, 2026 07:36
@bhagyapathak
bhagyapathak force-pushed the bhagya/footprint-container-tests branch from 6525323 to 50ca719 Compare July 24, 2026 07:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread base/images/tests/utils/parsers.py Outdated
Comment thread base/images/tests/utils/extract.py Outdated
@bhagyapathak

Copy link
Copy Markdown
Contributor Author

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

base/images/tests/utils/parsers.py:73

  • This assignment overwrites an earlier record whenever multiple installed RPM instances share the same NAME (for example, multilib packages or parallel install-only kernel versions). The resulting total undercounts the image footprint and can let the threshold test pass incorrectly; aggregate duplicate names instead.
            continue

Copilot AI review requested due to automatic review settings July 24, 2026 07:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Comment thread base/images/tests/utils/extract.py
Comment thread base/images/tests/README.md
Copilot AI review requested due to automatic review settings July 24, 2026 08:10
@bhagyapathak
bhagyapathak force-pushed the bhagya/footprint-container-tests branch from e675138 to eea49d3 Compare July 24, 2026 08:10
@bhagyapathak
bhagyapathak force-pushed the bhagya/footprint-container-tests branch from eea49d3 to e8d702a Compare July 24, 2026 08:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

base/images/tests/README.md:160

  • The fixture table is now inconsistent with the documented WSL support: the adjacent image_type row still lists only "vm" and "container", although the fixture now returns "wsl" too. Update that row so users see the complete API.
| `installed_package_sizes` | session | `dict[str, int]` | Installed RPM name → on-disk size in bytes (`rpm --root`, `%{SIZE}`) |

Comment thread base/images/tests/utils/parsers.py Outdated
Copilot AI review requested due to automatic review settings July 24, 2026 08:15
@bhagyapathak
bhagyapathak force-pushed the bhagya/footprint-container-tests branch from e8d702a to ebb43fe Compare July 24, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

base/images/tests/utils/extract.py:231

  • ruff.toml:8 enables all lint rules, and S202 still flags extractall when the filter is "tar" rather than "data". This therefore fails ruff check. Since preserving rootfs absolute symlinks is intentional here, add the required same-line justification for the narrow suppression (or replace this with an equivalently validated custom extraction path).
        tar.extractall(rootfs, filter="tar")

Comment thread base/images/tests/utils/extract.py Outdated
Comment on lines +219 to +222
A WSL image is a plain (optionally gzip-compressed) rootfs tarball, not
an OCI archive. Unpack it rootlessly with the ``tar`` filter, which
permits the absolute symlink targets normal in a rootfs while still
rejecting members that are absolute or escape the destination.
Copilot AI review requested due to automatic review settings July 24, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 24, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

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