Skip to content

feat: Add BVT Container Tests#17840

Draft
MadhurAggarwal wants to merge 4 commits into
4.0from
madagg/add-bvt-container-tests
Draft

feat: Add BVT Container Tests#17840
MadhurAggarwal wants to merge 4 commits into
4.0from
madagg/add-bvt-container-tests

Conversation

@MadhurAggarwal

@MadhurAggarwal MadhurAggarwal commented Jun 29, 2026

Copy link
Copy Markdown
Member

This PR adds BVT Container Tests using Pytest Framework (based on PR-17372) for Azl 4.0

Test Structure

  • Each test has a Dockerfile that installs Python3 and copies the helper script into the container
  • Then, pytest tests are run that invoke the helper script via container_exec_shell

Math Tests

Tests Python runtime sanity and CPU/arithmetic performance using the Spigot Algorithm for π calculation.

  1. Pi Calculation
    • Calculates π to 1,000 decimal places.
  2. Sustained Performance Test
    • Verifies that calculating π (up to 10,000 decimal places) completes within a specified time limit (20 seconds)

Network Tests

  1. HTTPS Fetch / Online Services Test

    • Fetches weather forecasts from either:
      • Mock weather data hosted in Blob Storage, or
      • forecast.weather.gov
    • In strict mode, the response is parsed and validated.
    • By default, strict mode is disabled.
  2. Sustained HTTPS Checks (Core Networking Test)

    • Downloads the Azure Linux 2.0/3.0 repo configs in 50 independent iterations.
    • Parses the downloaded content in strict mode which is enabled by default.
    • Notes
      • I haven't yet included the Azure Linux 4.0 repo configs (https://packages.microsoft.com/azurelinux/4.0/beta/base/x86_64/config.repo) because it is a beta path that might change in the future.
      • The Azl 3.0 implementation for this test also includes: HeaderTest, PingTest, and DownloadFileName to log the test details.
        However, these are disabled by default so I didnt include them yet. I would discuss and add these if needed.

Local Testing using azldev tool:

image image

Copilot AI review requested due to automatic review settings June 29, 2026 11:33

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

This PR adds two new BVT (Build Verification Test) runtime container test suites for Azure Linux 4.0, placed under base/images/tests/cases/runtime/container-base/. Each suite uses the existing @pytest.mark.dockerfile() pattern to build a custom image (installing python3) on top of the image-under-test, then runs helper scripts via container_exec_shell. The math suite validates Python compute correctness/performance via a spigot π algorithm, and the network suite validates outbound HTTPS connectivity and sustained repo-config fetches. The placement auto-marks them as runtime tests restricted to the container-base family, matching that family's runtime-package-management capability.

Changes:

  • Add test_math (π to 1000 places + sustained 10×1000-place compute under a 20s/iteration threshold).
  • Add test_network (weather HTTPS fetch with optional strict parsing + 50-iteration sustained repo-config fetch in strict mode).
  • Add two Dockerfiles installing python3 and copying helper scripts into /opt/azl-tests/.

Reviewed changes

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

Show a summary per file
File Description
test_math/test_math.py Pytest entrypoints invoking pi.py for π validation
test_math/pi.py Spigot π helper; missing docstrings and over-length literals flagged
test_math/Dockerfile Installs python3, copies pi.py — follows required pattern
test_network/test_network.py Pytest entrypoints invoking netcheck.py for HTTPS checks
test_network/netcheck.py HTTP fetch/parse helpers; urlopen lacks timeout, one over-length line
test_network/Dockerfile Installs python3, copies netcheck.py — follows required pattern

Comment thread base/images/tests/cases/runtime/container-base/test_network/netcheck.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_math/pi.py
Comment thread base/images/tests/cases/runtime/container-base/test_math/pi.py
Comment thread base/images/tests/cases/runtime/container-base/test_network/netcheck.py Outdated
@MadhurAggarwal MadhurAggarwal changed the title Add BVT Container Tests feat: Add BVT Container Tests Jun 29, 2026
Copilot AI review requested due to automatic review settings June 29, 2026 12:58

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 6 out of 6 changed files in this pull request and generated 2 comments.

Comment on lines +61 to +63
start = time.time()
answer = pi_to_places(places)
if len(answer) != places + 2 or time.time() - start > MAX_SECONDS_PER_COMPUTE:
Comment on lines +79 to +82
if not (name and enabled) and strict:
return False
if len(page) == 0:
return False
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