From 8afcd07fe55cb6572e9f67d1916ba615c6c9b35c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 22:59:15 +0000 Subject: [PATCH 1/6] Add net48 e2e test project and Windows kind-in-WSL CI job --- .github/workflows/buildtest.yaml | 61 +++++++++++++++ .../E2E.Classic.Tests.csproj | 33 ++++++++ .../E2E.Classic.Tests/MinikubeClassicTests.cs | 75 +++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj create mode 100644 tests/E2E.Classic.Tests/MinikubeClassicTests.cs diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index 19c13b36b..b2985979b 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -87,6 +87,67 @@ jobs: exit 1 fi + # Run the .NET Framework (net48) end to end tests on Windows. There is no + # Linux Kubernetes distribution that runs natively on a Windows runner, so a + # kind cluster is created inside WSL and exposed to the Windows host (which + # runs the net48 test process) through WSL2 localhost forwarding. + e2e-windows-net48: + runs-on: windows-latest + name: E2E net48 (kind in WSL) + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + - name: Setup dotnet + uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 + with: + dotnet-version: | + 8.0.x + 10.0.x + - name: Setup WSL + uses: Vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0 + with: + distribution: Ubuntu-24.04 + additional-packages: docker.io curl + - name: Create kind cluster in WSL + shell: wsl-bash {0} + run: | + set -euxo pipefail + + # WSL has no systemd, so start the docker daemon manually and wait for it. + sudo dockerd > /tmp/dockerd.log 2>&1 & + for i in $(seq 1 30); do + if sudo docker info > /dev/null 2>&1; then break; fi + sleep 2 + done + sudo docker info > /dev/null + + # Install kind and kubectl. + curl -fsSLo ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 + chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind + curl -fsSLo ./kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl + + # Create the cluster. kind publishes the api server on 127.0.0.1 inside + # WSL, which WSL2 localhost forwarding makes reachable from Windows. + sudo kind create cluster --wait 120s + + # Export a kubeconfig the Windows side can consume. + sudo kind get kubeconfig > /mnt/c/kind.kubeconfig + - name: E2E net48 Test + shell: pwsh + env: + K8S_E2E_MINIKUBE: "1" + KUBECONFIG: C:\kind.kubeconfig + run: | + "" | Out-File -Encoding ascii skip.log + dotnet test tests/E2E.Classic.Tests -f net48 --logger "SkipTestLogger;file=$PWD/skip.log" -p:BuildInParallel=false + if ((Get-Item skip.log).Length -gt 0) { + Get-Content skip.log + Write-Error "CASES MUST NOT BE SKIPPED" + exit 1 + } + on: pull_request: types: [assigned, opened, synchronize, reopened] diff --git a/tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj b/tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj new file mode 100644 index 000000000..322168743 --- /dev/null +++ b/tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj @@ -0,0 +1,33 @@ + + + false + k8s.E2E + + net8.0 + net8.0;net48 + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + diff --git a/tests/E2E.Classic.Tests/MinikubeClassicTests.cs b/tests/E2E.Classic.Tests/MinikubeClassicTests.cs new file mode 100644 index 000000000..d7687ac09 --- /dev/null +++ b/tests/E2E.Classic.Tests/MinikubeClassicTests.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading; +using k8s.Autorest; +using k8s.Models; +using Xunit; + +namespace k8s.E2E +{ + [Collection(nameof(Onebyone))] + public class MinikubeClassicTests + { + // A small, self contained smoke test that exercises the .NET Framework (net48) + // build of the Classic client against a real cluster (kind running inside WSL on + // the Windows CI runner). ConfigMaps are used instead of Pods so the test does not + // depend on image pulls or scheduling, keeping it fast and reliable. + [MinikubeFact] + public void ConfigMapRoundTrip() + { + var namespaceParameter = "default"; + var name = "k8scsharp-e2e-classic-configmap"; + + using var client = CreateClient(); + + void Cleanup() + { + var maps = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); + while (maps.Items.Any(m => m.Metadata.Name == name)) + { + try + { + client.CoreV1.DeleteNamespacedConfigMap(name, namespaceParameter); + } + catch (HttpOperationException e) when (e.Response.StatusCode == HttpStatusCode.NotFound) + { + return; + } + + Thread.Sleep(TimeSpan.FromSeconds(1)); + maps = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); + } + } + + try + { + Cleanup(); + + client.CoreV1.CreateNamespacedConfigMap( + new V1ConfigMap + { + Metadata = new V1ObjectMeta { Name = name }, + Data = new Dictionary { ["key"] = "value" }, + }, + namespaceParameter); + + var read = client.CoreV1.ReadNamespacedConfigMap(name, namespaceParameter); + Assert.Equal("value", read.Data["key"]); + + var list = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); + Assert.Contains(list.Items, m => m.Metadata.Name == name); + } + finally + { + Cleanup(); + } + } + + public static IKubernetes CreateClient() + { + return new Kubernetes(KubernetesClientConfiguration.BuildDefaultConfig()); + } + } +} From 70519078d6ce295b8bcd8d9b59cc522cb2f34cfa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 23:03:14 +0000 Subject: [PATCH 2/6] Simplify cleanup loop and remove unused usings --- tests/E2E.Classic.Tests/MinikubeClassicTests.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/E2E.Classic.Tests/MinikubeClassicTests.cs b/tests/E2E.Classic.Tests/MinikubeClassicTests.cs index d7687ac09..f129be0cc 100644 --- a/tests/E2E.Classic.Tests/MinikubeClassicTests.cs +++ b/tests/E2E.Classic.Tests/MinikubeClassicTests.cs @@ -1,8 +1,6 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Net; -using System.Threading; using k8s.Autorest; using k8s.Models; using Xunit; @@ -38,7 +36,6 @@ void Cleanup() return; } - Thread.Sleep(TimeSpan.FromSeconds(1)); maps = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); } } From 80aa352fe7ea23b281d9871733fded1270292a42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Jun 2026 18:17:03 +0000 Subject: [PATCH 3/6] Use oci-to-wsl to import kindest/node directly into WSL --- .github/e2e/bootstrap-kind.sh | 42 ++++++++++++++++++++++++ .github/e2e/kind-wsl.yaml | 21 ++++++++++++ .github/workflows/buildtest.yaml | 56 ++++++++++++++------------------ 3 files changed, 88 insertions(+), 31 deletions(-) create mode 100755 .github/e2e/bootstrap-kind.sh create mode 100644 .github/e2e/kind-wsl.yaml diff --git a/.github/e2e/bootstrap-kind.sh b/.github/e2e/bootstrap-kind.sh new file mode 100755 index 000000000..25fcac357 --- /dev/null +++ b/.github/e2e/bootstrap-kind.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Bring up a single node Kubernetes control plane inside the kindest/node rootfs +# that oci-to-wsl imported into WSL. kind normally runs this image as a Docker +# container and drives kubeadm from the host through `docker exec`; here WSL +# boots the image's systemd directly, so the equivalent bootstrap is performed +# in place. +set -euxo pipefail + +# The kindest/node entrypoint (which WSL does not run) makes the root mount +# shared and enables IPv4 forwarding; reproduce the parts kubeadm and the +# kubelet rely on. +mount --make-rshared / 2>/dev/null || true +sysctl -w net.ipv4.ip_forward=1 || true + +# containerd ships as a systemd unit in the node image. +systemctl enable --now containerd + +# Wait for the container runtime to accept requests. +for _ in $(seq 1 60); do + if ctr --namespace k8s.io version >/dev/null 2>&1; then + break + fi + sleep 2 +done + +# Initialise the control plane. Preflight errors are ignored because the WSL +# environment intentionally differs from a vanilla node (swap on, kernel +# modules provided by the Windows-side kernel, and so on). +kubeadm init \ + --ignore-preflight-errors=all \ + --pod-network-cidr=10.244.0.0/16 \ + --apiserver-cert-extra-sans=127.0.0.1,localhost + +export KUBECONFIG=/etc/kubernetes/admin.conf + +# Single node cluster: allow workloads to schedule on the control-plane node. +kubectl taint nodes --all node-role.kubernetes.io/control-plane- 2>/dev/null || true + +# kindest/node bundles the default CNI (kindnet) manifest. +kubectl apply -f /kind/manifests/default-cni.yaml + +kubectl wait --for=condition=Ready nodes --all --timeout=180s diff --git a/.github/e2e/kind-wsl.yaml b/.github/e2e/kind-wsl.yaml new file mode 100644 index 000000000..bf6a71c22 --- /dev/null +++ b/.github/e2e/kind-wsl.yaml @@ -0,0 +1,21 @@ +# oci-to-wsl profile that imports the kindest/node image into WSL as a +# systemd-enabled distribution. Unlike the regular "kind in Docker" flow, the +# Kubernetes node runs natively inside WSL, so no Docker daemon or nested +# containers are required on the Windows runner. +name: kind +image: kindest/node:v1.32.2 +install_dir: C:\WSL\kind + +# kindest/node expects an init system; WSL boots systemd when configured. +wsl_conf: + mode: merge + content: | + [boot] + systemd=true + +# Stage the bootstrap script that turns the imported rootfs into a running +# single node control plane. Path is resolved relative to this profile. +files: + - src: ./bootstrap-kind.sh + dst: /usr/local/bin/bootstrap-kind.sh + mode: "0755" diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index b2985979b..9333b3bb6 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -88,9 +88,12 @@ jobs: fi # Run the .NET Framework (net48) end to end tests on Windows. There is no - # Linux Kubernetes distribution that runs natively on a Windows runner, so a - # kind cluster is created inside WSL and exposed to the Windows host (which - # runs the net48 test process) through WSL2 localhost forwarding. + # Linux Kubernetes distribution that runs natively on a Windows runner, so the + # kindest/node image (which already bundles containerd, the kubelet and the + # control-plane components) is imported straight into WSL with oci-to-wsl. + # WSL2 is enabled by default on the runner, so no separate WSL provisioning is + # needed, and the API server is reachable from the Windows host (which runs the + # net48 test process) through WSL2 localhost forwarding. e2e-windows-net48: runs-on: windows-latest name: E2E net48 (kind in WSL) @@ -104,41 +107,32 @@ jobs: dotnet-version: | 8.0.x 10.0.x - - name: Setup WSL - uses: Vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0 - with: - distribution: Ubuntu-24.04 - additional-packages: docker.io curl - - name: Create kind cluster in WSL - shell: wsl-bash {0} + - name: Install oci-to-wsl + shell: pwsh run: | - set -euxo pipefail - - # WSL has no systemd, so start the docker daemon manually and wait for it. - sudo dockerd > /tmp/dockerd.log 2>&1 & - for i in $(seq 1 30); do - if sudo docker info > /dev/null 2>&1; then break; fi - sleep 2 - done - sudo docker info > /dev/null - - # Install kind and kubectl. - curl -fsSLo ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 - chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind - curl -fsSLo ./kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl + $url = "https://github.com/tg123/oci-to-wsl/releases/download/v0.0.1/oci-to-wsl_windows_x86_64.zip" + Invoke-WebRequest $url -OutFile oci-to-wsl.zip + Expand-Archive -Force oci-to-wsl.zip -DestinationPath . + - name: Start kind cluster in WSL + shell: pwsh + run: | + # Import kindest/node into WSL as a systemd-enabled distro named "kind". + .\oci-to-wsl.exe --profile .github/e2e/kind-wsl.yaml - # Create the cluster. kind publishes the api server on 127.0.0.1 inside - # WSL, which WSL2 localhost forwarding makes reachable from Windows. - sudo kind create cluster --wait 120s + # Reboot the distro so the systemd configuration written by the profile + # takes effect, then bring up the single node control plane in place. + wsl --shutdown + wsl -d kind -u root -- bash /usr/local/bin/bootstrap-kind.sh - # Export a kubeconfig the Windows side can consume. - sudo kind get kubeconfig > /mnt/c/kind.kubeconfig + # Export a kubeconfig for the Windows host. kubeadm points it at the WSL + # eth0 address; rewrite it to localhost, which WSL2 forwards into WSL. + wsl -d kind -u root -- cat /etc/kubernetes/admin.conf | Out-File -Encoding ascii kind.kubeconfig + (Get-Content kind.kubeconfig) -replace 'server: https://[^ ]+', 'server: https://127.0.0.1:6443' | Set-Content kind.kubeconfig - name: E2E net48 Test shell: pwsh env: K8S_E2E_MINIKUBE: "1" - KUBECONFIG: C:\kind.kubeconfig + KUBECONFIG: ${{ github.workspace }}\kind.kubeconfig run: | "" | Out-File -Encoding ascii skip.log dotnet test tests/E2E.Classic.Tests -f net48 --logger "SkipTestLogger;file=$PWD/skip.log" -p:BuildInParallel=false From fca6f8ac095753c567b79823e53e598fb330fbfb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Jun 2026 18:18:19 +0000 Subject: [PATCH 4/6] Verify oci-to-wsl checksum; address review nits --- .github/e2e/bootstrap-kind.sh | 4 ++-- .github/workflows/buildtest.yaml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/e2e/bootstrap-kind.sh b/.github/e2e/bootstrap-kind.sh index 25fcac357..f1ceba1b4 100755 --- a/.github/e2e/bootstrap-kind.sh +++ b/.github/e2e/bootstrap-kind.sh @@ -16,14 +16,14 @@ sysctl -w net.ipv4.ip_forward=1 || true systemctl enable --now containerd # Wait for the container runtime to accept requests. -for _ in $(seq 1 60); do +for _ in {1..60}; do if ctr --namespace k8s.io version >/dev/null 2>&1; then break fi sleep 2 done -# Initialise the control plane. Preflight errors are ignored because the WSL +# Initialize the control plane. Preflight errors are ignored because the WSL # environment intentionally differs from a vanilla node (swap on, kernel # modules provided by the Windows-side kernel, and so on). kubeadm init \ diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index 9333b3bb6..237ae7c1a 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -111,7 +111,12 @@ jobs: shell: pwsh run: | $url = "https://github.com/tg123/oci-to-wsl/releases/download/v0.0.1/oci-to-wsl_windows_x86_64.zip" + $expected = "79772846F1CE4A38E5B2841EA2406A070F4DB64F3DBF3EA32F04B519111FD003" Invoke-WebRequest $url -OutFile oci-to-wsl.zip + $actual = (Get-FileHash oci-to-wsl.zip -Algorithm SHA256).Hash + if ($actual -ne $expected) { + throw "oci-to-wsl checksum mismatch: expected $expected, got $actual" + } Expand-Archive -Force oci-to-wsl.zip -DestinationPath . - name: Start kind cluster in WSL shell: pwsh From 0f7bba3a9a46c3a5b7538c8e5b638f0e80e7d020 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Jun 2026 18:29:21 +0000 Subject: [PATCH 5/6] Force LF endings for shell scripts to fix WSL kind bootstrap --- .gitattributes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitattributes b/.gitattributes index 65f0cf8c6..3bd3ea991 100644 --- a/.gitattributes +++ b/.gitattributes @@ -43,6 +43,11 @@ *.fsx text=auto *.hs text=auto +# Shell scripts must keep LF endings even when checked out on Windows; a CRLF +# turns `set -euxo pipefail` into `pipefail\r` (invalid option) once the file is +# copied into WSL. +*.sh text eol=lf + *.csproj text=auto *.vbproj text=auto *.fsproj text=auto From 5f8cdaa09a9de785470747f02f4da393b8cd839a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Jun 2026 18:53:56 +0000 Subject: [PATCH 6/6] Run full Linux e2e suite in kind-in-WSL job; remove net48 Classic e2e --- .github/workflows/buildtest.yaml | 57 ++++++++++++--- .../E2E.Classic.Tests.csproj | 33 --------- .../E2E.Classic.Tests/MinikubeClassicTests.cs | 72 ------------------- 3 files changed, 47 insertions(+), 115 deletions(-) delete mode 100644 tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj delete mode 100644 tests/E2E.Classic.Tests/MinikubeClassicTests.cs diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index 237ae7c1a..994ff5b1c 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -87,16 +87,16 @@ jobs: exit 1 fi - # Run the .NET Framework (net48) end to end tests on Windows. There is no - # Linux Kubernetes distribution that runs natively on a Windows runner, so the - # kindest/node image (which already bundles containerd, the kubelet and the - # control-plane components) is imported straight into WSL with oci-to-wsl. + # Run the same end to end suite as the Linux `e2e` job, but on Windows. There + # is no Linux Kubernetes distribution that runs natively on a Windows runner, + # so the kindest/node image (which already bundles containerd, the kubelet and + # the control-plane components) is imported straight into WSL with oci-to-wsl. # WSL2 is enabled by default on the runner, so no separate WSL provisioning is # needed, and the API server is reachable from the Windows host (which runs the - # net48 test process) through WSL2 localhost forwarding. - e2e-windows-net48: + # test process) through WSL2 localhost forwarding. + e2e-windows-wsl: runs-on: windows-latest - name: E2E net48 (kind in WSL) + name: E2E (kind in WSL) steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -106,6 +106,7 @@ jobs: with: dotnet-version: | 8.0.x + 9.0.x 10.0.x - name: Install oci-to-wsl shell: pwsh @@ -125,22 +126,58 @@ jobs: .\oci-to-wsl.exe --profile .github/e2e/kind-wsl.yaml # Reboot the distro so the systemd configuration written by the profile - # takes effect, then bring up the single node control plane in place. + # takes effect. wsl --shutdown + + # WSL terminates the lightweight VM once its last session exits, which + # tears down the API server between steps and makes localhost:6443 + # connections fail with "actively refused". Hold an idle session open in + # the background so the cluster (and WSL2 localhost forwarding) stay up + # for the duration of the host-side test steps. + Start-Process -FilePath wsl -ArgumentList '-d','kind','-u','root','--','sleep','infinity' + + # Bring up the single node control plane in place. wsl -d kind -u root -- bash /usr/local/bin/bootstrap-kind.sh # Export a kubeconfig for the Windows host. kubeadm points it at the WSL # eth0 address; rewrite it to localhost, which WSL2 forwards into WSL. wsl -d kind -u root -- cat /etc/kubernetes/admin.conf | Out-File -Encoding ascii kind.kubeconfig (Get-Content kind.kubeconfig) -replace 'server: https://[^ ]+', 'server: https://127.0.0.1:6443' | Set-Content kind.kubeconfig - - name: E2E net48 Test + + # Wait until the API server is reachable from the Windows host through + # the forwarded port before handing off to the test steps. + $ok = $false + foreach ($i in 1..60) { + if ((Test-NetConnection -ComputerName 127.0.0.1 -Port 6443 -WarningAction SilentlyContinue).TcpTestSucceeded) { + $ok = $true + break + } + Start-Sleep -Seconds 5 + } + if (-not $ok) { + throw "API server on 127.0.0.1:6443 was not reachable from the Windows host" + } + - name: Test + shell: pwsh + env: + K8S_E2E_MINIKUBE: "1" + KUBECONFIG: ${{ github.workspace }}\kind.kubeconfig + run: | + "" | Out-File -Encoding ascii skip.log + dotnet test tests/E2E.Tests --logger "SkipTestLogger;file=$PWD/skip.log" -p:BuildInParallel=false + if ((Get-Item skip.log).Length -gt 0) { + Get-Content skip.log + Write-Error "CASES MUST NOT BE SKIPPED" + exit 1 + } + - name: AOT Test shell: pwsh env: K8S_E2E_MINIKUBE: "1" KUBECONFIG: ${{ github.workspace }}\kind.kubeconfig run: | "" | Out-File -Encoding ascii skip.log - dotnet test tests/E2E.Classic.Tests -f net48 --logger "SkipTestLogger;file=$PWD/skip.log" -p:BuildInParallel=false + dotnet test tests/E2E.Aot.Tests --logger "SkipTestLogger;file=$PWD/skip.log" -p:BuildInParallel=false if ((Get-Item skip.log).Length -gt 0) { Get-Content skip.log Write-Error "CASES MUST NOT BE SKIPPED" diff --git a/tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj b/tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj deleted file mode 100644 index 322168743..000000000 --- a/tests/E2E.Classic.Tests/E2E.Classic.Tests.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - false - k8s.E2E - - net8.0 - net8.0;net48 - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - diff --git a/tests/E2E.Classic.Tests/MinikubeClassicTests.cs b/tests/E2E.Classic.Tests/MinikubeClassicTests.cs deleted file mode 100644 index f129be0cc..000000000 --- a/tests/E2E.Classic.Tests/MinikubeClassicTests.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Net; -using k8s.Autorest; -using k8s.Models; -using Xunit; - -namespace k8s.E2E -{ - [Collection(nameof(Onebyone))] - public class MinikubeClassicTests - { - // A small, self contained smoke test that exercises the .NET Framework (net48) - // build of the Classic client against a real cluster (kind running inside WSL on - // the Windows CI runner). ConfigMaps are used instead of Pods so the test does not - // depend on image pulls or scheduling, keeping it fast and reliable. - [MinikubeFact] - public void ConfigMapRoundTrip() - { - var namespaceParameter = "default"; - var name = "k8scsharp-e2e-classic-configmap"; - - using var client = CreateClient(); - - void Cleanup() - { - var maps = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); - while (maps.Items.Any(m => m.Metadata.Name == name)) - { - try - { - client.CoreV1.DeleteNamespacedConfigMap(name, namespaceParameter); - } - catch (HttpOperationException e) when (e.Response.StatusCode == HttpStatusCode.NotFound) - { - return; - } - - maps = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); - } - } - - try - { - Cleanup(); - - client.CoreV1.CreateNamespacedConfigMap( - new V1ConfigMap - { - Metadata = new V1ObjectMeta { Name = name }, - Data = new Dictionary { ["key"] = "value" }, - }, - namespaceParameter); - - var read = client.CoreV1.ReadNamespacedConfigMap(name, namespaceParameter); - Assert.Equal("value", read.Data["key"]); - - var list = client.CoreV1.ListNamespacedConfigMap(namespaceParameter); - Assert.Contains(list.Items, m => m.Metadata.Name == name); - } - finally - { - Cleanup(); - } - } - - public static IKubernetes CreateClient() - { - return new Kubernetes(KubernetesClientConfiguration.BuildDefaultConfig()); - } - } -}