From 9b64a13eec3025dea1391cd7c0489036b4b4fa72 Mon Sep 17 00:00:00 2001 From: Ji-Eun Lee Date: Tue, 31 Mar 2026 16:43:42 -0700 Subject: [PATCH 1/2] test: add shouldPatchCoredns WSL2 unit tests Follow up of #1207 Add tests verifying CoreDNS patching is skipped on WSL2 and still applied on non-WSL runtimes. Existing tests updated to pass explicit platform opts so they work correctly when run from a WSL2 host. --- test/platform.test.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/platform.test.js b/test/platform.test.js index f76e2ffb2a5..a66f821d93b 100644 --- a/test/platform.test.js +++ b/test/platform.test.js @@ -201,15 +201,24 @@ describe("platform helpers", () => { }); describe("shouldPatchCoredns", () => { - it("patches CoreDNS for all known runtimes", () => { - expect(shouldPatchCoredns("colima")).toBe(true); - expect(shouldPatchCoredns("docker-desktop")).toBe(true); - expect(shouldPatchCoredns("docker")).toBe(true); - expect(shouldPatchCoredns("podman")).toBe(true); + it("patches on non-WSL runtimes", () => { + const nonWslOpts = { platform: "darwin", env: {} }; + expect(shouldPatchCoredns("colima", nonWslOpts)).toBe(true); + expect(shouldPatchCoredns("docker-desktop", nonWslOpts)).toBe(true); + expect(shouldPatchCoredns("docker", nonWslOpts)).toBe(true); + expect(shouldPatchCoredns("podman", nonWslOpts)).toBe(true); }); it("skips unknown runtimes", () => { expect(shouldPatchCoredns("unknown")).toBe(false); }); + + it("skips on WSL", () => { + expect(shouldPatchCoredns("docker-desktop", { + platform: "linux", + env: { WSL_DISTRO_NAME: "Ubuntu" }, + release: "6.6.87.2-microsoft-standard-WSL2", + })).toBe(false); + }); }); }); From 4f0da2df5544750d2997eec2ef364d76018de05f Mon Sep 17 00:00:00 2001 From: Ji-Eun Lee Date: Wed, 1 Apr 2026 15:01:18 -0700 Subject: [PATCH 2/2] Fix styling. --- test/platform.test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/platform.test.js b/test/platform.test.js index a66f821d93b..0f3c4eeb283 100644 --- a/test/platform.test.js +++ b/test/platform.test.js @@ -214,11 +214,13 @@ describe("platform helpers", () => { }); it("skips on WSL", () => { - expect(shouldPatchCoredns("docker-desktop", { - platform: "linux", - env: { WSL_DISTRO_NAME: "Ubuntu" }, - release: "6.6.87.2-microsoft-standard-WSL2", - })).toBe(false); + expect( + shouldPatchCoredns("docker-desktop", { + platform: "linux", + env: { WSL_DISTRO_NAME: "Ubuntu" }, + release: "6.6.87.2-microsoft-standard-WSL2", + }), + ).toBe(false); }); }); });