feat: Add BVT Container Tests#17840
Conversation
There was a problem hiding this comment.
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
python3and 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 |
| start = time.time() | ||
| answer = pi_to_places(places) | ||
| if len(answer) != places + 2 or time.time() - start > MAX_SECONDS_PER_COMPUTE: |
| if not (name and enabled) and strict: | ||
| return False | ||
| if len(page) == 0: | ||
| return False |
This PR adds BVT Container Tests using Pytest Framework (based on PR-17372) for Azl 4.0
Test Structure
Dockerfilethat installs Python3 and copies the helper script into the containerpytesttests are run that invoke the helper script viacontainer_exec_shellMath Tests
Tests Python runtime sanity and CPU/arithmetic performance using the Spigot Algorithm for π calculation.
Network Tests
HTTPS Fetch / Online Services Test
forecast.weather.govSustained HTTPS Checks (Core Networking Test)
https://packages.microsoft.com/azurelinux/4.0/beta/base/x86_64/config.repo) because it is abetapath that might change in the future.However, these are disabled by default so I didnt include them yet. I would discuss and add these if needed.
Local Testing using
azldevtool: