Skip to content

Add Windows e2e tests via kind-in-WSL#1793

Closed
Copilot wants to merge 6 commits into
masterfrom
copilot/refine-windows-net48-e2e-test
Closed

Add Windows e2e tests via kind-in-WSL#1793
Copilot wants to merge 6 commits into
masterfrom
copilot/refine-windows-net48-e2e-test

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

There was no end-to-end coverage running on Windows against a real cluster. Windows runners can't run a Linux Kubernetes distro natively, so this runs Kubernetes inside WSL and reaches it from the Windows host process via WSL2 localhost forwarding.

CI — e2e-windows-wsl job in buildtest.yaml

  • windows-latest, which already has WSL2 enabled by default, so no separate WSL provisioning action is required.
  • Uses oci-to-wsl (download checksum-verified) to import the kindest/node image directly into WSL as a systemd-enabled distro via .github/e2e/kind-wsl.yaml. Kubernetes runs natively in WSL — no Docker daemon and no nested containers.
  • .github/e2e/bootstrap-kind.sh brings up a single-node control plane in place (kubeadm init, untaint the control-plane node, apply the bundled kindnet CNI, wait for Ready) and the job exports a kubeconfig rewritten to https://127.0.0.1:6443.
  • The job clones the existing Linux e2e suite onto Windows: it runs dotnet test tests/E2E.Tests and dotnet test tests/E2E.Aot.Tests against 127.0.0.1 with the same "cases must not be skipped" guard as the existing e2e jobs.
  • Because WSL terminates its lightweight VM once the last session exits (which tore down the API server between steps and caused 127.0.0.1:6443 connections to be actively refused), the job holds an idle background WSL session open and waits for 127.0.0.1:6443 to accept connections before running the tests.

Line endings

  • *.sh is pinned to LF in .gitattributes so bootstrap-kind.sh isn't checked out with CRLF on the Windows runner (a trailing \r turned set -euxo pipefail into an invalid option and aborted the bootstrap).

Notes for reviewers

  • The full Linux e2e suite runs on the Windows host as net8.0/net9.0/net10.0; the kind-in-WSL networking path (including the in-WSL kubeadm bootstrap) can only be exercised on the actual Windows runner.
  • The earlier dedicated net48 Classic e2e project (tests/E2E.Classic.Tests) has been removed in favor of reusing the existing Linux e2e suite.

Copilot AI self-assigned this Jun 8, 2026
Copilot AI review requested due to automatic review settings June 8, 2026 09:51
Copilot AI removed the request for review from Copilot June 8, 2026 09:51
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 8, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Copilot
Once this PR has been reviewed and has the lgtm label, please ask for approval from tg123. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 8, 2026

Copy link
Copy Markdown

CLA Not Signed

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 8, 2026
@tg123

tg123 commented Jun 8, 2026

Copy link
Copy Markdown
Member

@copilot you can try https://github.com/tg123/oci-to-wsl to import a kind image, no wsl setup required i believe, it is default on

check this pipeline for ref https://github.com/tg123/oci-to-wsl/blob/main/.github/workflows/e2e.yml

Copilot AI requested review from Copilot and removed request for Copilot June 8, 2026 18:17

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot you can try https://github.com/tg123/oci-to-wsl to import a kind image, no wsl setup required i believe, it is default on

check this pipeline for ref https://github.com/tg...

Switched to oci-to-wsl in 80aa352. The job now imports kindest/node straight into WSL (systemd-enabled) via .github/e2e/kind-wsl.yaml + bootstrap-kind.sh, so there's no Vampire/setup-wsl, no dockerd, and no nested containers — Kubernetes runs natively in WSL and the net48 host reaches the API server over WSL2 localhost forwarding. I couldn't exercise the WSL/kind runtime path in the sandbox (no Windows/WSL), so the in-WSL bootstrap will need a CI run on the Windows runner to confirm.

Copilot AI requested review from Copilot and removed request for Copilot June 8, 2026 18:18
Copilot finished work on behalf of tg123 June 8, 2026 18:19
@tg123

tg123 commented Jun 8, 2026

Copy link
Copy Markdown
Member

@copilot fix ci

⠸ Importing into WSL [17s] WSL distribution "kind" created successfully.
wsl: Failed to start the systemd user session for 'root'. See journalctl for more details.
/usr/local/bin/bootstrap-kind.sh: line 7: set: pipefail
: invalid option name
cat: /etc/kubernetes/admin.conf: No such file or directory

seems kind starting issue

Copilot AI requested review from Copilot and removed request for Copilot June 8, 2026 18:29

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix ci

⠸ Importing into WSL [17s] WSL distribution "kind" created successfully.
...

The root cause was line endings: GitHub's Windows runners check out with core.autocrlf=true, so bootstrap-kind.sh arrived in WSL with CRLF. That turned set -euxo pipefail into set -euxo pipefail\r, which bash rejected as pipefail: invalid option name — the script aborted on line 7, so kubeadm init never ran and /etc/kubernetes/admin.conf was missing. Fixed in 0f7bba3 by forcing LF for *.sh in .gitattributes. (The Failed to start the systemd user session for 'root' line is just a benign warning from the root login session, not the cluster failure.)

Copilot finished work on behalf of tg123 June 8, 2026 18:30
@tg123

tg123 commented Jun 8, 2026

Copy link
Copy Markdown
Member

@copilot seems kind is good now, but test is not happy, please check
and
1 clone all linux e2e to windows wsl version
2 remove old net classic e2e

Copilot AI requested review from Copilot and removed request for Copilot June 8, 2026 18:53

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot seems kind is good now, but test is not happy, please check
and
1 clone all linux e2e to windows wsl version
...

Done in 5f8cdaa.

  1. Removed tests/E2E.Classic.Tests (the net48 Classic e2e).
  2. The Windows job (e2e-windows-wsl) now clones the Linux e2e suite — it runs tests/E2E.Tests and tests/E2E.Aot.Tests against kind-in-WSL with the same "cases must not be skipped" guard.

The test failure was 127.0.0.1:6443 actively refused: kind now boots fine, but WSL tears down its lightweight VM once the last session exits, so the API server was gone by the time the host test step connected. Fixed by holding an idle background WSL session open and waiting for 127.0.0.1:6443 to accept connections before running the tests.

Copilot AI changed the title Add Windows net48 e2e test via kind-in-WSL Add Windows e2e tests via kind-in-WSL Jun 8, 2026
Copilot finished work on behalf of tg123 June 8, 2026 18:58
@tg123 tg123 closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants