Skip to content

test: Language Runtime Container tests#17881

Open
bhagyapathak wants to merge 3 commits into
4.0from
bhagya/language-runtime-tests
Open

test: Language Runtime Container tests#17881
bhagyapathak wants to merge 3 commits into
4.0from
bhagya/language-runtime-tests

Conversation

@bhagyapathak

@bhagyapathak bhagyapathak commented Jul 1, 2026

Copy link
Copy Markdown

Language runtime tests for container

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

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 runtime container-validation tests for four language runtimes (Python, Ruby, PHP, Node.js) to the Azure Linux image test suite. Each test lives under base/images/tests/cases/runtime/container-base/test_<lang>/ and faithfully mirrors the existing test_nginx example: a Dockerfile layers the runtime onto the image-under-test (ARG BASE_IMAGE/FROM ${BASE_IMAGE}), a small app/server file is COPY'd in, and pytest uses the @pytest.mark.dockerfile() marker plus the container_exec_shell fixture to start a server and assert on an HTTP response. This extends smoke coverage of the container-base image's language runtimes.

Changes:

  • Adds version + HTTP-server tests for Python, Ruby, and Node.js (each: --version check and a stdlib HTTP server round-trip).
  • Adds PHP tests covering php --version, the zip extension being loaded, and a zip round-trip via the built-in server + router.php.
  • Adds per-language Dockerfiles that dnf install the runtime and supporting tools, consistent with the documented Dockerfile-based runtime-test pattern.

Reviewed changes

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

Show a summary per file
File Description
test_python/test_python.py Python version + stdlib http.server response test.
test_python/app.py Minimal http.server returning the expected string.
test_python/Dockerfile Installs python3, curl; copies app.py.
test_ruby/test_ruby.py Ruby version + stdlib socket HTTP server test.
test_ruby/app.rb Minimal TCPServer returning the expected string.
test_ruby/Dockerfile Installs ruby, curl; copies app.rb.
test_php/test_php.py PHP version, zip extension, and zip round-trip test.
test_php/router.php Built-in-server router exercising ZipArchive.
test_php/Dockerfile Installs php-cli, php-pecl-zip, unzip, curl; copies router.php.
test_nodejs/test_nodejs.py Node.js version + stdlib http server test.
test_nodejs/server.js Minimal http server returning the expected string.
test_nodejs/Dockerfile Installs nodejs, curl; copies server.js.

I verified: the @pytest.mark.dockerfile()/container_exec_shell framework supports these tests; each EXPECTED_RESPONSE matches its app's output; the referenced packages (python3, ruby, nodejs, php-cli, php-pecl-zip, unzip, curl) all exist as specs in the repo; and the Dockerfile and wait_for_http conventions match the established test_nginx precedent and the tests README.md. I found no substantive issues.

@bhagyapathak bhagyapathak changed the title Language Runtime Container tests test: Language Runtime Container tests Jul 1, 2026
@bhagyapathak

Copy link
Copy Markdown
Author

if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
return false; // serve the requested resource as-is.
} else {
$zip = new ZipArchive();

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.

question(non-blocking): I'm wondering what motivated the more extensive testing (zip/unzip) for php and why you didn't do something similar for the other languages.

@bhagyapathak bhagyapathak Jul 2, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you @tobias for the review.
test_php_zip_extension_loaded is intentionally PHP-specific. This is a direct port of the existing golden-container smoke tests, and my current goal is to bring them to the Azure Linux 4.0 base container with minimal changes. Once the golden containers are available, I plan to run the same test suite against them as well. For that reason, I have kept the tests as close to the original implementation as possible. But I am open to the option of adding this test later when golden container is availble.

The ZIP validation originates from the upstream PHP golden-container test. The php-pecl-zip package is an optional extension, so the presence of PHP alone does not guarantee that the ZIP extension is available. That's why the test explicitly verifies it through both a php -m check and a functional round-trip validation.

The other runtimes do not have an equivalent optional, headless-relevant extension.

Comment thread base/images/tests/cases/runtime/container-base/test_nodejs/test_nodejs.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_nodejs/test_nodejs.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_nodejs/test_nodejs.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_nodejs/test_nodejs.py Outdated

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

Comment thread base/images/tests/conftest.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_python/test_python.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_nodejs/test_nodejs.py Outdated
Comment thread base/images/tests/cases/runtime/container-base/test_php/test_php.py Outdated

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

Comment thread base/images/tests/cases/runtime/container-base/test_python/app.py
Comment thread base/images/tests/conftest.py

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

Comment thread base/images/tests/cases/runtime/container-base/test_python/app.py


if __name__ == "__main__":
HTTPServer(("0.0.0.0", 8080), Handler).serve_forever()
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 2, 2026 17: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 19 out of 19 changed files in this pull request and generated 1 comment.

@@ -0,0 +1,23 @@
"""Minimal stdlib HTTP server used to validate the Python runtime."""
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.

3 participants