Skip to content

test: add dotnet runtime tests for base container#17959

Open
realsdx wants to merge 1 commit into
4.0from
sudipta/4.0/add-dotnet-tests
Open

test: add dotnet runtime tests for base container#17959
realsdx wants to merge 1 commit into
4.0from
sudipta/4.0/add-dotnet-tests

Conversation

@realsdx

@realsdx realsdx commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Add dotnet-10.0 runtime tests for 4.0, this is a rework of our older base and base extended container tests, renamed to reflect it's true nature.

Copilot AI review requested due to automatic review settings July 9, 2026 13:59
@realsdx realsdx marked this pull request as ready for review July 9, 2026 14:05
@realsdx realsdx requested a review from a team as a code owner July 9, 2026 14:05

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 a new Dockerfile-based runtime test (test_dotnet) under the container-base image test suite to validate that the .NET 10 runtime works on the Azure Linux 4.0 base container. It follows the established pattern used by the existing test_nodejs/test_python/test_php suites: a Dockerfile layers the dotnet-sdk-10.0 on top of the image-under-test, publishes two small apps, and pytest exercises them via the shared container fixtures. The PR description frames this as a rework/rename of older base and base-extended container tests.

Changes:

  • Adds test_dotnet.py with three tests (dotnet --version, an HttpListener web app served over HTTP, and a RestSharp client that confirms outbound connectivity).
  • Adds two .NET projects (webapp, restclient) with Program.cs/app.csproj, both producing app.dll.
  • Adds a Dockerfile that installs the .NET SDK + curl and publishes both apps to /app/....

Reviewed changes

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

Show a summary per file
File Description
test_dotnet/test_dotnet.py New pytest cases using container_exec_shell/assert_http_server; the rest-client test depends on live outbound network.
test_dotnet/Dockerfile Builds on BASE_IMAGE, installs dotnet-sdk-10.0+curl, publishes both apps; consistent with sibling Dockerfiles.
test_dotnet/webapp/Program.cs Minimal HttpListener server on port 8080 returning "Hello World!".
test_dotnet/webapp/app.csproj net10.0 exe named app; sets InvariantGlobalization.
test_dotnet/restclient/Program.cs RestSharp GET to microsoft.com, prints reachability.
test_dotnet/restclient/app.csproj net10.0 exe named app; references RestSharp 112.1.0; omits InvariantGlobalization (inconsistent with webapp).

Comment on lines +34 to +39
@pytest.mark.dockerfile()
def test_dotnet_rest_client(container_exec_shell) -> None:
"""RestSharp must reach microsoft.com over the network."""
result = container_exec_shell("dotnet /app/restclient/app.dll")
assert result.exit_code == 0, f"dotnet app failed: {result.output}"
assert "Microsoft.com is reachable." in result.output

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@realsdx Please see if you can address this comment, and use a local endpoint instead. I hope we can avoid requiring access to public internet in the test harness.

Comment on lines +2 to +6
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>app</AssemblyName>
</PropertyGroup>
Comment on lines +34 to +39
@pytest.mark.dockerfile()
def test_dotnet_rest_client(container_exec_shell) -> None:
"""RestSharp must reach microsoft.com over the network."""
result = container_exec_shell("dotnet /app/restclient/app.dll")
assert result.exit_code == 0, f"dotnet app failed: {result.output}"
assert "Microsoft.com is reachable." in result.output

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@realsdx Please see if you can address this comment, and use a local endpoint instead. I hope we can avoid requiring access to public internet in the test harness.

@@ -0,0 +1,9 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN dnf install -y dotnet-sdk-10.0 curl && dnf clean all

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question (non-blocking): We will eventually be shipping multiple dotnet versions (i.e., 10 and 11). How do you propose we expand our dotnet test coverage?

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